01.10.2015, 09:16
Quote:
Stop expecting someone to do it for you, and copying and pasting answers.
You need to change the order in which you are doing the checks, or the way you are doing the check. If the Leader will be offline, then that should be stored somewhere so it can be displayed. Код:
if ((PlayerInfo[i][pMember] == teamnumber) && IsPlayerConnected(i)) { format(stringer, sizeof(stringer), ""); countmute++; if (PlayerInfo[i][pLeader] == teamnumber&&findleader==0) { format(stringer, sizeof(stringer), "[%d] %s ранг: Лидер {FFFFFF}", i, NamePlayer[i]); findleader++; i=0; } else if (PlayerInfo[i][pMember] == teamnumber&&findleader!=0) { format(stringer, sizeof(stringer), "[%d] %s ранг: %d {FFFFFF}", i, NamePlayer[i], PlayerInfo[i][pRank]); } if (strlen(stringer) > 1) { SendClientMessage(playerid, 0xC0E1EEFF, stringer); } } If you were the first player on, and you were the leader, and a member joined, it'll display fine. In this case, the member joined, then the leader joined. so it looks wrong. Again though, stop expecting copy/paste answers... That's not what this section is for. As for those who are pasting... Stop it... It teaches them NOTHING. |
and btw storing players then sorting them is CPU efficient, I like to do the loop twice, it's ram efficient and it's a matter of personal preference, I don't have experience in foreach, but in a simple for I would simply check on the i=MAX_PLAYERS to see if findleader==0, if it was =0 I would make i=0 again and findleader=1, and tada, problem is fixed.
You can't expect someone to magically learn something unless you either fix their problem this time, or give them a different working example that they can follow, or babble for an hour for them to learn. Whichever you choose thats your choice, and I simply got mine alright ? so instead of crying in every topic, be helpful, either make a well explained answer for them to learn, write a new code for them to follow or just don't answer to that topic alright ?