SA-MP Forums Archive
Little help about 1 error - 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: Little help about 1 error (/showthread.php?tid=486126)



Little help about 1 error - barts - 07.01.2014

PHP код:
CMD:togtips(playeridparams[])
{
        {
            
PlayerInfo[playerid][pTips] = 0;
            
SendClientMessage(playeridCOLOR_WHITE" You have toggled the tips {FF9900}off{FFFFFF}.");
        }
        else
        {
            
PlayerInfo[playerid][pTips] = 1;
            
SendClientMessage(playeridCOLOR_WHITE" You have toggled the tips {33AA33}on{FFFFFF}.");
        }
        return 
1;

PHP код:
error 029invalid expressionassumed zero 
error line:
PHP код:
else 



Re: Little help about 1 error - Lidor124 - 07.01.2014

Show us the line which has the error


Re: Little help about 1 error - barts - 07.01.2014

Else is the error line


Re: Little help about 1 error - newbie scripter - 07.01.2014

use a if statement to use else LOL

EG
pawn Код:
if(blah)
{
    // blah
}
else
{
    // ASD
}



Re: Little help about 1 error - AIped - 07.01.2014

yes use else this way;

pawn Код:
if(PlayerInfo[playerid][pTips] == 0)
{
    //your stuff
}
else
{
    //other stuff of yours
}



Re: Little help about 1 error - barts - 07.01.2014

Thanks


Re: Little help about 1 error - pekslaker - 07.01.2014

Make it look like this :
Код:
CMD:togtips(playerid, params[]) 
{ 
        if(PlayerInfo[playerid][pTips] == 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled the tips {FF9900}off{FFFFFF}."); 
        } 
        else 
        { 
            SendClientMessage(playerid, COLOR_WHITE, " You have toggled the tips {33AA33}on{FFFFFF}."); 
        } 
        return 1; 
}
That should work.


Re: Little help about 1 error - newbie scripter - 07.01.2014

It will work but doesn't change a thing. u need to set the variable to 1 eg
PlayerInfo[playerid][pTips] = 1;