Please help, will be explained in the text.
#1

Hello reader,

I am trying to add an Admin, Moderator and Helper system for my server. The problem I have is the next:
When I set one player as Admin ( As that is the only thing I've scripted commands for yet so I can test if it works. ) everyone is Admin. How to fix this? The code:
pawn Код:
*under includes*
new isadmin[MAX_PLAYERS];
new targetplayerid;


// /setadmin command.
CMD:setadmin(playerid, params[])
{
        if (IsPlayerAdmin(playerid) == 1)
        {
        if (isnull(params)) return SendClientMessage(playerid, KLEUR_VOORB, "USAGE: /setadmin [ID] [level]");
            {
            if(!sscanf(params, "dd", targetplayerid, isadmin[targetplayerid]))
            if(isadmin[targetplayerid] > 6 || isadmin[targetplayerid] < 0) return SendClientMessage(playerid, KLEUR_VOORB, "Level: 0-6");
            if(isadmin[targetplayerid] == 0)
            {
            isadmin[targetplayerid] = 0;
            new maker[110];
            format(maker, sizeof(maker), "You have just removed %s from the Administration team.", pNaam(targetplayerid));
            SendClientMessage(playerid, KLEUR_BLAUW, maker);
            new krijger[110];
            format(krijger, sizeof(krijger), "Administrator %s has just removed you from the Administration team.", pNaam(playerid));
            SendClientMessage(targetplayerid, KLEUR_BLAUW, krijger);
            }
            if(isadmin[targetplayerid] == 1)
            {
            isadmin[targetplayerid] = 1;
            new maker[110];
            format(maker, sizeof(maker), "You have just added %s to the Administration team.", pNaam(targetplayerid));
            SendClientMessage(playerid, KLEUR_BLAUW, maker);
            new krijger[110];
            format(krijger, sizeof(krijger), "Administrator %s has just added you to the Administration team.", pNaam(playerid));
            SendClientMessage(targetplayerid, KLEUR_BLAUW, krijger);
            }
            }
        return 1;
        }
return 1;
}
I don't need a fixed up code as I do not really learn a lot from it, I'd like an explanation of how to fix it.

Thank you in advance,
Jesse
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)