Turn the Lights on
#1

Hi Guys

How i can turn the Lights on when i press the "H" Button. I have seen many Tutorials but i didnt understood the Tutorials. I'm a Beginner in Scripting. Can anyone tell me how i can script that?
Reply
#2

Haven't tested it, but normally it works:

pawn Код:
new lighton[MAX_PLAYERS];

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (GetPlayerVehicleSeat(playerid)==0)
    {
        if (newkeys & 2)
        {
            if(lighton[playerid] == 0)
            {
                new engine, alarm, doors, boot, objective;
                SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective)
                lighton[playerid] = 1;
                return 1;
            }
            else if(lighton[playerid] == 1)
            {
                new engine, alarm, doors, boot, objective;
                SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective)
                lighton[playerid] = 0;
                return 1;
            }
        }
        return 1;
    }

    return 1;
}
But look out! It does only work correctly in the night.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)