SA-MP Forums How can I get the x y z pos of the BACK/FRONT of something?
 New Account Members List Search Today's Posts Mark Forums Read

 03/01/2019, 11:29 AM #1 aKnoxx Big Clucker     Join Date: Dec 2018 Location: United States Discord: ABC#6701 Posts: 76 Reputation: 0 How can I get the x y z pos of the BACK/FRONT of something? Say I want to make a cmd to put an object IN FRONT of a player. Or spawn a vehicle IN FRONT of a player. How do I do that? When I do it like this: GetPlayerPos(playerid, x, y, z); And then do x +2, y, z It spawns it +2 x. And then when I do +3 y, it spawns it +3 y, ect. I can't figure out how to make it spawn in front of me. I'd assume it has something to do with math and your facing angle but I can't figure out how to do it. How can I do something like that? Last edited by aKnoxx; 03/01/2019 at 06:15 PM.
 03/01/2019, 12:01 PM #2 beckzy Beta Tester   Join Date: Dec 2006 Posts: 1,234 Reputation: 159 Re: How can I get the x y z pos of the BACK/FRONT of something? Get the X and Y 2 units in front of a player: Code: ```new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); x += floatsin(-a, degrees) * 2.0; y += floatcos(-a, degrees) * 2.0;``` Get the X and Y 2 units behind a player: Code: ```new Float:x, Float:y, Float:z, Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); a = a < 180.0 ? a + 180.0 : a - 180.0; x += floatsin(-a, degrees) * 2.0; y += floatcos(-a, degrees) * 2.0;``` __________________

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post TudorTudy23 Maps 4 26/11/2014 08:54 PM Nirzor Gamemode Scripts 40 30/07/2013 07:09 AM Nirzor Gamemode Scripts 36 08/06/2013 04:27 PM Yves Everything and Nothing 9 05/03/2013 11:25 AM martin3644 Scripting Help 6 06/02/2013 09:30 PM

All times are GMT. The time now is 06:25 AM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top