[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
#2

http://forum.sa-mp.com/index.php?topic=12197.0
Reply
#3

Quote:
Originally Posted by paytas
Thanks now both here and there.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)