Report system
#1

it seems that if I do /report, it wont show if ID 1 is admin, and is the same thing for /a chat and /admins..idk what the fuck ive done wrong, im a noob.

pawn Код:
CMD:a(playerid, params[])
    {
    if(PlayerInfo[playerid][pAdmin] >= 1)
        {
        new string[128],
        amessage[100];
        if(sscanf(params, "s[100]", amessage))
            {
            SendClientMessage(playerid, -1, "USAGE: /a [Text]");
            return 1;
            }
        else
            {
            format(string, sizeof(string), "[Admin Chat] %s: %s", GetName(playerid), amessage);
            foreach (new i : Player)
                {
                if(PlayerInfo[i][pAdmin] >= 1)
                    {
                    SendClientMessage(i, COLYELLOW, string);
                    return 1;
                    }
                return 1;
                }
            }
        }
    return 1;
    }
pawn Код:
CMD:admins(playerid, params[])
    {
    SCM(pid, COLYELLOW, "Admins Online:");
    foreach(new i : Player)
        {
        if(PlayerInfo[i][pAdmin] >=1)
            {
            new name[100];
            format(name, sizeof(name), "Admin %s {%d}",GetName(i), (i));
            SCM(pid, COLWHITE, name);
            return 1;
            }
        }
    return 1;
    }

CMD:report(playerid, params[])
    {
    new string[128];
//  reportmessage[100];
    if(strlen(params)>=100)return SCM(pid, COLRED, "[Server]{F0F0F0}: Max report length is 100.");
    else
        {
        format(string, sizeof(string), "[Report] %s {%d}: %s", GetName(playerid), playerid, params);
        SCM(pid, COLPURPLE, "Your message has been sent to online admins!");
        foreach (new i : Player)
            {
            if(PlayerInfo[i][pAdmin] >=1)
                {
                SCM(i, COLPURPLE, string);
                return 1;
                }
            }
        }
    return 1;
    }
Reply
#2

and yes, I know the /report should have if(sscanf whatever to it..I think im missing something with foreach on this one
Reply
#3

pawn Код:
CMD:admins(playerid)
{
    new name[40];
    SCM(playerid, COLYELLOW, "Admins Online:");
    foreach(new i : Player)
    {
        if(PlayerInfo[i][pAdmin] >= 1)
        {
            format(name, sizeof(name), "Admin %s {%d}",GetName(i), i);
            SCM(playerid, COLWHITE, name);
        }
    }
    return 1;
}
dont use return in foreach because it stops loop
Reply
#4

Oh thanks, I thought only returning 0 stopped the loop
Reply
#5

No return; or return 35345345; stops too, or break;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)