SA-MP Forums Archive
[HELP] 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: [HELP] removePlayerFromVehicle (/showthread.php?tid=211483)



[HELP] removePlayerFromVehicle - yarrum3 - 15.01.2011

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.


Re: [HELP] removePlayerFromVehicle - Toreno - 15.01.2011

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;
}



Re: [HELP] removePlayerFromVehicle - Alexy_Dramon - 10.03.2012

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;
}




Re: [HELP] removePlayerFromVehicle - Rac3r - 10.03.2012

OnPlayerStateChange.