18.11.2012, 18:30
There are a lot of spammers that come in and just spam.... Is there a command that clears the chat so it doesn't get flooded
Please write the code below
Thanks
Please write the code below
Thanks
CMD:clearchat ( playerid , params [] )
{
for ( new i = 0 ; i < 50 ; i ++ )
SendClientMessageToAll ( green , " " ) ;
return 1 ;
}
C:\Documents and Settings\hidden_user\My Documents\GTA SA Server\gamemodes\cnr.pwn(1465) : warning 203: symbol is never used: "clearchat" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Warning.
|
for(new i = 0; i < 50; i++) SendClientMessageToAll(COLOR_WHITE," "); return 1; |
if(strcmp(cmd, "/cc", true) == 0) // By Cavetchi
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 1)
{
SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command.");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
ClearChatbox(i, 100);
SendClientMessageToAll(COLOR_LIGHTBLUE, "Chat has been Cleared!");
format(string, sizeof(string), "[ADMIN]: %s has Cleared the Chat", sendername);
ABroadCast(COLOR_LIGHTRED,string, 5);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s Has Cleared the Chat",d,m,y,h,mi,s,sendername);
ChatLog(string);
AdminLog(string);
}
return 1;
}
YCMD:cc(playerid, params[], help)
{
#pragma unused params, help
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
{
ClearChatboxToAll(playerid,100);
GameTextForAll("Chat cleared!", 1000,1);
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "Admin %s has cleared the chat.",sendername);
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You do not have permission to use that command!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You Must be logged in to use this command!");
}
}
Change the admin variable with yours...
if (strcmp(cmdtext,"/clearchat", true , 10) == 0)//--- only use if neccesery
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"You need to be Rcon To Use This Command!");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
SendClientMessageToAll(yellow," ");
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"Admin %s Has now Cleared the chat!",pName);
SendClientMessageToAll(yellow,string);
return 1;
}
for(new i = 0; i < 50; i++) SendClientMessageToAll(COLOR_WHITE," "); return 1;