- 0
Iterators vs foreach
-
Similar Content
-
- 6 answers
- 512 views
-
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
TheGodfather
Salut, care este mai ok pentru urmatorul scenariu. Pentru a afisa numele liderilor online, unul sub altul pentru un jucator care scrie o comanda oarecare.
Iteratorul: Iterator:PlayerLeaders<MAX_PLAYERS> urmat la o comanda oarecare foreach(new i : PlayerLeaders) SCMf(playerid, -1, "%s", GetName(i));
foreach: foreach(new i : Player) if(PlayerInfo[i][pLeader] != 0) SCMf(playerid, -1, "%s", GetName(i));
EDIT: Sa luam si alt caz, tot cel cu liderii doar sa zicem ca trebuie sa facem un array in care pentru fiecare jucator care are lider avem o variabila definita Leaders[MAX_PLAYERS] iar la logare daca e lider, jucatorul are Leaders[playerid] = 1.
Edited by TheGodfather2 answers to this question
Recommended Posts