What is the problem there ?
#1

It's about my admin chat command , any one type /ac he get my name and rank for example my friend if he type /ac text he it show me this [Owner]SilentSoul:text....
Codes
pawn Код:
CMD:ac(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] == 0)return SendClientMessage(playerid,-1,"{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use admin chat");
    new name[1024],i , text[126];
    if(sscanf(params, "s[126]", text))return SendClientMessage(playerid,-1,"{FF0000}[System Usage]:{FAF5F5}/ac [text]");
    GetPlayerName(i, name, sizeof(name));
    format(text, sizeof(text), "{FFD700}[%s] %s: %s", GetPlayerAdminRank(i),name ,text);
    SendMessageToAdmins(text);
    return 1;
}
About GetPlayerAdminRank

pawn Код:
stock GetPlayerAdminRank(playerid)
{
    new rankname[32];

    switch(PlayerInfo[playerid][pAdminLevel])
    {
        case 1: { rankname = "Moderator"; }
        case 2: { rankname = "Admin"; }
        case 3: { rankname = "Head Admin"; }
        case 4: { rankname = "Owner"; }
    }

    return rankname;
}
And SendMessage To Admins stock
pawn Код:
stock SendMessageToAdmins(text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)

    {
        if(PlayerInfo[i][pAdminLevel] > 0)
        {
            SendClientMessage(i, -1, text);
        }
    }
}
Sorry for my bad english :/
Reply
#2

You should use playerid id in CMD:ac and not i.

Код:
CMD:ac(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] == 0)return SendClientMessage(playerid,-1,"{FF0000}[ERROR]:{FAF5F5}You are not{FF0000} Administrator {FAF5F5}to use admin chat");
    new name[1024], text[126];
    if(sscanf(params, "s[126]", text))return SendClientMessage(playerid,-1,"{FF0000}[System Usage]:{FAF5F5}/ac [text]");
    GetPlayerName(playerid, name, sizeof(name));
    format(text, sizeof(text), "{FFD700}[%s] %s: %s", GetPlayerAdminRank(playerid),name ,text);
    SendMessageToAdmins(text);
    return 1;
}
Reply
#3

-Thank you , i will test later thanks for reply
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)