01.12.2014, 11:17
How to set checkpoint in the back of vehicle?
Thanks.
Thanks.
stock GetXYBehindOfVehicle(vehicleid, &Float:x, &Float:y, Float:distance)
{
new
Float:a;
GetVehiclePos( vehicleid, x, y, a );
GetVehicleZAngle( vehicleid, a );
x += ( distance * floatsin( -a+180, degrees ));
y += ( distance * floatcos( -a+180, degrees ));
}
pawn Код:
|
/* Some Callback */
new veh = GetPlayerVehicleID(playerid);
new Float:X, Float:Y;
new Float:PX, Float:PY, Float:PZ;
GetPlayerPos(playerid, PX, PY, PZ); // To get Z Coordinate only.
GetXYBehindOfVehicle(vehicleid, X, Y, /* the distance */);
SetPlayerCheckPoint(playerid, X, Y, PZ, 5.0);
return 1;