SA-MP Forums Archive
It is possible to detect if a player is trying to enter... - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: It is possible to detect if a player is trying to enter... (/showthread.php?tid=268817)



It is possible to detect if a player is trying to enter... - CTCCoco - 13.07.2011

It is possible to detect if a player is trying to enter in a vehicle when the doors are locked?


Thanks!


Re: It is possible to detect if a player is trying to enter... - BigETI - 13.07.2011

What's about to use
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
?


Re: It is possible to detect if a player is trying to enter... - Cameltoe - 13.07.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
     if(IsVehicleLocked[playerid] == true) return OnPlayerEnterLockedVehicle(playerid, vehicleid);
}

forward OnPlayerEnterLockedVehicle(playerid, vehicleid);

public OnPlayerEnterLockedVehicle(playerid, vehicleid)
{
     return 1;
}



Re: It is possible to detect if a player is trying to enter... - Pooh7 - 13.07.2011

There's no function to detect if vehicle is locked.

You can to make new variable and change value after vehicle lock.
Example:

pawn Код:
new locked[MAX_VEHICLES];

stock LockVehicle(vehicleid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, boot, objective);
    locked[vehicleid] = 1;
    return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(locked[vehicleid] == 1)
    {
        //your code
    }
    return 1;
}



Respuesta: Re: It is possible to detect if a player is trying to enter... - CTCCoco - 13.07.2011

Lol, sorry, I confused OnPlayerStateChange with OnPlayerEnterVehicle , my fault.

Thanks for help.