Clearing Chat
#1

Hello,

I wan't a command what is RCON admin only which can clear the chat. 0.3e only please as i'm trying some and getting errors.


~Kyle_Magix
Reply
#2

Its not rcon but the command is something like this
Код:
CMD:clearchat(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
    
	for(new i=0; i<100; i++)
	{
	    SendClientMessageToAll(COLOR_WHITE, "");
	}
	format(string, sizeof(string), "Info: %s has cleared the chat window.", GetPlayerName(playerid));
	SendClientMessageToAll(COLOR_DARKRED, string);
	return 1;
}
Reply
#3

Download admin system, its better.Why u dont make command like /cc to clean chat, noone will know for that comand ofc if you dont put it in /cmds or wherever.
Reply
#4

pawn Код:
CMD:cc(playerid, params[])
{
    new string[128]; // This is the string what is lenght 128 letters
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "You are not authorized to use this command."); // This will check if you are rcon logged in

    for(new i=0; i<100; i++) // This will send a empty message 100 times to all players and it will clear the chat
    {
        SendClientMessageToAll(0xFFFFFFAA, "");
    }
    format(string, sizeof(string), "AdmWarning: %s has cleared the chat window.", GetPlayerName(playerid)); // This will show who cleared the chat
    SendClientMessageToAll(0xFFFF00AA, string); // This will send the message to all players
    return 1;
}
Hope I help you
Reply
#5

Quote:
Originally Posted by RenSoprano
Посмотреть сообщение
pawn Код:
CMD:cc(playerid, params[])
{
    new string[128]; // This is the string what is lenght 128 letters
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "You are not authorized to use this command."); // This will check if you are rcon logged in

    for(new i=0; i<100; i++) // This will send a empty message 100 times to all players and it will clear the chat
    {
        SendClientMessageToAll(0xFFFFFFAA, "");
    }
    format(string, sizeof(string), "AdmWarning: %s has cleared the chat window.", GetPlayerName(playerid)); // This will show who cleared the chat
    SendClientMessageToAll(0xFFFF00AA, string); // This will send the message to all players
    return 1;
}

Hope I help you
I put this in, And got some errors
pawn Код:
C:\Users\kyle\Desktop\Gates\Codes\Announcing.pwn(17) : error 029: invalid expression, assumed zero
C:\Users\kyle\Desktop\Gates\Codes\Announcing.pwn(17) : error 017: undefined symbol "cmd_cc"
C:\Users\kyle\Desktop\Gates\Codes\Announcing.pwn(17) : error 029: invalid expression, assumed zero
C:\Users\kyle\Desktop\Gates\Codes\Announcing.pwn(17) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#6

Do you use ZCMD? or Strcmp, dcmd, ycmd what command processor do you use
Reply
#7

Quote:
Originally Posted by RenSoprano
Посмотреть сообщение
Do you use ZCMD? or Strcmp, dcmd, ycmd what command processor do you use
it has #include <zcmd> at the top and sscanf2 so proberly zcmd? I know how some of it works.
Reply
#8

Quote:
Originally Posted by RenSoprano
Посмотреть сообщение
pawn Код:
CMD:cc(playerid, params[])
{
    new string[128]; // This is the string what is lenght 128 letters
    if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "You are not authorized to use this command."); // This will check if you are rcon logged in

    for(new i=0; i<100; i++) // This will send a empty message 100 times to all players and it will clear the chat
    {
        SendClientMessageToAll(0xFFFFFFAA, "");
    }
    format(string, sizeof(string), "AdmWarning: %s has cleared the chat window.", GetPlayerName(playerid)); // This will show who cleared the chat
    SendClientMessageToAll(0xFFFF00AA, string); // This will send the message to all players
    return 1;
}
That would not work for Rcon admin but normal players. Also I'm pretty sure 100 lines arent needed, 50 will do just fine. The GetPlayerName will also not work in the format. Correct code would be:
pawn Код:
CMD:cc(playerid, params[])
{
    new string[128], Name[25]; // This is the string what is lenght 128 letters, and a variable to store the name in
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "You are not authorized to use this command."); // This will check if you are rcon logged in
    GetPlayerName(playerid, Name, sizeof(Name)); //Storing the name into the Name variable we created
    for(new i=0; i<50; i++) // This will send a empty message 50 times to all players and it will clear the chat
    {
        SendClientMessageToAll(-1, "");
    }
    format(string, sizeof(string), "AdmWarning: %s has cleared the chat window.",Name); // This will show who cleared the chat (using the name variable to show the name we got earlier)
    SendClientMessageToAll(0xFFFF00AA, string); // This will send the message to all players
    return 1;
}
Also. Are you placing the commands outside callbacks?
Reply
#9

Код:
GetPlayerName(playerid, Name, sizeof(Name));
This is same like that what I made GetPlayerName(playerid) and you are right for IsPlayerAdmin
Reply
#10

Quote:
Originally Posted by McCarthy
Посмотреть сообщение
That would not work for Rcon admin but normal players. Also I'm pretty sure 100 lines arent needed, 50 will do just fine. The GetPlayerName will also not work in the format. Correct code would be:
pawn Код:
CMD:cc(playerid, params[])
{
    new string[128], Name[25]; // This is the string what is lenght 128 letters, and a variable to store the name in
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xAFAFAFAA, "You are not authorized to use this command."); // This will check if you are rcon logged in
    GetPlayerName(playerid, Name, sizeof(Name)); //Storing the name into the Name variable we created
    for(new i=0; i<50; i++) // This will send a empty message 50 times to all players and it will clear the chat
    {
        SendClientMessageToAll(-1, "");
    }
    format(string, sizeof(string), "AdmWarning: %s has cleared the chat window.",Name); // This will show who cleared the chat (using the name variable to show the name we got earlier)
    SendClientMessageToAll(0xFFFF00AA, string); // This will send the message to all players
    return 1;
}
Also. Are you placing the commands outside callbacks?
Thanks a lot!. REP+ added.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)