05.04.2013, 16:54
Quote:
|
pawn Code:
|
When using that code, whenever I typed it, it came up with: Error: "Must be Level 1-5"
So I changed it to this
pawn Code:
CMD:setadmin(playerid, params[])
{
new id, adminlevel;
if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
else
{
if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
else
{
PlayerInfo[id][pAdmin] = adminlevel;
}
}
return 1;
}
Quote:
|
Also whats nice to save a lot of coding is make some defines like this........ pawn Code:
pawn Code:
CMDLEVEL(5); COMMUNITYLEVEL(4); Best way to do these things neatly |
Quote:
|
This is a really basic solution you'll surely want to add more messages and more checks etc but just to give you a idea.
Code:
CMD:setlevel(playerid, params[])
{
new pid;
new level;
sscanf(params, "ui", pid, level);
if(IsPlayerConnected(pid))
{
// Level between 1 and 5
if(level >= 1 && level <= 5)
{
PlayerInfo[playerid][pAdmin] = newlevel;
SendClientMessage(playerid, 0xFF00FFFF, "Set This Users Level!");
}
}
}
|
thanks.
I have +REP'd everybody who has posted here, thank you for your help!


