Members command problem
#8

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
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); 
            } 
        }
That code, is simply going through the player list and making output. It doesn't sort it.

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.
Actually I was too sleepy and didn't notice he doesn't have a check to see if leader is online, in theory it does exactly what he said, which is show leader first
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 ?
Reply


Messages In This Thread
Members command problem - by bigboy81 - 30.09.2015, 16:33
Re: Members command problem - by jihadmeneer - 30.09.2015, 20:55
Re: Members command problem - by bigboy81 - 30.09.2015, 22:20
Re: Members command problem - by PrO.GameR - 30.09.2015, 22:34
Re: Members command problem - by bigboy81 - 30.09.2015, 23:31
Re: Members command problem - by Sew_Sumi - 01.10.2015, 00:44
Re: Members command problem - by MD5 - 01.10.2015, 01:11
Re: Members command problem - by PrO.GameR - 01.10.2015, 09:16
Re: Members command problem - by bigboy81 - 01.10.2015, 11:01
Re: Members command problem - by Sew_Sumi - 01.10.2015, 15:24

Forum Jump:


Users browsing this thread: 2 Guest(s)