17.04.2014, 09:35
If you used a switch, you must use "case" statements instead of if/else.
Keep in mind that you're not forced to use brackets for cases, but if you don't, you can only proceed ONE instruction. It's the same as "if" statements.
This code is right, but this one isn't :
Modify the code below replacing "if" and "else" by "case".
Keep in mind that you're not forced to use brackets for cases, but if you don't, you can only proceed ONE instruction. It's the same as "if" statements.
PHP код:
new bool:var;
if(var) SendClientMessage(playerid, -1, "var is true");
else SendClientMessage(playerid, -1, "var is false");
PHP код:
new var = 188964;
if(var != 188946) var = 188964; GivePlayerMoney(playerid, var); return 1;
else var = 0; return Kick(playerid);
// The correct code would be
new var = 188964;
if(var != 188964)
{
var = 188964;
GivePlayerMoney(playerid, var);
return 1;
}
else
{
var = 0;
return Kick(playerid);
}