Explain returns
#2

Returns are used at the end of a piece of code to return whether or not the executed coding was successful or not, you can use this to cut code short such as checking if someone's an admin in a command or many other things. This means when the command is calledm, if a return is used, the command will return that value and then stop and will not perform the rest of the code in that section.

pawn Код:
CMD:test(playerid, params[])
{
     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not an admin");
    //rest of code which will not be executed if player is not an admin
}
Reply


Messages In This Thread
Explain returns - by Moron - 28.11.2012, 11:38
Re: Explain returns - by CentyPoo - 28.11.2012, 12:14
Re: Explain returns - by Ballu Miaa - 28.11.2012, 12:18
Re: Explain returns - by Moron - 01.12.2012, 16:18
Re: Explain returns - by Ballu Miaa - 02.12.2012, 06:13

Forum Jump:


Users browsing this thread: 1 Guest(s)