Really annoying and strange! -
Zh3r0 - 03.05.2011
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...
Re: Really annoying and strange! -
Seven_of_Nine - 03.05.2011
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 :\
Re: Really annoying and strange! -
Zh3r0 - 03.05.2011
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...
Re: Really annoying and strange! -
Seven_of_Nine - 03.05.2011
lol then same without the first and the last (and "return 0;") lines xD
Re: Really annoying and strange! -
Zh3r0 - 03.05.2011
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!
Re: Really annoying and strange! -
Ricop522 - 03.05.2011
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;
}
}
}
Re: Really annoying and strange! -
Seven_of_Nine - 03.05.2011
It's solved already. The "return 0;" can't be in the loop..