SA-MP Forums Archive
Automatically exit the player's vehicle and enter it again automatically - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Automatically exit the player's vehicle and enter it again automatically (/showthread.php?tid=248693)



Automatically exit the player's vehicle and enter it again automatically - Pz - 15.04.2011

Howdy,

O.K., I created this callback called OnPlayerTeleport, and basically - we all know that having many objects will end up to some objects to not load unless you exit your vehicle.

Basically, I have absolutely no idea how will I be able to create this, because there are some teleports that some objects don't load, and if I RemovePlayerFromVehicle, it'll be annoying for the player to re-enter it.

If it is possible, how can I let the player automatically be ejected out of hes vehicle so the objects can load, and then be automatically entered to hes vehicle.

/discuss, and /share.


Re: Automatically exit the player's vehicle and enter it again automatically - XFlawless - 15.04.2011

Use PutPlayerInVehicle and GetNearestVehicle.


Re: Automatically exit the player's vehicle and enter it again automatically - woot - 15.04.2011

pawn Code:
stock ResetPlayerIntoVehicle(playerid)
{
    if(!IsPlayerInAnyVehicle(playerid))
        return 0;      
       
    SetTimerEx("PutPlayerInVehicleEx", 500, false, "dd", playerid, GetPlayerVehicleID(playerid));
       
    new Float:fPosition[3];
    GetPlayerPos(playerid, fPosition[0], fPosition[1], fPosition[2]);
    SetPlayerPos(playerid, fPosition[0], fPosition[1], fPosition[2]+3);
}

forward PutPlayerInVehicleEx(playerid, vehicleid);
public PutPlayerInVehicleEx(playerid, vehicleid)
{
    PutPlayerInVehicle(playerid, vehicleid, 0);
}