teleporting behind - 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)
+--- Thread: teleporting behind (
/showthread.php?tid=580482)
teleporting behind -
suni - 05.07.2015
Код:
SetPlayerPos(playerid, x+2, y, z);
i need help with this. when im using /g i want to teleport behind players but i dont know how to edit this code. help please.
Re: teleporting behind -
Threshold - 05.07.2015
pawn Код:
GetXYBehindPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if(IsPlayerInAnyVehicle(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
x -= (distance * floatsin(-a, degrees));
y -= (distance * floatcos(-a, degrees));
return 1;
}
Example:
pawn Код:
GetXYBehindPlayer(target, x, y, 2.0);
SetPlayerPos(playerid, x, y, z);
Re: teleporting behind -
suni - 05.07.2015
thx +rep