How to: - 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: How to: (
/showthread.php?tid=345532)
-
iGetty - 25.05.2012
How do I get the X, Y, Z at the back of a players vehicle?
Thanks!
I have:
pawn Код:
stock GetXYZBehindVehicle(playerid)
{
new vehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
new Float:Pos[5];
GetVehiclePos(GetPlayerVehicleID(playerid), Pos[1], Pos[2], Pos[3]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[4]);
switch(vehiclemodel)
{
case 400:
{
SetPlayerCheckpoint(playerid, Pos[1], Pos[2], Pos[3], 1.0);
}
}
return 1;
}
What do I do from that?
Edit: oops, was supposed to be an edit.
Re: How to: -
ReneG - 26.05.2012
I'm terrible at math, but I found this.
pawn Код:
stock GetXYBehindPlayer(playerid, &Float:x2, &Float:y2, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x2, y2, a);
GetPlayerFacingAngle(playerid, a);
if(GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x2 += (distance * floatsin(-a+180, degrees));
y2 += (distance * floatcos(-a+180, degrees));
}
Re: How to: -
iGetty - 26.05.2012
THANK YOU VINCENT!
It worked! :3
<3!
Re: How to: -
iGetty - 27.05.2012
Vincent, please could you look here? :
https://sampforum.blast.hk/showthread.php?tid=346171