General player vehicle
#1

Hello there, I'm working on fixing a vehicle system that makes sure that only players who have the keys can enter, and those you give out the key. So in order to do that, I've already made a small code.

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
        new id = GetVehicleID(vehicleid);
		if(GetPlayerVehicleAccess(playerid, id) < 1)
        {
            ClearAnimations(playerid);
            return 1;
        }
        return 1;
    }
The problem is that this code does what I want, it makes sure no one can enter - unless they are allowed to. But sadly I was only meant to make sure they couldn't enter the drivers seat. So they should be able to press G and enter, but not steal/enter the vehicle itself without being having the keys. How would I that?
Reply
#2

Try this;
pawn Код:
public OnPlayerEnterVehicle( playerid, vehicleid, ispassenger )
{
    if( GetPlayerVehicleAccess( playerid, vehicleid ) < 1 && !ispassenger )
    {
        ClearAnimations(playerid);

        return 1;
    }

    return 1;
}
Reply
#3

I'm going to try it

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)