SA-MP Forums Archive
What's worng here lol? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What's worng here lol? (/showthread.php?tid=255175)



What's worng here lol? - Cjgogo - 14.05.2011

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys == KEY_SUBMISSION) && IsPlayerInAnyVehicle(playerid))
    {
       ToggleEngine(playerid);
       SendClientMessage(playerid,COLOR_VIOLETBLUE,"The engine is turned on.");
       else // 388
       {
         SendClientMessage(playerid,COLOR_VIOLETBLUE,"The engine is turned off.");
       }
    }
    return 1;
}
The error is 388 invalid expression asumed 0 but I want to do so that if I press 1 again it turns the engine off ,but it says The engine is turned off and not on again


Re: What's worng here lol? - xir - 14.05.2011

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys == KEY_SUBMISSION) && IsPlayerInAnyVehicle(playerid))
    {
       ToggleEngine(playerid);
       SendClientMessage(playerid,COLOR_VIOLETBLUE,"The engine is turned on.");
    }
    else // 388
    {
        SendClientMessage(playerid,COLOR_VIOLETBLUE,"The engine is turned off.");
    }
    return 1;
}



Re: What's worng here lol? - Daddy Yankee - 14.05.2011

You need an if here, to detect if the engine is off. Something like

Код:
       
if(engineoff)
{
       ToggleEngine(playerid);
       SendClientMessage(playerid,COLOR_VIOLETBLUE,"The engine is turned on.");
}