stock GetAdminRank(playerid)
{
new Rank[60];
if(PlayerStat[playerid][AdminLevel] >= 1)
{
if(PlayerStat[playerid][AdminLevel] == 1) format(Rank, sizeof(Rank), "Guider");
if(PlayerStat[playerid][AdminLevel] == 2) format(Rank, sizeof(Rank), "Senior Guider");
if(PlayerStat[playerid][AdminLevel] == 3) format(Rank, sizeof(Rank), "Chief Guider");
if(PlayerStat[playerid][AdminLevel] == 4) format(Rank, sizeof(Rank), "Server Monitor");
if(PlayerStat[playerid][AdminLevel] == 5) format(Rank, sizeof(Rank), "Junior Staff Member");
if(PlayerStat[playerid][AdminLevel] == 6) format(Rank, sizeof(Rank), "General Staff Member");
if(PlayerStat[playerid][AdminLevel] == 7) format(Rank, sizeof(Rank), "Senior Staff Member");
if(PlayerStat[playerid][AdminLevel] == 8) format(Rank, sizeof(Rank), "Staff Executive");
if(PlayerStat[playerid][AdminLevel] == 9) format(Rank, sizeof(Rank), "Staff Director");
if(PlayerStat[playerid][AdminLevel] == 10) format(Rank, sizeof(Rank), "Server Director");
if(PlayerStat[playerid][AdminLevel] == 101) format(Rank, sizeof(Rank), "Server Director [HoS]");
}
else
{
Rank = "Unassigned Administrator";
}
return Rank;
}
COMMAND:createadmin(playerid, params[])
{
new targetid, alevel, str[128];
if(PlayerStat[playerid][AdminLevel] < 10) return SendClientMessage(playerid, GREY, "You can't use this command.");
if(sscanf(params,"ud", targetid, alevel))return SendClientMessage(playerid, GREY, "USAGE: /makeadmin [playerid] [adminlevel]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "That player is not connected!");
if(alevel < 0) return SendClientMessage(playerid, GREY, "Invalid admin level.");
if(PlayerStat[targetid][AdminLevel] <= alevel)
{
format(str, sizeof(str), "You have been promoted to a %s [%d] by %s %s.", GetAdminRank(targetid),alevel, GetAdminRank(playerid), GetOOCName(playerid));
SendClientMessage(targetid, ORANGE, str);
format(str, sizeof(str), "You have promoted %s to a %s [%d]!", GetOOCName(targetid), GetAdminRank(targetid), alevel);
SendClientMessage(playerid, ORANGE, str);
AdminActionLog(str);
PlayerStat[targetid][AdminLevel] = alevel;
}
if(PlayerStat[targetid][AdminLevel] > alevel)
{
format(str, sizeof(str), "You have been demoted to a level %d administrator by %s %s.",alevel, GetAdminRank(playerid), GetOOCName(playerid));
SendClientMessage(targetid, ORANGE, str);
format(str, sizeof(str), "You have demoted %s to a level %d administrator!", GetOOCName(targetid), alevel);
SendClientMessage(playerid, ORANGE, str);
AdminActionLog(str);
PlayerStat[targetid][AdminLevel] = alevel;
}
return 1;
}
stock GetAdminRank(playerid)
{
new Rank[60];
if(PlayerStat[playerid][AdminLevel] > 0)
{
if(PlayerStat[playerid][AdminLevel] == 1) format(Rank, sizeof(Rank), "Guider");
else if(PlayerStat[playerid][AdminLevel] == 2) format(Rank, sizeof(Rank), "Senior Guider");
else if(PlayerStat[playerid][AdminLevel] == 3) format(Rank, sizeof(Rank), "Chief Guider");
else if(PlayerStat[playerid][AdminLevel] == 4) format(Rank, sizeof(Rank), "Server Monitor");
else if(PlayerStat[playerid][AdminLevel] == 5) format(Rank, sizeof(Rank), "Junior Staff Member");
else if(PlayerStat[playerid][AdminLevel] == 6) format(Rank, sizeof(Rank), "General Staff Member");
else if(PlayerStat[playerid][AdminLevel] == 7) format(Rank, sizeof(Rank), "Senior Staff Member");
else if(PlayerStat[playerid][AdminLevel] == 8) format(Rank, sizeof(Rank), "Staff Executive");
else if(PlayerStat[playerid][AdminLevel] == 9) format(Rank, sizeof(Rank), "Staff Director");
else if(PlayerStat[playerid][AdminLevel] == 10) format(Rank, sizeof(Rank), "Server Director");
else if(PlayerStat[playerid][AdminLevel] == 101) format(Rank, sizeof(Rank), "Server Director [HoS]");
}
else
{
Rank = "Unassigned Administrator";
}
return Rank;
}
not sure about this but try it
PHP код:
|
stock GetAdminRank(playerid)
{
new adminlevelname[128];
if(PlayerStat[playerid][AdminLevel] > 0)
{
if(PlayerStat[playerid][AdminLevel] == 1) { adminlevelname = "Guider"; }
else if(PlayerStat[playerid][AdminLevel] == 2) { adminlevelname = "Senior Guider"; }
else if(PlayerStat[playerid][AdminLevel] == 3) { adminlevelname = "Chief Guider"; }
else if(PlayerStat[playerid][AdminLevel] == 4) { adminlevelname = "Server Monitor"; }
else if(PlayerStat[playerid][AdminLevel] == 5) { adminlevelname = "Junior Staff Member"; }
else if(PlayerStat[playerid][AdminLevel] == 6) { adminlevelname = "General Staff Member"; }
else if(PlayerStat[playerid][AdminLevel] == 7) { adminlevelname = "Senior Staff Member"; }
else if(PlayerStat[playerid][AdminLevel] == 8) { adminlevelname = "Staff Executive"; }
else if(PlayerStat[playerid][AdminLevel] == 9) { adminlevelname = "Staff Director"; }
else if(PlayerStat[playerid][AdminLevel] == 10) { adminlevelname = "Server Director"; }
else if(PlayerStat[playerid][AdminLevel] == 101) { adminlevelname = "Server Director [HoS]"; }
}
else { adminlevelname = "Unassigned Administrator"; }
return adminlevelname;
}
pawn Код:
|
COMMAND:makeadmin(playerid, params[])
{
new targetid, alevel, str[128];
if(PlayerStat[playerid][AdminLevel] < 5) return SendClientMessage(playerid, GREY, "You can't use this command.");
if(sscanf(params,"ud", targetid, alevel))return SendClientMessage(playerid, GREY, "USAGE: /makeadmin [playerid] [adminlevel]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "Target ID not found.");
if(alevel < 0) return SendClientMessage(playerid, GREY, "Invalid admin level.");
if(PlayerStat[targetid][AdminLevel] <= alevel)
{
format(str, sizeof(str), "Admin %s has promoted %s to level %d admin.", GetOOCName(playerid), GetOOCName(targetid), alevel);
SendClientMessageToAll(RED, str);
AdminActionLog(str);
PlayerStat[targetid][AdminLevel] = alevel;
}
if(PlayerStat[targetid][AdminLevel] > alevel)
{
format(str, sizeof(str), "Admin %s has demoted %s to level %d admin.", GetOOCName(playerid), GetOOCName(targetid), alevel);
SendClientMessageToAll(RED, str);
AdminActionLog(str);
PlayerStat[targetid][AdminLevel] = alevel;
}
return 1;
}
stock GetAdminRank(playerid)
{
new Rank[60];
if(PlayerStat[playerid][AdminLevel] >= 1)
{
if(PlayerStat[playerid][AdminLevel] == 1) format(Rank, sizeof(Rank), "Moderator");
if(PlayerStat[playerid][AdminLevel] == 2) format(Rank, sizeof(Rank), "Administrator");
if(PlayerStat[playerid][AdminLevel] == 3) format(Rank, sizeof(Rank), "Administrator");
if(PlayerStat[playerid][AdminLevel] == 4) format(Rank, sizeof(Rank), "Head Administrator");
if(PlayerStat[playerid][AdminLevel] == 5) format(Rank, sizeof(Rank), "Management");
if(PlayerStat[playerid][AdminLevel] == 1338) format(Rank, sizeof(Rank), "Management");
}
else
{
Rank = "None";
}
return Rank;
}
stock GetAdminRank(playerid)
{
new Rank[60],
adminlevel = PlayerStat[playerid][AdminLevel;
switch(adminlevel)
{
case 0: format(Rank, sizeof(rank), "None");
case 1: format(Rank, sizeof(rank), "Guider");
case 2: format(Rank, sizeof(rank), "Senior Guider");
case 3: format(Rank, sizeof(rank), "Chief Guidere");
case 4: format(Rank, sizeof(rank), "Server Monitor");
case 5: format(Rank, sizeof(rank), "Junior Staff Member");
case 6: format(Rank, sizeof(rank), "General Staff Member");
case 7: format(Rank, sizeof(rank), "Senior Staff Member");
case 8: format(Rank, sizeof(rank), "Staff Executive");
case 9: format(Rank, sizeof(rank), "Staff Director");
case 10: format(Rank, sizeof(rank), "Server Director");
case 101: format(Rank, sizeof(rank), "Server Director [HoS]");
}
return Rank;
}
Try using a switch statement:
pawn Код:
|
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3372) : error 017: undefined symbol "rank"
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3372) : error 036: empty statement
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3373) : error 014: invalid statement; not in switch
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3373) : warning 215: expression has no effect
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3373) : error 001: expected token: ";", but found ":"
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3373) : error 029: invalid expression, assumed zero
C:\Users\cbrickell\Desktop\PWN\gamemodes\EGRP.pwn(3373) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
6 Errors.
Gave that a try mate, but it's returning me these errors. I'm not sure how to fix it
pawn Код:
|
stock GetAdminRank(playerid)
{
new Rank[60],
adminlevel = PlayerStat[playerid][AdminLevel];
switch(adminlevel)
{
case 0: format(Rank, sizeof(Rank), "None");
case 1: format(Rank, sizeof(Rank), "Guider");
case 2: format(Rank, sizeof(Rank), "Senior Guider");
case 3: format(Rank, sizeof(Rank), "Chief Guidere");
case 4: format(Rank, sizeof(Rank), "Server Monitor");
case 5: format(Rank, sizeof(Rank), "Junior Staff Member");
case 6: format(Rank, sizeof(Rank), "General Staff Member");
case 7: format(Rank, sizeof(Rank), "Senior Staff Member");
case 8: format(Rank, sizeof(Rank), "Staff Executive");
case 9: format(Rank, sizeof(Rank), "Staff Director");
case 10: format(Rank, sizeof(Rank), "Server Director");
case 101: format(Rank, sizeof(Rank), "Server Director [HoS]");
}
return Rank;
}