How comes this command dont work
#1

I have been trying to make a command so when your in your own car and type /carlights the lights with come on and when you do it again they will turn off but when i type it nothing happens but when it says they are on and i get out the car, they turn on and when i get back in they turn off

Help is appreciated

If you need more code just ask

pawn Код:
command(carlights, playerid, params[])
{
    #pragma unused params
    new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
    if(IsPlayerInVehicle(playerid, Player[playerid][CarLinkID]))
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(LightsOn[Player[playerid][CarLinkID]] == 0)
            {
                GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                LightsOn[Player[playerid][CarLinkID]] = 1;
                SetVehicleParamsEx(Player[playerid][CarLinkID], engine, 1, alarm, doors, bonnet, boot, 0);
                format(string, sizeof(string), "%s has clicked a button to turn on their car lights", GetNameNoUnderScore(playerid));
                SendClientMessage(playerid, PURPLE, string);
            }
            else
            {
                GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                LightsOn[Player[playerid][CarLinkID]] = 0;
                SetVehicleParamsEx(Player[playerid][CarLinkID], engine, 0, alarm, doors, bonnet, boot, objective);
                format(string, sizeof(string), "%s has clicked a button to turn on their car lights", GetNameNoUnderScore(playerid));
                SendClientMessage(playerid, PURPLE, string);
            }
        }
    }
    if(IsPlayerInVehicle(playerid, Player[playerid][Car2LinkID]))
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(LightsOn[Player[playerid][Car2LinkID]] == 0)
            {
                GetVehicleParamsEx(Player[playerid][Car2LinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                LightsOn[Player[playerid][Car2LinkID]] = 1;
                SetVehicleParamsEx(Player[playerid][Car2LinkID], engine, 1, alarm, doors, bonnet, boot, 0);
                format(string, sizeof(string), "%s has clicked a button to turn on their car lights", GetNameNoUnderScore(playerid));
                SendClientMessage(playerid, PURPLE, string);
            }
            else
            {
                GetVehicleParamsEx(Player[playerid][Car2LinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                LightsOn[Player[playerid][Car2LinkID]] = 0;
                SetVehicleParamsEx(Player[playerid][Car2LinkID], engine, 0, alarm, doors, bonnet, boot, objective);
                format(string, sizeof(string), "%s has clicked a button to turn on their car lights", GetNameNoUnderScore(playerid));
                SendClientMessage(playerid, PURPLE, string);
            }
        }
    }
    if(IsPlayerInVehicle(playerid, Player[playerid][Car3LinkID]))
    {
        if(GetPlayerState(playerid) == 2)
        {
            if(LightsOn[Player[playerid][Car3LinkID]] == 0)
            {
                GetVehicleParamsEx(Player[playerid][Car3LinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                LightsOn[Player[playerid][Car3LinkID]] = 1;
                SetVehicleParamsEx(Player[playerid][Car3LinkID], engine, 1, alarm, doors, bonnet, boot, 0);
                format(string, sizeof(string), "%s has clicked a button to turn on their car lights", GetNameNoUnderScore(playerid));
                SendClientMessage(playerid, PURPLE, string);
            }
            else
            {
                GetVehicleParamsEx(Player[playerid][Car3LinkID], engine, lights, alarm, doors, bonnet, boot, objective);
                LightsOn[Player[playerid][Car3LinkID]] = 0;
                SetVehicleParamsEx(Player[playerid][Car3LinkID], engine, 0, alarm, doors, bonnet, boot, objective);
                format(string, sizeof(string), "%s has clicked a button to turn on their car lights", GetNameNoUnderScore(playerid));
                SendClientMessage(playerid, PURPLE, string);
            }
        }
    }
}
Help is appreciated
Reply
#2

Updated the problem with the whole command
Reply
#3

do u have any warnings or errors?
Reply
#4

Quote:
Originally Posted by BEER-samp
Посмотреть сообщение
do u have any warnings or errors?
No but when i turn my lights on and get out the car the car lights turn on... and then i get back in they turn off

Help is appreciated
Reply
#5

Help is appreciated
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)