RemovePlayerFromVehicle not working
#1

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?
Reply
#2

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;
}
Reply
#3

Nope. it didnt work.
Reply
#4

Hold up I thing I found it out.
Reply
#5

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

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
Reply
#7

nope, didnt work.
Reply
#8

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?
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)