SA-MP Forums Archive
[HELP]remove Player from vehicle - 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]remove Player from vehicle (/showthread.php?tid=386657)



[HELP]remove Player from vehicle - Wayn - 21.10.2012

Hi, i want help about this code, i want the vehicle to be available to drive only for the OWNER OF VEHICLE and None else can Enter and Drive it as a Driver.however they can enter as a Passenger.
PHP код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(!
ispassenger)
    {
        new 
id = GetVehicleID(vehicleid);
        if(
IsValidVehicle(id) && VehicleCreated[id] == VEHICLE_PLAYER)
        {
            new 
msg[128];
            
format(msg, sizeof(msg), "[ ! ] This vehicle belongs to %s", VehicleOwner[id]);
            
SendClientMessage(playerid, COLOR_GREY, msg);
        }
    }
    return 
1;
} 



Re: [HELP]remove Player from vehicle - JaKe Elite - 21.10.2012

Use OnPlayerStateChange instead of OnPlayerEnterVehicle.

PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
//code
} 



Re: [HELP]remove Player from vehicle - Wayn - 21.10.2012

please give me a complete code, put in the RemovePlayerFromVehicle as well...so the player gets removed from the vehicle as well.