[HELP] Restricting command to several teams
#4

If you end up with a bunch of instances of this in your script:

if(gTeam[playerid] == TEAM_ARMY && gTeam[playerid] == TEAM_FBI && gTeam[playerid] == TEAM_SWAT)


You can combine them into one definition:

Код:
IsACop(playerid)
{
   if(gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_FBI || gTeam[playerid] == TEAM_SWAT) //check if the player is law enforcement
   {
      return 1;
   }
   return 0;
}
Because if(IsACop(playerid)) is alot more manageable and you can easily go back and edit the definition without retracing your steps 20 times throughout the script.
Reply


Messages In This Thread
[HELP] Restricting command to several teams - by Galcio - 19.12.2009, 13:58
Re: [HELP] Restricting command to several teams - by Flo_White - 19.12.2009, 14:05
Re: [HELP] Restricting command to several teams - by Galcio - 19.12.2009, 14:28
Re: [HELP] Restricting command to several teams - by Damon_Black - 19.12.2009, 15:20

Forum Jump:


Users browsing this thread: 1 Guest(s)