[HELP] removePlayerFromVehicle
#1

Well i have seen on some servers that when you hit enter or f to hop into a car it kicks you out before you can even open the door of the car how can i do this because on my script it kicks you out of the car after you have hop into the car.
Reply
#2

Here's an example for this:

At the top of your script.
pawn Код:
new AdminVehicle;
Insert AdminVehicle = .... into OnGameModeInit, EXAMPLE:
pawn Код:
public OnGameModeInit()
{
    AdminVehicle = AddStaticVehicle(...);
    return 1;
}
This is when he presses enter.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new vehicle = GetPlayerVehicleID(playerid);
    if(vehicle == AdminVehicle && !IsPlayerAdmin(playerid)) // If this is an admin vehicle and he's not an rcon admin.
    {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid, 0xFFFFFFAA, "This is an admin vehicle, you can't drive it.");
    }
    return 1;
}
Reply
#3

Dude i Tested it after it it's ain't gived me any error but it's not working Huh idk why i did everything your told but it's ain't ejecting me from vehicle
Code
Quote:

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vehicle = GetPlayerVehicleID(playerid);
if(vehicle == AdminVehicle && !IsPlayerAdmin(playerid))
{
RemovePlayerFromVehicle(playerid);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0, ".");
SendClientMessage(playerid, 0xFFFFFFAA, "This is an admin vehicle, you can't drive it.");
}
return 1;
}

Reply
#4

OnPlayerStateChange.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)