SA-MP Forums Archive
return 0/1; any difference? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: return 0/1; any difference? (/showthread.php?tid=123569)



return 0/1; any difference? - SiJ - 26.01.2010

Hey,
Is there any difference if I return 1 or return 0 at (let's say) callback OnPlayerPickupPickUp?
Like:
[pawn]
public OnPlayerPickUpPickup(playerid,pickupid)
{
if(pickupid == SomePickup)
{

}

if(pickupid == AnotherPickup)
{

}
return 0/1; (as well as here, at the very end of callback?)
}


Re: return 0/1; any difference? - kmzr - 26.01.2010

pawn Код:
if(pickupid == SomePickup)
{
// Depending on what code goes here, yes.
return 0/1; //does it makes any difference here, if I return 0 or return 1?)
}



Re: return 0/1; any difference? - bajskorv123 - 26.01.2010

Let's say OnPlayerCommandText
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid, pName, sizeof(pName));
  
  printf("Command: %s: %s" ,pName, cmdtext);// Prints for example: Command: [NWA]Hannes: /kickme
  return 0/1; //If you return 0, it will only print for commands in this script. If you return 1, it will print for all scripts that uses commands.
}



Re: return 0/1; any difference? - SiJ - 26.01.2010

Ok, but how about OnPlayerPickupPickUp?


Re: return 0/1; any difference? - bajskorv123 - 26.01.2010

Quote:
Originally Posted by SiJ
Ok, but how about OnPlayerPickupPickUp?
If we take this for example:
Код:
OnPlayerPickupPickup(playerid, pickupid)
{
  SetPlayerArmour(playerid, 100);
  GameTextForPlayer(playerid, "~b~~h~~h~You got armour!", 3000, 3);
  return 0/1;// Returning 0 Only gives armour for pickups in this script. Returning 1 gives armour for pickups in all scripts on server.
}



Re: return 0/1; any difference? - SiJ - 26.01.2010

Quote:
Originally Posted by [NWA
Hannes ]
Quote:
Originally Posted by SiJ
Ok, but how about OnPlayerPickupPickUp?
If we take this for example:
Код:
OnPlayerPickupPickup(playerid, pickupid)
{
  SetPlayerArmour(playerid, 100);
  GameTextForPlayer(playerid, "~b~~h~~h~You got armour!", 3000, 3);
  return 0/1;// Returning 0 Only gives armour for pickups in this script. Returning 1 gives armour for pickups in all scripts on server.
}
Ok, thanks