difference between....
#1

Quote:

if(IsPlayerConnected(playerid)) GivePlayerMoney(playerid,100);

and

Quote:

if(IsPlayerConnected(playerid))
{
GivePlayerMoney(playerid,100);
}

whats the difference??
Reply
#2

First one wont work the other one will

The
Код:
{
after the
Код:
if(IsPlayerConnected(playerid))
Tells the if statement what to do... So without it, you get nothing.
Reply
#3

stock IsPlayerAdminLevel(playerid, level)
{

new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
new file[256], tmp, tmp2;

format(file,256,"/ladmin/users/%s.sav",udb_encode(name));
tmp = dini_Int(file,"level");
tmp2 = dini_Int(file,"loggedin");

if( (IsPlayerConnected(playerid)) && (tmp >= level) && (tmp2 != 0) )
return true;
else return false;


}

this function is from ladmin and see the line bold
it doesn't have "{","}" and works well
Reply
#4

Wow no idea... Maybe I got it all wrong...
Reply
#5

Quote:
Originally Posted by Tommy_Mandaz
Посмотреть сообщение
Wow no idea... Maybe I got it all wrong...
Yes, indeed you did.

Parenthesis are meant to be used when you have more than one instruction after a conditional statement.

The example in bold works fine because there is only one instruction, either return true or false.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)