SA-MP Forums Archive
Small problem regarding RemovePlayerFromVehicle - 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: Small problem regarding RemovePlayerFromVehicle (/showthread.php?tid=439325)



Small problem regarding RemovePlayerFromVehicle - rangerxxll - 25.05.2013

Resolved.


Re: Small problem regarding RemovePlayerFromVehicle - BpVanshVk - 25.05.2013

Umm, i was having same prob few weeks ago, wait, let me check my script


Re: Small problem regarding RemovePlayerFromVehicle - BpVanshVk - 25.05.2013

Try to putting it under OnPlayerStateChange instead.
This callback is called before the player enter the vehicle.



Re: Small problem regarding RemovePlayerFromVehicle - rangerxxll - 25.05.2013

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(vehicle == 511)
        {
            RemovePlayerFromVehicle(playerid);
            return 1;
        }
    }
    return 1;
}
It's still not working.


Re: Small problem regarding RemovePlayerFromVehicle - BpVanshVk - 25.05.2013

Or you can use
pawn Код:
new Float:x, Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z);
Replace it with "RemovePlayerFromVehicle(playerid)


Re: Small problem regarding RemovePlayerFromVehicle - BpVanshVk - 25.05.2013

If that doesn't work,
Try either
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == pilotjobvehicle)
    {
        if(pilotjob[playerid] == 0)
        {
            new Float:x, Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            SetPlayerPos(playerid,x,y,z);
            return 1;
        }
    }
    return 1;
}
OR
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(vehicle == 511)
        {
            new Float:x, Float:y,Float:z;
            GetPlayerPos(playerid,x,y,z);
            SetPlayerPos(playerid,x,y,z);
            return 1;
        }
    }
    return 1;
}