14.08.2012, 16:43
return means to return a value in a function or w/e
like the following example:
it also means to stop continuing from reading the other part of the script.
like the following
like the following example:
pawn Код:
new playernub;
public OnPlayerConnect(playerid)
{
playernub = GetPlayerNub(playerid); // GetPlayerNub will now return rand (0 or 1 , according to the random function)
printf("GetPlayerNub function on playerid %i result is: %i", playerid, playernub);
return 1;
}
stock GetPlayerNub(playerid)
{
new rand = random(1);
return rand; // will return 1 or 0 (according to the random function)
}
like the following
pawn Код:
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) return 1; // checks if the player that connected is an NPC, the script will stop reading OnPlayerConnect.
ShowPlayerLogin(playerid, login, blablabl);
return 1;
}