SA-MP Forums Archive
error 029: invalid expression, assumed zero - 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: error 029: invalid expression, assumed zero (/showthread.php?tid=454817)



error 029: invalid expression, assumed zero - RandomDude - 30.07.2013

Код:
error 029: invalid expression, assumed zero
pawn Код:
}
        }
    }
    new newstring[128];
    format(newstring, sizeof(newstring), "Welcome Back {43C0F9}%s{FFFFFF}. Please Login (/"#LoginCommand")", PlayerName);
    else SendClientMessage(playerid, WHITE, newstring); //THIS LINE
    }
    return 1;
}



Re: error 029: invalid expression, assumed zero - Konstantinos - 30.07.2013

Well, the indentation is a bit bad and I'm not sure if:

- it's an extra bracket, after else.
- WHITE is defined incorrect.
- LoginCommand is defined incorrect.

Be sure, all of them are correct.


Re: error 029: invalid expression, assumed zero - rouzbeh - 30.07.2013

whats your means of (/"#LoginCommand") ?


Re: error 029: invalid expression, assumed zero - PrinceKumar - 30.07.2013

Use it
}else return SendClientMessage(playerid, WHITE,newstring);


Re: error 029: invalid expression, assumed zero - Konstantinos - 30.07.2013

Your mistake is the "else". You do not have an if statement above.


Re: error 029: invalid expression, assumed zero - RandomDude - 30.07.2013

Yes I know my mistake is else
But I need that else there -_-


Re: error 029: invalid expression, assumed zero - Konstantinos - 30.07.2013

Quote:
Originally Posted by RandomDude
Посмотреть сообщение
Yes I know my mistake is else
But I need that else there -_-
May I ask, why do you need it there when it's incorrect?


Re: error 029: invalid expression, assumed zero - RandomDude - 30.07.2013

I need it because if the player is registerd and not logged in it will send the player that message but if I don't add else it will send the player the message if logged in or not...


Re: error 029: invalid expression, assumed zero - Konstantinos - 30.07.2013

That's not how it should be.
pawn Код:
if(something)
{
    // blabla
}
else
{
    // blabla
}
Having only the "else" statement without the "if" above is not correct. Use it correctly (the brackets) or just check if the player is registered and not logged in, in an if statement instead of the else.


Re: error 029: invalid expression, assumed zero - RandomDude - 30.07.2013

This work
pawn Код:
else
        {
            if(AccInfo[playerid][pVip] > 0)
            {
                switch(AccInfo[playerid][pVip])
                {
                    case 1: AccType = "Silver";
                    case 2: AccType = "Gold";
                    case 3: AccType = "Premium";
                }
                format(string,sizeof(string),"|- You have been Automatically Logged in - Account Type: %s", AccType);
                SendClientMessage(playerid,0x00C896AA,string);
            }
            else
            {
                format(string,sizeof(string),"{FFFFFF}Logged in.");
                SendClientMessage(playerid,WHITE,string);
            }
        }
    }
    new newstring[128];
    format(newstring, sizeof(newstring),"Please Login (/"#LoginCommand")");
    SendClientMessage(playerid, WHITE, newstring);
    }
    return 1;
}