SA-MP Forums Archive
Q:How to get a owned vehicle by a player stay when he is offline - 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: Q:How to get a owned vehicle by a player stay when he is offline (/showthread.php?tid=508586)



Q:How to get a owned vehicle by a player stay when he is offline - DarkLored - 23.04.2014

So i am making a roleplay script and i can't figure out how to make a vehicle stay in the same place when a player left the server any hints or tips?


Re: Q:How to get a owned vehicle by a player stay when he is offline - DobbysGamertag - 23.04.2014

pawn Код:
enum vehicles{
    Float:vX,
    Float:vY,
    Float:vZ
}
new LastPos[MAX_VEHICLES][vehicles];

public OnPlayerDisconnect(playerid,reason)
{
    new vid = GetPlayerVehicleID(playerid),
    Float:x,
    Float:y,
    Float:z
    ;

    GetPlayerPos(playerid,x,y,z);

    if(vid != INVALID_VEHICLE_ID)
    {
        LastPos[vid][vX] = x;
        LastPos[vid][vY] = y;
        LastPos[vid][vZ] = z;
    }
    return 1;
}
Wrote this just now. Not sure how much use it'd be :P i guess it sorta gives the general idea of it. Then use a timer maybe? to check if its in its X Y Z pos and set it.