SA-MP Forums Archive
Make Car Spawn At Player Chords - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Make Car Spawn At Player Chords (/showthread.php?tid=78321)



Make Car Spawn At Player Chords - bumfluff - 19.05.2009

Hello I was wondering how can i make it so that if i type /Alpha it will spawn a car infront of me (anywhere in the map)



Re: Make Car Spawn At Player Chords - Redirect Left - 19.05.2009

Use GetPlayerPos & CreateVehicle using the positions gathered from GetPlayerPos.


Re: Make Car Spawn At Player Chords - Backwardsman97 - 19.05.2009

You also need to use sine and cosine to get a position in front of the player. There are lots of functions for this though.

pawn Код:
stock GetXYInDirectionOfPosition(Float:direction, &Float:x, &Float:y, Float:dist)
{
  x += (dist * floatsin(-direction, degrees));
  y += (dist * floatcos(-direction, degrees));
}
Just us the player's facing angle for direction. You can also look at the debug FS for reference.


Re: Make Car Spawn At Player Chords - bumfluff - 19.05.2009

Quote:
Originally Posted by backwardsman97
You also need to use sine and cosine to get a position in front of the player. There are lots of functions for this though.

pawn Код:
stock GetXYInDirectionOfPosition(Float:direction, &Float:x, &Float:y, Float:dist)
{
  x += (dist * floatsin(-direction, degrees));
  y += (dist * floatcos(-direction, degrees));
}
Just us the player's facing angle for direction. You can also look at the debug FS for reference.
Ok can kinda understand I know(c++ ^^)
But Can u help to write the script