Offline ban
#5

I can show you how i would do it.

In this Example i use dini and sscanf

Код:
CMD:oban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
		return 1;
	}
 	if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
  	{
   		SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
		return 1;
	}
	
	new username[24],reason[64],string[128];
	if(sscanf(params,"s[24]s[64]",username,reason)) return SendClientMessage(playerid,COLOR_GRAD1,"Useage: /oban username reason");
	if(doesAccountExist(username))
	{
	    new UserFile[24];
		format(UserFile,sizeof(UserFile),"/Account/%s.ini",username);
		dini_IntSet(UserFile,"Ban",1);
		format(string,sizeof(string),"User %s was banned from this Server",username);
		SendClientMessageToAll(COLOR_WHITE,string);
	}
	
	return 1;
}

stock doesAccountExist(user[])
{
	new UserFile[24];
	format(UserFile,sizeof(UserFile),"/Account/%s.ini",user);
	if(dini_Exists(UserFile)) return 1;
	return 0;
}
Reply


Messages In This Thread
Offline ban - by marwanalramahi - 09.03.2014, 15:58
Re: Offline ban - by ChristianIvann09 - 09.03.2014, 16:09
Re: Offline ban - by marwanalramahi - 09.03.2014, 16:19
Re: Offline ban - by marwanalramahi - 10.03.2014, 11:36
AW: Offline ban - by blackfire49 - 10.03.2014, 16:10

Forum Jump:


Users browsing this thread: 3 Guest(s)