[HELP] Cars
#1

When I put this script on my gamemode I can drive any vehicle. Also the Factions cars. For example I am a COP but can to drive the YAKUZA cars. Why?

pawn Код:
if (newkeys & KEY_YES)
    {
        if(GetPlayerState(playerid) == 2)
        {
            new vehicle = GetPlayerVehicleID(playerid); //This part here is defining the vehicle ID that the player is currently in.
            new engine, lights, alarm, doors, bonnet, boot, objective; //This is defining the vehicles current items.
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);//This is checking the vehicle's engine/lights/alarm/doors/bonnet/boot/objective status.
            if(Lights[vehicle] == 0) //This is checking if the engine of the vehicle, is turned off or not.
            {
                Lights[vehicle] = 1; //This is setting the global variable that you created at the beginning.
                SetVehicleParamsEx(vehicle, engine, 1, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
                GameTextForPlayer(playerid, "~g~LIGHTS ON...", 1000, 6);
            }
            else
            {
                Lights[vehicle] = 0; //This is setting the global variable that you created at the beginning.
                SetVehicleParamsEx(vehicle, engine, 0, alarm, doors, bonnet, boot, 0); //This is setting the vehicles engine to be on.
                GameTextForPlayer(playerid, "~r~LIGHTS OFF...", 1000, 6);
            }
        }
    }
Reply
#2

There is only the code that says: "If you press y and you are driver the engine turns on".
There is no code that decides if a player is allowed to start the engine or not.

By the way: your [/pwn]-tag is little bit miss typed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)