18.12.2015, 12:09
I have re-coded the way you clear the chat, The chat is only cleared out for players [not Admins].
Note; I am not sure if you are using foreach, So i have used a standard player looping on this code, This is a bad method. Use foreach.
Note; I am not sure if you are using foreach, So i have used a standard player looping on this code, This is a bad method. Use foreach.
PHP код:
COMMAND:clearchat(playerid, params[])
{
if(playerData[playerid][playerLoggedIn])
{
if(playerData[playerid][playerLevel] >= 3)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(playerData[i][playerLevel] == 0)
{
for(new x = 0; x < 50; x++)
{
SendClientMessage(i, COLOR_WHITE," ");
}
}
}
}
SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has cleared the chat.");
new log[250];
format(log, sizeof(log), "%s(%i) cleared the chat", playerData[playerid][tempAdminName], playerid);
SendAdminText(playerid, log);
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "{B7B7B7}[SERVER] {FFFFFF}You must be logged in to use commands.");
}
return 1;
}