SA-MP Forums Archive
/lights won't work properly - 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: /lights won't work properly (/showthread.php?tid=346236)



/lights won't work properly - Makaveli93 - 27.05.2012

My /lights command is bugged. When ever I type /lights, the lights remain the same, they don't turn on, but the gametext is showed correctly. Also, if my lights are set to "on" and I exit my car, the lights turn on. When I enter it again, the lights turn off. Can anyone help me out please?

This is my /lights command
pawn Код:
if(!strcmp(cmd, "/lights", true))
    {
        if(GetPlayerState(playerid) == 2)
        {
            new vid = GetPlayerVehicleID(playerid);
            new engine = 0, light = 0, alarm = 0, doors = 0, bonnet = 0, boot = 0, objective = 0;
            GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
            if(!light)
            {
                GameTextForPlayer(playerid, "~w~Lights ~g~On", 2000, 4);
                SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);
            }
            else
            {
                GameTextForPlayer(playerid, "~w~Lights ~r~Off", 2000, 4);
                SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "[ERROR:] You are not in a vehicle as a driver.");
        }
        return 1;
    }



Re: /lights won't work properly - Makaveli93 - 28.05.2012

Bump, still bugged. I need help on this one please :/

EDIT: I recoded it and still the same thing is happening

pawn Код:
if(strcmp(cmd, "/lights", true) == 0)
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vid = GetPlayerVehicleID(playerid);
            new engine = 0, light = 0, alarm = 0, doors = 0, bonnet = 0, boot = 0, objective = 0;
            GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
            if(light == 0)
            {
                GameTextForPlayer(playerid, "~w~Lights ~g~On", 2000, 4);
                SetVehicleParamsEx(vid, engine, 1, alarm, doors, bonnet, boot, objective);
                return 1;
            }
            else
            {
                GameTextForPlayer(playerid, "~w~Lights ~r~Off", 2000, 4);
                SetVehicleParamsEx(vid, engine, 0, alarm, doors, bonnet, boot, objective);
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "[ERROR:] You are not in a vehicle as a driver.");
        }
        return 1;
    }



Re: /lights won't work properly - Karl[NDZ] - 29.05.2012

With won't work you mean the lights won't turn on or off right?
Use zcmd it's easier to use