SA-MP Forums Archive
General player 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: General player vehicle (/showthread.php?tid=320411)



General player vehicle - ChristofferHoffmann - 22.02.2012

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?


Re: General player vehicle - Toreno - 22.02.2012

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

        return 1;
    }

    return 1;
}



Re : General player vehicle - ChristofferHoffmann - 23.02.2012

I'm going to try it

Thanks