It is possible to detect if a player is trying to enter...
#1

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


Thanks!
Reply
#2

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

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

forward OnPlayerEnterLockedVehicle(playerid, vehicleid);

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

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;
}
Reply
#5

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

Thanks for help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)