16.08.2015, 18:51
Quote:
the problem is its spamming (gonna change color later)
PHP код:
PHP код:
|
pawn Код:
format(string,sizeof(string),"A.Chat: %s: %s",string,text[1]);
MessageToAdmins(0xFD01FDAA,string);
return 0;
}
return 1; // <<<<<<<<<<<<<<<
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++ )
SendClientMessage( i, 0x0, String );
pawn Код:
public OnPlayerText(playerid, text[])
{
return 0;
}
Quote:
if i put return false; in PHP код:
|
To fix this, You should always handle exceptions first, because admin chat (or something like this) is exception, whereas
pawn Код:
for( new i = 0; i < MAX_PLAYERS; i++ )
SendClientMessage( playerid, 0x0, String );
So, to make things working, Your code should look like this:
pawn Код:
//==============================================================================
#define Max_Client_Message_Len 128
public OnPlayerText(playerid, text[])
{
new String [ Max_Client_Message_Len + MAX_PLAYER_NAME + 16];
if( strlen(text) > Max_Client_Message_Len ) // Check for valid length
return 0;
new PlayerName[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, PlayerName, MAX_PLAYER_NAME );
if(text[0] == '.' && PlayerInfo[playerid][Level] >= 1) { // Is first character '.' and the second part of the statement is true
// if yes, then:
new string[128]; GetPlayerName(playerid,string,sizeof(string));
format(string,sizeof(string),"A.Chat: %s: %s",string,text[1]);
MessageToAdmins(0xFD01FDAA,string);
return 0; // Don't go any further
}
format( String, sizeof( String ), "{RRGGBB}%s (%d): {RRGGBB}%s", PlayerName, playerid, text );
for( new i = 0; i < MAX_PLAYERS; i++ )
SendClientMessage( i, 0x0, String );
return 0; // prevent double messages
}
Greetings
@ Edit
Quote:
Код:
for( new i = 0; i < MAX_PLAYERS; i++ ) SendClientMessage( playerid, 0x0, String ); Код:
SendClientMessageToAll(-1, String); |