14.03.2012, 06:07
One thing has always puzzled me about sa-mp scripting. When I think of samp coordinates, I think of one huge 3D coordinated plane. Now the thing that truly puzzles me is how I will be able to spawn something like a vehicle or create an explosion in front of a player, because let's say I use GetPlayerPos passed by 3 floats. Now, how would I be able to get which axis the player is facing on so that the desired object will always spawn in front of the player no matter what angle he is facing.
In other words. This code below makes a car 3 gta units away from their position on the y-axis.
But what if a player is facing towards the negative side on the y-axis? The vehicle wouldn't spawn in front of him anymore. So how will I be able to make sure a vehicle or an explosion will always occur 3 units in front of the player regardless of which way he's facing? Is this possible? It's just something that has always puzzled me. Maybe it's something so simple that I missed somewhere, I'm not so sure. But I would appreciate if anyone could be of any help. Thank you.
In other words. This code below makes a car 3 gta units away from their position on the y-axis.
pawn Код:
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
CreateVehicle(/*params here*/,x,y + 3,z);