Admin chat help
#1

Well, i have a admin chat and this is only for Rcon admins, but how can i create it for Admins without rcon

Quote:

dcmd_a(playerid, cmdtext[]) {
#pragma unused cmdtext
new sendername[MAX_PLAYER_NAME];
new string[256], idx;
if (!IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_BLUE, "You're not an admin.");
else {
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
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 <message>");
return 1;
}
format(string, sizeof(string), "[AdminChat]%s: %s", sendername, result);
SendAdminMessage(COLOR_WHITE,string);
return 1;
}
return 1;
}

Reply
#2

There are literally TONS of scripts that has the feature you need!

Why don't you try and search up a bit and see how they were created?
Reply
#3

Right in place of !IsPlayerAdmin(playerid), add your admin check and you're done.
Reply
#4

Quote:
Originally Posted by lulo356
Посмотреть сообщение
Well, i have a admin chat and this is only for Rcon admins, but how can i create it for Admins without rcon
pawn Код:
dcmd_a(playerid, cmdtext[]) {
#pragma unused cmdtext
new sendername[MAX_PLAYER_NAME];
new string[256], idx;
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
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 <message>");
return 1;
}
format(string, sizeof(string), "[AdminChat]%s: %s", sendername, result);
SendAdminMessage(COLOR_WHITE,string);
return 1;
}
return 1;
}
PS: Not Tested
Reply
#5

I prefer u to use sscanf.
Reply
#6

lulo356 better change to zcmd or ycmd processor.

On Topic:

Show us your /slap command or /kick command.
Reply
#7

1st of all u have to make an Enum
I will be using ZCMD and SSCANF
pawn Код:
// enum:
enum PlayerData
{
    AdminLvl
}
new pInfo [MAX_PLAYERS] [PlayerData];
// CMD:
CMD:achat(playerid, params[])
{
    new p2[128], Pna[32];
    if(pInfo[playerid] [Adminlvl] < 1) return 0;
    if( isnull (params)) return SendClientMessage(playerid, COLOR_RED, "/ac [msg]");
    GetPlayerName(playerid, Pna, 32);
    if (pInfo [playerid] [AdminLevel] >= 1 || IsPlayerAdmin(playerid))
    {
        for(new i = 0; i<MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if(pInfo [i] [Adminlvl] >= 1)
                {
                    format(p2, 128, "Admin %s (%d): %s", Pna, playerid, params);
                    SendClientMessage(i , -1, p2);
                }
            }
        }
    }  
    return 1;
}
If u want me to explain it, tell me
Reply
#8

@ newbie scripter.

Just one error I've seen on your script so far is that you've inconsistently used enum names, e.g. you switched between AdminLvl and AdminLevel. That is bound to cause error/s.
Reply
#9

Quote:
Originally Posted by Raza2013
Посмотреть сообщение
pawn Код:
dcmd_a(playerid, cmdtext[]) {
#pragma unused cmdtext
new sendername[MAX_PLAYER_NAME];
new string[256], idx;
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
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 <message>");
return 1;
}
format(string, sizeof(string), "[AdminChat]%s: %s", sendername, result);
SendAdminMessage(COLOR_WHITE,string);
return 1;
}
return 1;
}
PS: Not Tested

This one is working, only if you do /a [text] its not sending
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)