SA-MP Forums Archive
dcmd_a (admin chat) not working after trying to fix a lot... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd_a (admin chat) not working after trying to fix a lot... (/showthread.php?tid=136934)



dcmd_a (admin chat) not working after trying to fix a lot... - Andy_McKinley - 27.03.2010

This is my Admin chat command. I tried a lot, but never worked. I hope someone can help.

pawn Код:
dcmd_a(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 1 || IsPlayerAdmin(playerid))
    {
        new msg[128], string[128];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "USAGE: /a [text]");
        if(strlen(msg) < 1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "You are not an Adminstrator with the required level.");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(pInfo[i][pAdmin] < 1)
            {
            format(string, sizeof(string), "Admin %s: %s", pNick(playerid), msg);
            SendClientMessage(i, COLOR_LIGHTBLUE, string);
            }
        }
    }
    return 0;
}



Re: dcmd_a (admin chat) not working after trying to fix a lot... - MadeMan - 27.03.2010

pawn Код:
dcmd_a(playerid, params[])
{
    if(pInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
    {
        new msg[128], string[128];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "USAGE: /a [text]");
        format(string, sizeof(string), "Admin %s: %s", pNick(playerid), msg);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(pInfo[i][pAdmin] >= 1)
            {
                SendClientMessage(i, COLOR_LIGHTBLUE, string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTYELLOW, "You are not an Adminstrator with the required level.");
    }
    return 1;
}



Re: dcmd_a (admin chat) not working after trying to fix a lot... - Niixie - 27.03.2010

pawn Код:
dcmd_a(playerid, params[])
{
    if(pInfo[playerid][pAdmin] >= 1)
    {
        new msg[128], string[128];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "USAGE: /a [text]");
        else if(strlen(msg) < 1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "You are not an Adminstrator with the required level.");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(pInfo[i][pAdmin] >= 1)
            {
               format(string, sizeof(string), "Admin %s: %s", pNick(playerid), msg);
               SendClientMessage(i, COLOR_LIGHTBLUE, string);
            }
        }
    }
    return 1;
}
or try this, i've fixed yours


Re: dcmd_a (admin chat) not working after trying to fix a lot... - Andy_McKinley - 27.03.2010

Quote:
Originally Posted by MadeMan
pawn Код:
dcmd_a(playerid, params[])
{
    if(pInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid))
    {
        new msg[128], string[128];
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOR_LIGHTYELLOW, "USAGE: /a [text]");
        format(string, sizeof(string), "Admin %s: %s", pNick(playerid), msg);
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(pInfo[i][pAdmin] >= 1)
            {
                SendClientMessage(i, COLOR_LIGHTBLUE, string);
            }
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_LIGHTYELLOW, "You are not an Adminstrator with the required level.");
    }
    return 1;
}
This one is working, thanks!