CMD:makeadmin(playerid, params[]) { new id, string[128], level, code[5]; generateCode(code, 5); if(PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, COLOR_BLUE, "You don't have acces to that command."); if(sscanf(params, "dd", id, level)) return SendClientMessage(playerid, COLOR_RED, "SERVER: /makeadmin [ID] [LEVEL]"); format(string, sizeof(string), "%s promoted you to level %i.\nSecurity Code: %s", PlayerName(playerid), level, code); ShowPlayerDialog(id,DIALOG_ADMINBOX,DIALOG_STYLE_MSGBOX, "You are an admin", string, "Ok", ""); format(string, sizeof(string), "You promoted %s to level %i.", PlayerName(id), level); SendClientMessage(playerid, COLOR_BLUE, string); PlayerInfo[id][pAdmin] = level; format(AdminKod[playerid], 6, code); // Stores the code into the string return 1; }
CMD:makeadmin(playerid, params[]) { new id, string[128], level, code[5]; generateCode(code, 5); if(PlayerInfo[playerid][pAdmin] < 7) return SendClientMessage(playerid, COLOR_BLUE, "You don't have acces to that command."); if(sscanf(params, "ud", id, level)) return SendClientMessage(playerid, COLOR_RED, "SERVER: /makeadmin [ID] [LEVEL]"); else if(level < 1) return SendClientMessage(playerid, COLOR_RED, "SERVER: /makeadmin [ID] [LEVEL]"); format(string, sizeof(string), "%s promoted you to level %i.\nSecurity Code: %s", PlayerName(playerid), level, code); ShowPlayerDialog(id,DIALOG_ADMINBOX,DIALOG_STYLE_MSGBOX, "You are an admin", string, "Ok", ""); format(string, sizeof(string), "You promoted %s to level %i.", PlayerName(id), level); SendClientMessage(playerid, COLOR_BLUE, string); PlayerInfo[id][pAdmin] = level; format(AdminKod[playerid], 6, code); // Stores the code into the string return 1; }
CMD:makeadmin(playerid, params[])
{
new id, string[128], level, code[5];
if(PlayerInfo[playerid][pAdmin] < 7)
return SendClientMessage(playerid, COLOR_BLUE, "You don't have acces to that command.");
if(sscanf(params, "dd", id, level))
return SendClientMessage(playerid, COLOR_RED, "SERVER: /makeadmin [ID] [LEVEL]");
if(level == 0)
{
format(string, sizeof(string), "%s has removed your admin level.", PlayerName(playerid));
ShowPlayerDialog(id, DIALOG_ADMINBOX, DIALOG_STYLE_MSGBOX, "Sorry...", string, "Ok", "");
format(string, sizeof(string), "You removed %s's admin level.", PlayerName(id));
SendClientMessage(playerid, COLOR_BLUE, string);
PlayerInfo[id][pAdmin] = 0;
AdminKod[playerid][0] = EOS;
}
else
{
generateCode(code, 5);
format(string, sizeof(string), "%s promoted you to level %i.\nSecurity Code: %s", PlayerName(playerid), level, code);
ShowPlayerDialog(id, DIALOG_ADMINBOX, DIALOG_STYLE_MSGBOX, "You are an admin", string, "Ok", "");
format(string, sizeof(string), "You promoted %s to level %i.", PlayerName(id), level);
SendClientMessage(playerid, COLOR_BLUE, string);
PlayerInfo[id][pAdmin] = level;
format(AdminKod[playerid], 6, code);
}
return 1;
}
AdminKod[playerid][0] = EOS; |
warning 215: expression has no effect error 001: expected token: ";", but found "[" error 029: invalid expression, assumed zero warning 215: expression has no effect error 001: expected token: ";", but found "]" fatal error 107: too many error messages on one line |
AdminKod[MAX_PLAYERS];
AdminKod[MAX_PLAYERS][5];
CMD:makeadmin(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-4,"Only Klevis is allowed to use this command.");//Checking if the player is rcon admin to set an admin level
new id, level;//Creating the id variable to store the selected id and a level variable for the chosen admin level.
if(sscanf(params,"ui",id,level)) return SendClientMessage(playerid,-1,"USAGE: /makeadmin <id> <level>");//Check if the player inputted a username or id and a admin level.
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-4,"That player is not connected!");//Checking if the selected user is connected or not.
new file[64],PlayerName[24];//Creating a variable to store the file path, and a variable to store the players name.
GetPlayerName(id,PlayerName,sizeof PlayerName);//Retrieving the selected id's name,
format(file,sizeof file,"Admin/%s.ini",PlayerName);
if(!fexist(file)) return SendClientMessage(playerid,-4,"That player is not registered");//Checking if the player is not registered
INI_Open(file);//Opening the file with SII include
INI_WriteInt("Level",level);//Writing the line "Level" the selected admin level.
INI_Save();//Saving the file
INI_Close();//Closing the file
PInfo[id][Level] = level;
SendClientMessage(playerid,-1,"You have promoted to Admin.");
SendClientMessage(id,COLOR_PURPLE,"You've been made an Admin by Klevis, use /a to chat with other admins.");
return 1;
}