How can I make this /setadmin command?
#1

Hi. I'm wanting to create a /setadmin command, but I don't really know where to start. I currently have this, and a scripted register system.
pawn Код:
enum pInfo
{
    pPass,
    pCash,
    pAdmin,
    pKills,
    pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
How could I use make a certain player a admin, and save it to the file for that player? I've tried this.
pawn Код:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You're not authorized to use this command");
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setadmin [playerid] [level 1-4]");
    if(levels > 4) return SendClientMessage(playerid, COLOR_BRIGHTRED, "LEVELS 1-4");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_BRIGHTRED, "That player is not connected.");
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid, COLOR_BRIGHTRED, "ERROR: That player is already that Admin Level.");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has set your Administrator level to %d.",Nam,levels);
        SendClientMessage(ID,COLOR_GREENBLUE,str);
        format(str, sizeof(str), "You have set %s's Administrator leevel to %d",pname,levels);
        SendClientMessage(playerid, COLOR_CYAN,str);
        return 1;
    }
    format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    PlayerData[ID][AdminLevel] = levels;
    return 1;
}
And then get errors.
Код:
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1434) : error 017: undefined symbol "ID"
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1435) : error 017: undefined symbol "levels"
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1436) : error 017: undefined symbol "ID"
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1437) : error 017: undefined symbol "PlayerData"
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1437) : error 017: undefined symbol "ID"
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1437) : error 029: invalid expression, assumed zero
C:\Users\Luke\Desktop\Unban\gamemodes\updatedurban.pwn(1437) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


7 Errors.
How could I define "levels" and "ID" and "PlayerData"? Or do I use [PInfo]?... I'm completely lost.
Reply


Messages In This Thread
How can I make this /setadmin command? - by rangerxxll - 05.03.2012, 05:03
Re: How can I make this /setadmin command? - by Faisal_khan - 05.03.2012, 05:11
Re: How can I make this /setadmin command? - by Walsh - 05.03.2012, 05:17
Re: How can I make this /setadmin command? - by Bogdan1992 - 05.03.2012, 05:20
Re: How can I make this /setadmin command? - by rangerxxll - 05.03.2012, 05:39

Forum Jump:


Users browsing this thread: 2 Guest(s)