Saving a variable using Y_INI
#5

I don't know much about ZCMD, but i guess it's not such a big difference between them two.

This is how the command would look like: [you must have sscanf for it to work].

Код:
CMD:makeadmin(playerid,params[],help)
{
	new aLvl,pID,name[MAX_PLAYER_NAME],pString[64];
	if(uData[playerid][aLevel] != 6) return SendMsg(playerid,red,"You are not authorized to use this command !");//Ignore this, you may have a completely different admin system.
	if(help) return SendMsg(playerid,white,"Makes the targeted player an admin.");
	if(sscanf(params,"ud",pID,aLvl)) return SendMsg(playerid,yellow,"Use: /makeadmin <name/id> <admin level>");
	if(aLvl < 0 || aLvl > 7) return SendMsg(playerid,white,"The admin level must be between 0 and 7.");
	if(!IsPlayerConnected(pID)) return SendMsg(playerid,white,"This player is not connected.");
	GetPlayerName(pID,name,sizeof(name));
	format(pString,sizeof(pString),"/Users/%s.ini",name);
        new INI:uFile = INI_Open(pString));
	INI_WriteInt(uFile,"AdminLevel",aLvl);
	INI_Close(uFile);
        return 1;
}
EDIT: Forgot the return -.- .
Reply


Messages In This Thread
Saving a variable using Y_INI - by HazardGaming - 17.04.2012, 19:19
Re: Saving a variable using Y_INI - by KreeDz - 17.04.2012, 20:25
Re: Saving a variable using Y_INI - by HazardGaming - 17.04.2012, 20:42
Re: Saving a variable using Y_INI - by HazardGaming - 17.04.2012, 21:04
Re: Saving a variable using Y_INI - by KreeDz - 17.04.2012, 21:23
Re: Saving a variable using Y_INI - by HazardGaming - 17.04.2012, 21:26
Re: Saving a variable using Y_INI - by KreeDz - 17.04.2012, 21:31

Forum Jump:


Users browsing this thread: 1 Guest(s)