SA-MP Forums Archive
Lights command issue - 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 command issue (/showthread.php?tid=387834)



Lights command issue - Swyft™ - 26.10.2012

Well I am experiencing some issues with my /lights command, here it is

pawn Код:
CMD:lights(playerid, params[]) {
    new vehicleid = GetPlayerVehicleID(playerid);
    new engine, lights, alarm, doors, bonnet, boot, objective;

    if(GetPlayerState(playerid) == 2)
    {
        if(playerVariables[playerid][pCarLights] == 1) return SendClientMessage(playerid, COLOR_RED,"ERROR: The vehicle's hood is already opened!");
        if(IsPlayerInAnyVehicle(playerid)) {
            switch(playerVariables[playerid][pCarLights]) {
                case 0: {
                    playerVariables[playerid][pCarLights] = 1;
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                    SetVehicleParamsEx(vehicleid,engine,true,alarm,doors,bonnet,boot,objective);
                    format(szMessage, sizeof(szMessage), "* %s has pushed a button on his steering wheel, turning on their headlights.", szPlayerName);
                    nearByMessage(playerid, COLOR_PURPLE, szMessage);
                }
                default: {
                    playerVariables[playerid][pCarLights] = 0;
                    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);//this will check that what is the state of engine.That is is on or off.We can use it for multiple things like doors,alarms etc.But In this case I am using this for the engine only.
                    SetVehicleParamsEx(vehicleid,engine,false,alarm,doors,bonnet,boot,objective);
                    format(szMessage, sizeof(szMessage), "* %s has pushed a button on his steering wheel, turning off their headlights.", szPlayerName);
                    nearByMessage(playerid, COLOR_PURPLE, szMessage);
                }
            }
        }
    }
    return 1;
}
This command works for any other type of part... I have /hood, /trunk, /engine and etc and it works fine but not lights. Any ideas?


Re: Lights command issue - Swyft™ - 26.10.2012

Edited the topic please re-read... edited my command...


Re: Lights command issue - Swyft™ - 26.10.2012

1 Hour Bump


Re: Lights command issue - Swyft™ - 26.10.2012

Another bump


Re: Lights command issue - gtakillerIV - 26.10.2012

What happens does it say SERVER: UNKOWN COMMAND? Or what happens?

And stop bumping alot, you can only bump after 48 hours if the last reply was yours.


Re: Lights command issue - Swyft™ - 26.10.2012

@GtaKillerIV
Nothing happens, I have it say the message. but the lights just don't turn on you know

and also, I thought it was 1 hour...


Re: Lights command issue - Catalyst- - 26.10.2012

This should work:
pawn Код:
CMD:lights(playerid, params[])
{
    if(GetPlayerState(playerid) == 2) {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(IsPlayerInAnyVehicle(playerid)) {
            if(lights) {
                playerVariables[playerid][pCarLights] = 1;
                SetVehicleParamsEx(vehicleid ,engine, 0, alarm, doors, bonnet, boot, objective);
                format(szMessage, sizeof(szMessage), "* %s has pushed a button on his steering wheel, turning on their headlights.", szPlayerName);
                nearByMessage(playerid, COLOR_PURPLE, szMessage);
            }
            else {
                playerVariables[playerid][pCarLights] = 0;
                SetVehicleParamsEx(vehicleid, engine, 1, alarm, doors, bonnet, boot, objective);
                format(szMessage, sizeof(szMessage), "* %s has pushed a button on his steering wheel, turning off their headlights.", szPlayerName);
                nearByMessage(playerid, COLOR_PURPLE, szMessage);
            }
        }
    }
    return 1;
}



Re: Lights command issue - Swyft™ - 26.10.2012

Thanks but unfortuantly it didn't work...

I'm thinking it has to do with the objective, but I have no idea what it does.


Re: Lights command issue - gtakillerIV - 26.10.2012

Using "0" is the same as using "false" same goes for "1", it's the same as "true". And I don't see anything wrong with your command Rocking. It should work.


Re: Lights command issue - Catalyst- - 26.10.2012

Quote:
Originally Posted by RockingCamman
Посмотреть сообщение
Thanks but unfortuantly it didn't work...
I'm not sure why, I tested it before I posted, and it worked fine.
The only problem it had was that they didn't come on the first time...