Save vehicle position - 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: Save vehicle position (
/showthread.php?tid=594122)
Save vehicle position -
SalmaN97 - 13.11.2015
Hello i am trying to code :
when player dies and the player is not in the safe zone then player vehicle position should be saved and respawned at the same place everytime until he changes the position manualy
here is my code
PHP код:
//onplayerdeath
if(!IsPlayerInDynamicArea(playerid, safezone))
{
new Float:x, Float:y, Float:z, Float:a;
if(PlayerInfo[playerid][pVehicle1] != 0)
{
GetVehiclePos(car1[playerid], x, y, z);
GetVehicleZAngle(car1[playerid], a);
PlayerInfo[playerid][pVehicle1X] = x;
PlayerInfo[playerid][pVehicle1Y] = y;
PlayerInfo[playerid][pVehicle1Z] = z;
PlayerInfo[playerid][pVehicle1C] = a;
DestroyVehicle(car1[playerid]);
car1[playerid] = CreateVehicle(PlayerInfo[playerid][pVehicle1Model], Float:x, Float:y, Float:z, Float:a, PlayerInfo[playerid][pVehicle1Color1], PlayerInfo[playerid][pVehicle1Color2], 999999);
}
}
but its not working
Re: Save vehicle position -
UltraScripter - 13.11.2015
thats because you destroy the vehicle and then save (you save when the vehicle allready destroyed).
pawn Код:
if(!IsPlayerInDynamicArea(playerid, safezone))
{
new Float:x, Float:y, Float:z, Float:a;
if(PlayerInfo[playerid][pVehicle1] != 0)
{
GetVehiclePos(car1[playerid], x, y, z);
GetVehicleZAngle(car1[playerid], a);
PlayerInfo[playerid][pVehicle1X] = x;
PlayerInfo[playerid][pVehicle1Y] = y;
PlayerInfo[playerid][pVehicle1Z] = z;
PlayerInfo[playerid][pVehicle1C] = a;
car1[playerid] = CreateVehicle(PlayerInfo[playerid][pVehicle1Model], Float:x, Float:y, Float:z, Float:a, PlayerInfo[playerid][pVehicle1Color1], PlayerInfo[playerid][pVehicle1Color2], 999999);
DestroyVehicle(car1[playerid]);
}
}
Re: Save vehicle position -
UltraScripter - 13.11.2015
Oh never mind my bad it's create vehicle