05.03.2012, 05:03
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.
How could I use make a certain player a admin, and save it to the file for that player? I've tried this.
And then get errors.
How could I define "levels" and "ID" and "PlayerData"? Or do I use [PInfo]?... I'm completely lost.
pawn Код:
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
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;
}
Код:
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.