06.06.2012, 17:57
hey got this from a tut :
i understand it fully but this is first time i have tried to save in dini file etc but have no clue how :/ any help?
pawn Код:
CMD:setadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-4]");//it will show this if you dont use the format properly
if(levels > 6) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-6!");//Available levels
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,-1,"That user is not connected.");//Detect if the id/partofname is connected
if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
if(levels == 0)
{
format(str, sizeof(str),"%s has your Admin level to %d on the server",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
PlayerData[ID][AdminLevel] = levels;//this sets the player level
return 1;
}
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
PlayerData[ID][AdminLevel] = levels;
return 1;
}