28.12.2012, 09:17
Basically, you can think of it this way, 1 = success/true, 0 = failed/false
Examples:
I don't know of any existing tutorials about returning values, based around 0 and 1, but keep searching if you need help with it. Or check out the SA-MP Wiki.
Examples:
pawn Код:
MyGateIsOpen = 1; //It is open
if(MyGateIsOpen == 1)
{
CloseGate;
MyGateIsOpen = 0; //It is now closed or false (without the use of booleans)
//...
pawn Код:
public OnPlayerSpawn(playerid)
{
return 1; //The player has spawned
}
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 12) return 0; //Do not spawn player, player spawned with class = false
return 1; //Else let them spawn by returning 1
}