SA-MP Forums Archive
RemovePlayerFromVehicle not working - 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: RemovePlayerFromVehicle not working (/showthread.php?tid=162319)



RemovePlayerFromVehicle not working - Emanuel_Rodriguez - 23.07.2010

Ok, so I am trying to make it where noone can enter police vehicles, and i mean noone. so, i made this:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
    if(newstate == 2)
    {
        if(GetVehicleModel(596))
        {
            RemovePlayerFromVehicle(playerid);
        }
        if(GetVehicleModel(599))
        {
            RemovePlayerFromVehicle(playerid);
        }
        return 1;
    }
    return 1;
}
but it doesnt remove the player from the police car, nor the rancher! can anyone help?


Re: RemovePlayerFromVehicle not working - Яσскѕтая - 23.07.2010

Not sure if this will work but its worth a shot.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(596))
    {
         RemovePlayerFromVehicle(playerid);
    }
    else if(GetVehicleModel(599))
    {
         RemovePlayerFromVehicle(playerid);
    }
    return 1;
}



Re: RemovePlayerFromVehicle not working - Emanuel_Rodriguez - 23.07.2010

Nope. it didnt work.


Re: RemovePlayerFromVehicle not working - Яσскѕтая - 23.07.2010

Hold up I thing I found it out.


Re: RemovePlayerFromVehicle not working - MisterTickle - 23.07.2010

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 596)
    {
         RemovePlayerFromVehicle(playerid);
    }
    else if(GetVehicleModel(vehicleid) == 599)
    {
         RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
Try this.


Re: RemovePlayerFromVehicle not working - bartje01 - 23.07.2010

new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z)l
SetPlayerPos(playerid,X,Y+0.5,Z);

try this if the others don't work


Re: RemovePlayerFromVehicle not working - Emanuel_Rodriguez - 23.07.2010

nope, didnt work.


Re: RemovePlayerFromVehicle not working - Emanuel_Rodriguez - 23.07.2010

Quote:
Originally Posted by bartje01
Посмотреть сообщение
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z)l
SetPlayerPos(playerid,X,Y+0.5,Z);

try this if the others don't work
why would i try this?


Re: RemovePlayerFromVehicle not working - Toni - 23.07.2010

@ MisterTickles code should work, you need to get the vehicleid before removing them from the actual vehicle.


Re: RemovePlayerFromVehicle not working - Яσскѕтая - 23.07.2010

Quote:
Originally Posted by Emanuel_Rodriguez
Посмотреть сообщение
why would i try this?
Because he's right...
pawn Код:
new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    if(GetVehicleModel(vehicleid) == 596)
    {
        SetPlayerPos(playerid,x,y,z+2.0);
    }
    if(GetVehicleModel(vehicleid) == 599)
    {
        SetPlayerPos(playerid,x,y,z+2.0);
    }
Tested it, it works.
It goes under OnPlayerEnterVehicle