Player does not get kicked out of a vehicle
#3

This is not how the operator || is used (To know how, click me). You should of used "," instead of it if you wanna save lines, like this:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new model = GetVehicleModel(vehicleid);
    if(model == 541)
    {
    if (GetPlayerSkin(playerid) != 0 ) return SendClientMessage(playerid, -1, "You may not drive this vehicle!"), RemovePlayerFromVehicle(playerid);
    }
    return 1;
}
But, this still won't work because you're using RemovePlayerFromVehicle under OnPlayerEnterVehicle which is called before a player enters a vehicle (Actually as soon as they press RETURN), so RemovePlayerFromVehicle won't have effects as the player hasn't entered the vehicle yet. If I were you, I'd do it this way:

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new model = GetVehicleModel(vehicleid);
    if(model == 541)
    {
        if (GetPlayerSkin(playerid) != 0 )
        {
            SendClientMessage(playerid, -1, "You may not drive this vehicle!");
            TogglePlayerControllable(playerid, false); // freezes the player
            TogglePlayerControllable(playerid, true); // then unfreezes him, which will cause him to stop the entering animation (and won't enter the vehicle)
            return 1;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Player does not get kicked out of a vehicle - by 69 - 02.11.2012, 21:18
Re : Player does not get kicked out of a vehicle - by 69 - 02.11.2012, 21:42
Re: Player does not get kicked out of a vehicle - by [KHK]Khalid - 02.11.2012, 21:43
Re : Player does not get kicked out of a vehicle - by 69 - 02.11.2012, 22:05
Re : Player does not get kicked out of a vehicle - by 69 - 03.11.2012, 09:00
Re: Player does not get kicked out of a vehicle - by Emre__ - 03.11.2012, 09:35
Re : Re: Player does not get kicked out of a vehicle - by 69 - 03.11.2012, 09:43
Re: Player does not get kicked out of a vehicle - by iggy1 - 03.11.2012, 10:07

Forum Jump:


Users browsing this thread: 4 Guest(s)