Admin Chat?
#1

How do i make an Admin Chat?

like /# bla bla bla then it comes on chat window [ADMIN JonnyBoy]: bla bla bla?

can someone help me? :]
Reply
#2

Код:
dcmd_a(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][AdminLevel] >= 1)
	{
 		if(!strlen(params))
 		{
		 	SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /a [text]");
		 	return 1;
		}
		new str[128], pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str), "(Admin Chat): %s said %s", pName,params[0] );
  		SendAdminMessage(0xF6A442FF, str);
	}
	else
	{
			SendClientMessage(playerid,COLOR_GRAD1,"You are not authorized to use that command!");
	}
	return 1;
}
Reply
#3

pawn Код:
/* Simple adminchat (RCON based) by Seven_of_Nine */
//TESTED
COMMAND:ac(playerid,params[]) {
    new
        poster[40],
        mess[128];

    sscanf(params,"s",mess);
    if(IsPlayerAdmin(playerid))
        if(!isnull(mess)) {
            for(new i = 0; i < MAX_PLAYERS; ++i) {
                if(IsPlayerConnected(i) && !IsPlayerNPC(i) && IsPlayerAdmin(i)) {
                    new
                        text[128];

                    GetPlayerName(playerid,poster,sizeof(poster));
                    format(text,sizeof(text),"[AdminChat] | %s: %s",poster,mess);
                    SendClientMessage(i,yellow,text);
                }
            }
        } else {
            return SendClientMessage(playerid,red,"USAGE: /ac [message], and admins will get this message.");
        }
    return 1;
}

Make sure you have included ZCMD.
Then, you can put it in a script or a filterscript
Reply
#4

Quote:
Originally Posted by AntiGen
Посмотреть сообщение
Код:
dcmd_a(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][AdminLevel] >= 1)
	{
 		if(!strlen(params))
 		{
		 	SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /a [text]");
		 	return 1;
		}
		new str[128], pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(str, sizeof(str), "(Admin Chat): %s said %s", pName,params[0] );
  		SendAdminMessage(0xF6A442FF, str);
	}
	else
	{
			SendClientMessage(playerid,COLOR_GRAD1,"You are not authorized to use that command!");
	}
	return 1;
}
Thanks, Gen!

works perfectly :3

Quote:
Originally Posted by Seven_of_Nine
Посмотреть сообщение
pawn Код:
/* Simple adminchat (RCON based) by Seven_of_Nine */
//TESTED
COMMAND:ac(playerid,params[]) {
    new
        poster[40],
        mess[128];

    sscanf(params,"s",mess);
    if(IsPlayerAdmin(playerid))
        if(!isnull(mess)) {
            for(new i = 0; i < MAX_PLAYERS; ++i) {
                if(IsPlayerConnected(i) && !IsPlayerNPC(i) && IsPlayerAdmin(i)) {
                    new
                        text[128];

                    GetPlayerName(playerid,poster,sizeof(poster));
                    format(text,sizeof(text),"[AdminChat] | %s: %s",poster,mess);
                    SendClientMessage(i,yellow,text);
                }
            }
        } else {
            return SendClientMessage(playerid,red,"USAGE: /ac [message], and admins will get this message.");
        }
    return 1;
}

Make sure you have included ZCMD.
Then, you can put it in a script or a filterscript
i don't use zcmd xd only dcmd and normal ones
Reply
#5

You can convert it to DCMD you know...
Reply
#6

Quote:
Originally Posted by alpha500delta
Посмотреть сообщение
You can convert it to DCMD you know...
lol i didn't know that but Gen's (AntiGen) Its better cuz i know what to do :]

i have never seen ZCMD before tho
Reply
#7

This also works really great
pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/a)dmin [admin chat]");
                return 1;
            }
            new atext[60];
            if(PlayerInfo[playerid][pAdmin] == 1){ atext = "SAdmin(1)"; }
            if(PlayerInfo[playerid][pAdmin] == 2){ atext = "Junior Admin(2)"; }
            if(PlayerInfo[playerid][pAdmin] == 3){ atext = "General Admin(3)"; }
            if(PlayerInfo[playerid][pAdmin] == 4){ atext = "Senior Admin(4)"; }
            if(PlayerInfo[playerid][pAdmin] == 1337){ atext = "Elite Admin(1337)"; }
            if(PlayerInfo[playerid][pAdmin] == 99998) { atext = "Head Scripter(99998)"; }
            if(PlayerInfo[playerid][pAdmin] == 99999) { atext = "Server Owner(99999)"; }
            format(string, sizeof(string), "*%d %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
            if(PlayerInfo[playerid][pAdmin] >= 1)
            {
                SendAdminMessage(COLOR_YELLOW, string);
            }
        }
        return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)