[HELP]Admin Chat!
#1

Hey Guys, yet again i'm having a problem. Can you guys help?

pawn Код:
if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
    {
        if(AccountInfo[playerid][AdminLevel] == 5) { format(string, sizeof(string), "[!] Owner %s: %s [!]", sendername, result); }
        else if(AccountInfo[playerid][AdminLevel] == 4) { format(string, sizeof(string), "[!] Lead Admin %s: %s [!]", sendername, result); }
        else if(AccountInfo[playerid][AdminLevel] == 3) { format(string, sizeof(string), "[!] Admin %s: %s [!]", sendername, result); }
        else if(AccountInfo[playerid][AdminLevel] == 2) { format(string, sizeof(string), "[!] Moderator %s: %s [!]", sendername, result); }
        else if(AccountInfo[playerid][AdminLevel] == 1) { format(string, sizeof(string), "[!] Trial Admin %s: %s [!]", sendername, result); }
        else
        {
            format(string, sizeof(string), "[!] Trial %s: %s [!]", sendername, result);
        }
        SendClientMessageToAdmins(DARKPINK, string, 1);
        printf("[!]: %s", string);
        return 1;
        }
        else return SendClientMessage(playerid, RED, "You are not an admin!");
        }
    }
Thanks.

-Mike.
Reply
#2

What's wrong with it?

EDIT: You're going to have to put that OnPlayerText, If I remember correctly, not OnPlayerCommandText.
Reply
#3

Once you go ingame it only Says [!] Level: [!] no message or name.
Reply
#4

Quote:
Originally Posted by [NYRP
Mike. ]
Once you go ingame it only Says [!] Level: [!] no message or name.
Alright, give me one minute, i'll do it in ZCMD, and you can either convert it, or whatever.
Reply
#5

This was the old Admin Chat command:

pawn Код:
if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
    {
        if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
        {
          if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "[USAGE]: //<text>"), SendClientMessage(playerid, ORANGE, "HELP: Example: //Hi");
            GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "Admin [%i]%s: %s" ,playerid,sendername, cmdtext[2]);
            SendClientMessageToAdmins(DARKPINK, string, 1);
            return 1;
        }
        else return SendClientMessage(playerid, RED, "You are not an admin!");
    }
if You need that, but.
Reply
#6

Код:
if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
{
if(AccountInfo[playerid][AdminLevel] <= 1) return SendClientMessage(playerid, RED, "You are not an admin!");
if(AccountInfo[playerid][AdminLevel] == 5) return format(string, sizeof(string), "[!] Owner %s: %s [!]", sendername, result); 
if(AccountInfo[playerid][AdminLevel] == 4) return format(string, sizeof(string), "[!] Lead Admin %s: %s [!]", sendername, result);
if(AccountInfo[playerid][AdminLevel] == 3) return format(string, sizeof(string), "[!] Admin %s: %s [!]", sendername, result);
if(AccountInfo[playerid][AdminLevel] == 2) return format(string, sizeof(string), "[!] Moderator %s: %s [!]", sendername, result); 
if(AccountInfo[playerid][AdminLevel] == 1) return format(string, sizeof(string), "[!] Trial Admin %s: %s [!]", sendername, result); 
else
{
format(string, sizeof(string), "[!] Trial %s: %s [!]", sendername, result);
SendClientMessageToAdmins(DARKPINK, string, 1);
printf("[!]: %s", string);
}
return 1;
}
Reply
#7

pawn Код:
zcmd(a, playerid, params[])
{
    new administrator[MAX_PLAYER_NAME], string[128],chat[128];
    if(!sscanf(params, "s", chat)) //With this we only need an "S" variable, which stands for string.. Syntax: /A [Chat]
    { //This means all you will need to do is Administrator-only broadcast a string, which is shown below.
        if(SInfo[playerid][pAdmin] == 1)
        {
          GetPlayerName(playerid, administrator, sizeof(administrator));
            format(string, sizeof(string), "[Trial Admin %s]: %s", administrator, chat);
            AChat(blue, string, 1); //Simple administrator chat.
        }
        if(SInfo[playerid][pAdmin] == 2)
        {
          GetPlayerName(playerid, administrator, sizeof(administrator));
            format(string, sizeof(string), "[Admin %s]: %s", administrator, chat);
            AChat(blue, string, 1); //Simple administrator chat.
        }
        if(SInfo[playerid][pAdmin] == 3)
        {
          GetPlayerName(playerid, administrator, sizeof(administrator));
            format(string, sizeof(string), "[Admin %s]: %s", administrator, chat);
            AChat(blue, string, 1); //Simple administrator chat.
        }
        if(SInfo[playerid][pAdmin] == 4)
        {
          GetPlayerName(playerid, administrator, sizeof(administrator));
            format(string, sizeof(string), "[Admin %s]: %s", administrator, chat);
            AChat(blue, string, 1); //Simple administrator chat.
        }
        if(SInfo[playerid][pAdmin] == 5)
        {
          GetPlayerName(playerid, administrator, sizeof(administrator));
            format(string, sizeof(string), "[Admin %s]: %s", administrator, chat);
            AChat(blue, string, 1); //Simple administrator chat.
        }
        else return SendClientMessage(playerid, red, "[ERROR]: You are not an Administrator.");
    }
    else return SendClientMessage(playerid, lg, "[USAGE]: /A [Chat]");
    return 1;
}
Just change what you need around, should work fine.

EDIT: ignore the comments, just notes to myself.

//sky.
Reply
#8

to RyDeR - Noesnt Work, Nothing shows up now.
to Sizeoff - I was hoping to not get it in ZCMD but Thanks anyway, maybe i will just stick to the old 1
Reply
#9

Quote:
Originally Posted by [NYRP
Mike. ]
to RyDeR - Noesnt Work, Nothing shows up now.
to Sizeoff - I was hoping to not get it in ZCMD but Thanks anyway, maybe i will just stick to the old 1
Ah, it's cool, sorry I couldn't help you in strtok, I'm just not experienced in it.
Also, I think it's a problem with your // command prefix, it's bugging it out, pawno thinks it's a comment, try using a different command.
Reply
#10

Works fine as '//' without the Rank display, but i'll just stick with

pawn Код:
if(!strcmp(cmdtext, "//", true, 2)) // Admin chat
    {
        if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
        {
          if(!strlen(cmdtext[2])) return SendClientMessage(playerid, ORANGE, "[USAGE]: //<text>"), SendClientMessage(playerid, ORANGE, "HELP: Example: //Hi");
            GetPlayerName(playerid, sendername, sizeof(sendername));
          format(string, sizeof(string), "[!] Level[%s]%s: %s" ,AccountInfo[playerid][AdminLevel],sendername, cmdtext[2]);
            SendClientMessageToAdmins(DARKPINK, string, 1);
            return 1;
        }
        else return SendClientMessage(playerid, RED, "you are not authorized to use that command.");
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)