Lights command issue
#1

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?
Reply
#2

Edited the topic please re-read... edited my command...
Reply
#3

1 Hour Bump
Reply
#4

Another bump
Reply
#5

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.
Reply
#6

@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...
Reply
#7

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;
}
Reply
#8

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.
Reply
#9

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.
Reply
#10

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)