[Snippet]Easy loop(macro)
#1

Hi all, this is a snippet for easy loop.
Код:
#define looper(%1,%2,%3,%4) \
for(new %1 = (%2);(%1)<(%3);%1++) if(%4)
Example:
Код:
looper(i,0,MAX_PLAYERS,(IsPlayerConnected(i))){
  SendClientMessage(playerid,422,"hello world");
}
Same as
Код:
for(new i = 0;i < MAX_PLAYERS;i++){
  if(IsPlayerConnected(i)){
      SendClientMessage(playerid,422,"hello world");
  }
}
Use looper is easier, and write less lines than for loop.
Any comment is everything~
Reply


Messages In This Thread
[Snippet]Easy loop(macro) - by yezizhu - 07.08.2009, 14:06
Re: [Snippet]Easy loop(macro) - by paytas - 07.08.2009, 14:08
Re: [Snippet]Easy loop(macro) - by yezizhu - 07.08.2009, 14:15

Forum Jump:


Users browsing this thread: 1 Guest(s)