27.07.2015, 22:10
Quote:
Returning a value is usually optional (though it will usually give a warning), though it can be useful and or needed in some situations. When simply responding to a callback typically returning 1 would be practical unless the callback does different things(such as a OnTakeDamage function not giving damage if 0 is returned) when other things are returned.
Though for functions returns can sometimes be useful & or needed. For example: pawn Code:
Also 1/0 aren't the only values you can return. You can return strings, and other integer values as well. NOTE: Due to an issue with the compiler directly returning a string will crash the compiler(e.g: return "yes". This works in old compiler versions and also if you're using Zeex's compiler patches(I believe). |
Code:
if(listitem == 0) { if(PlayerData[playerid][pLocateCar] == 1) { format(szMessage,sizeof szMessage,"Your car (Model: %s) has been respawned!",VehicleNames[PlayerData[playerid][pCarModel1]-400]); SendClientMessage(playerid,COLOR_WHITE,szMessage); return 1; } }