Код:
//--------------------------------//
CMD:makeadmin(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-4,"Only server owner(s) are authorized 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: /setadmin <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("pAdmin", pAdmin);//Writing the line "Level" the selected admin level.
INI_Save();//Saving the file
INI_Close();//Closing the file
PInfo[id][pAdmin] = pAdmin;
SendClientMessage(playerid,-1,"You have made %s administrator.");
GetPlayerName(id,PlayerName,sizeof PlayerName);
SendClientMessage(id,-1,"You have been promoted to server administrator, read through /ahelp for all the admin commands.");
return 1;
}
//--------------------------------//
Thank you, it works.