Fabio132 2 Posted January 29 Share Posted January 29 Hello, I wanna make a Menu to give Money and other things but i dont find any function for getting player that i pointing at in js. I want to return the player that i point at Example: let target = player.pointat(); target.setVariable('test',1); When you find a function like this pls help me Thanks for Reading and your Help. Link to post Share on other sites
Kopra 5 Posted January 30 Share Posted January 30 Take a look at these functions, they may help you: Player::getEntityIsFreeAimingAt - RAGE Multiplayer Wiki Player::taskLookAt - RAGE Multiplayer Wiki Link to post Share on other sites
Fabio132 2 Posted January 30 Author Share Posted January 30 (edited) vor 4 Stunden schrieb Kopra: Take a look at these functions, they may help you: Player::getEntityIsFreeAimingAt - RAGE Multiplayer Wiki Player::taskLookAt - RAGE Multiplayer Wiki Thanks Man but thats not for getting its setting and the Free Aiming is for shooting with weapon Edited January 30 by Fabio132 Link to post Share on other sites
Kopra 5 Posted January 30 Share Posted January 30 Okay but did you try with player.Heading? Player::heading - RAGE Multiplayer Wiki It says here that it returns facing angle in degree, but I'm not sure how accurate that is but I think that you will have to experiment yourself because I can not find any default functions like you described in first post. Link to post Share on other sites
Fabio132 2 Posted January 30 Author Share Posted January 30 vor 6 Minuten schrieb Kopra: Okay but did you try with player.Heading? Player::heading - RAGE Multiplayer Wiki It says here that it returns facing angle in degree, but I'm not sure how accurate that is but I think that you will have to experiment yourself because I can not find any default functions like you described in first post. Yeah, it seems like it doesn't exists a function like that. But thanks for your help. 1 Link to post Share on other sites
offsetx 1 Posted February 5 Share Posted February 5 you can use Raycasting here's a example on wiki https://wiki.rage.mp/index.php?title=Raycasting::testPointToPoint function pointingAt(distance) { const camera = mp.cameras.new("gameplay"); // gets the current gameplay camera let position = camera.getCoord(); // grab the position of the gameplay camera as Vector3 let direction = camera.getDirection(); // get the forwarding vector of the direction you aim with the gameplay camera as Vector3 let farAway = new mp.Vector3((direction.x * distance) + (position.x), (direction.y * distance) + (position.y), (direction.z * distance) + (position.z)); // calculate a random point, drawn on a invisible line between camera position and direction (* distance) let result = mp.raycasting.testPointToPoint(position, farAway, null, 17); // now test point to point - intersects with map and objects [1 + 16] return result; // and return the result ( undefined, if no hit ) } Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now