SA-MP Forums Archive
How comes this command dont work - 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: How comes this command dont work (/showthread.php?tid=347561)



How comes this command dont work - Geniuss - 02.06.2012

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


Re: How comes this command dont work - Geniuss - 02.06.2012

Updated the problem with the whole command


Re: How comes this command dont work - mickos - 02.06.2012

do u have any warnings or errors?


Re: How comes this command dont work - Geniuss - 02.06.2012

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


Re: How comes this command dont work - Geniuss - 02.06.2012

Help is appreciated