command(adminlevel, playerid, params[]) { new id, level, string[128]; if(sscanf(params, "ud", id, level)) { if(Player[playerid][AdminLevel] >= 1338) { SendClientMessage(playerid, WHITE, "SYNTAX: /adminlevel [playerid] [new level]"); } } else { if(Player[playerid][AdminLevel] >= 6) { if(Player[id][AdminLevel] == 0 && level >= 1) { if(level >= Player[playerid][AdminLevel]) { SendClientMessage(playerid, WHITE, "You can only hire an admin to a lower level."); } else { Player[id][AdminLevel] = level; format(string, sizeof(string), "%s has been hired to admin level %d by %s.", GetName(id), level, GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); StatLog(string); if(Player[id][AdminPIN] == 0) { TogglePlayerControllable(id, false); SendClientMessage(id, WHITE, "You don't have an admin PIN set. Please now set one, it must be numeric only and 6 characters in length."); ShowPlayerDialog(id, 9843, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your desired PIN.", "Done", "Cancel"); } else { Player[id][PINUnauthedTime] = 1; SendClientMessage(id, WHITE, "You have 10 seconds to login before you are auto-kicked."); TogglePlayerControllable(id, false); ShowPlayerDialog(id, 9842, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your additional admin PIN to continue.", "Login", "Cancel"); } } } else if(level >= Player[playerid][AdminLevel]) { SendClientMessage(playerid, WHITE, "You're unable to execute this action."); } else if(level >= Player[id][AdminLevel]) { format(string, sizeof(string), "%s has been promoted to admin level %d by %s.", GetName(id), level, GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); Player[id][AdminLevel] = level; StatLog(string); } else if(level < 1) { format(string, sizeof(string), "%s has been removed from the admin team by %s.", GetName(id), GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); Player[id][AdminLevel] = level; Player[id][AdminDuty] = 0; SetPlayerName(id, Player[id][NormalName]); StatLog(string); } else if(level < Player[id][AdminLevel]) { format(string, sizeof(string), "%s has been demoted to admin level %d by %s.", GetName(id), level, GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); Player[id][AdminLevel] = level; StatLog(string); } } } return 1; }
If you have enum PlayerStatistics
Add something under that like. Adminlevel, Then you can continue on with creating your command. EDIT: If you've done that, heres my command, it should work if you've added the enum. Код:
command(adminlevel, playerid, params[]) { new id, level, string[128]; if(sscanf(params, "ud", id, level)) { if(Player[playerid][AdminLevel] >= 1338) { SendClientMessage(playerid, WHITE, "SYNTAX: /adminlevel [playerid] [new level]"); } } else { if(Player[playerid][AdminLevel] >= 6) { if(Player[id][AdminLevel] == 0 && level >= 1) { if(level >= Player[playerid][AdminLevel]) { SendClientMessage(playerid, WHITE, "You can only hire an admin to a lower level."); } else { Player[id][AdminLevel] = level; format(string, sizeof(string), "%s has been hired to admin level %d by %s.", GetName(id), level, GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); StatLog(string); if(Player[id][AdminPIN] == 0) { TogglePlayerControllable(id, false); SendClientMessage(id, WHITE, "You don't have an admin PIN set. Please now set one, it must be numeric only and 6 characters in length."); ShowPlayerDialog(id, 9843, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your desired PIN.", "Done", "Cancel"); } else { Player[id][PINUnauthedTime] = 1; SendClientMessage(id, WHITE, "You have 10 seconds to login before you are auto-kicked."); TogglePlayerControllable(id, false); ShowPlayerDialog(id, 9842, DIALOG_STYLE_INPUT, "Authentication (Admin PIN)", "Please enter your additional admin PIN to continue.", "Login", "Cancel"); } } } else if(level >= Player[playerid][AdminLevel]) { SendClientMessage(playerid, WHITE, "You're unable to execute this action."); } else if(level >= Player[id][AdminLevel]) { format(string, sizeof(string), "%s has been promoted to admin level %d by %s.", GetName(id), level, GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); Player[id][AdminLevel] = level; StatLog(string); } else if(level < 1) { format(string, sizeof(string), "%s has been removed from the admin team by %s.", GetName(id), GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); Player[id][AdminLevel] = level; Player[id][AdminDuty] = 0; SetPlayerName(id, Player[id][NormalName]); StatLog(string); } else if(level < Player[id][AdminLevel]) { format(string, sizeof(string), "%s has been demoted to admin level %d by %s.", GetName(id), level, GetName(playerid)); SendToAdmins(ADMINORANGE, string, 0); Player[id][AdminLevel] = level; StatLog(string); } } } return 1; } |
This is just a copy and paste from another script (Vortex I believe). It has other variables in it such as 'AdminPIN' and 'PINUnauthedTime', which you did not explain to him to add in there. You need to make the command yourself like he is requesting, so that it will not throw any errors upon his addition of this excerpt into his script. Also, his enum might not consist of 'Player', it could be 'PlayerInfo' or 'PlayerStats', you also failed to mention that as well.
|