Really annoying and strange!
#1

So here is my code.

pawn Код:
for ( new i = 0; i < MAX_PLAYERS; i++ )
                    {
                        if ( IsPlayerConnected( i ) )
                        {
                            if ( P_DATA[ i ][ Level ] > 0 ){
                                new
                                    iStr[ 160 ];
                                format( iStr, sizeof (iStr), "[ADMIN CHAT] "GREY"%s:"W" %s", Name( playerid ), text[ 1 ] );
                                SendClientMessage( i, 0xFF0000FF, iStr );
                                print(iStr);
                                return 0;
                            }
                        }
                    }
The thing is, no-one can see the text! neither I neither nobody on the server.
Sometimes it works, sometimes it doesn't, sometimes works like : I can see the text sent, but others don't, or they can see it but i don't...

I tried even foreach, same result, any deas?

This problem is really stupid...
Reply
#2

pawn Код:
if(text[0] == '#' && PlayerInfo[playerid][pAdminLevel] >= 1) {
        new
            poster[30];
        for(new i = 0; i < MAX_PLAYERS; ++i) {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && PlayerInfo[i][pAdminLevel] >= 1) {
                new string[128];
                GetPlayerName(playerid,poster,sizeof(poster));
                format(string,sizeof(string),"[AdminChat] | %s: %s",poster,text[1]);
                SendClientMessage(i,yellow,string);
            }
        }
        return 0;
    }
I use this, works like a charm.
I don't see the prob in the code :\
Reply
#3

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
pawn Код:
if(text[0] == '#' && PlayerInfo[playerid][pAdminLevel] >= 1) {
        new
            poster[30];
        for(new i = 0; i < MAX_PLAYERS; ++i) {
            if(IsPlayerConnected(i) && !IsPlayerNPC(i) && PlayerInfo[i][pAdminLevel] >= 1) {
                new string[128];
                GetPlayerName(playerid,poster,sizeof(poster));
                format(string,sizeof(string),"[AdminChat] | %s: %s",poster,text[1]);
                SendClientMessage(i,yellow,string);
            }
        }
        return 0;
    }
I use this, works like a charm.
I don't see the prob in the code :\
Dude, don't come up with code, I know how to do a stupid admin chat using a symbol.
Like I said, the code looks PERFECT! That's why i asked for help since by even looking at it you would say, 100% works! But something else is in the middle...
Reply
#4

lol then same without the first and the last (and "return 0;") lines xD
Reply
#5

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
lol then same without the first and the last (and "return 0;") lines xD
I would like to say sorry for "screaming" at you.
I know where the problem is now, it was inside the loop as it returns 0 so it means LOOP STOPS to work.
Works now, thanks, without this and your "stupid" reply I wouldn't see that!
Reply
#6

Try


pawn Код:
for ( new i = 0; i < MAX_PLAYERS; ++i )
                    {
                        if ( IsPlayerConnected( i ) )
                        {
                            if ( P_DATA[ i ][ Level ] > 0 ){
                                new
                                    iStr[ 160 ];
                                format( iStr, sizeof (iStr), "[ADMIN CHAT] "GREY"%s:"W" %s", Name( playerid ), text[ 1 ] );
                                SendClientMessage( i, 0xFF0000FF, iStr );
                                SendClientMessage( playerid, 0xFF0000FF, iStr );
                                print(iStr);
                                return 0;
                            }
                        }
                    }
Reply
#7

It's solved already. The "return 0;" can't be in the loop..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)