06.05.2011, 02:25
Hi is there anyway of making a command /clearchat that would clear out the chat, like move the messages up?
// === [Clearchat] ===
if(strcmp(cmdtext, "/clearchat", true) == 0)
{
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
GameTextForAll("Chat cleared!", 1000,1);
return 1;
}
COMMAND:clearchat(playerid) {
new
name1[30],
text[128];
if(PlayerInfo[playerid][pAdminLevel] >= 3) {
for(new i = 0; i < 100; i++) {
SendClientMessageToAll(COLOR_WHITE," ");
}
GetPlayerName(playerid,name1,sizeof(name1));
format(text,sizeof(text),"Administrator \"%s\" has cleared the chat.",name1);
SendClientMessageToAll(medblue,text);
SaveIn("clearchat",text);
} else {
return SendClientMessage(playerid,red,"Only lvl3 or higher admins can use this command.");
}
return 1;
}
I use a loop, instead of much SendClientMessage-s.
pawn Код:
|
CMD:clearchat( playerid, params[ ] ) {
for( new i = 0; i < 50; i++ ) SendClientMessageToAll( -1, " " );
return 1;
}
COMMAND:clearchat(playerid) {
if(IsPlayerAdmin(playerid) {
for(new i = 0; i < 100; i++) SendClientMessageToAll(-1, " " );
} else {
return SendClientMessage(playerid,red,"ERROR: This command is only avaible for admins.");
}
return 1;
}