05.03.2017, 22:52
Ok i making an offline ban system which works good the only issue is i want it not to edit the line which says "Banned = 1"(the blue arrow) in the player file, but instead of that it just creates another line saying "Banned = 1"(the red arrow) so the file would have two lines with "Banned = 1".
Код:
CMD:obanacc(playerid, params[])
{
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 4)
{
new Name,reason[100],year,month,day,hour,minute,second,file[100];
if(sscanf(params, "s[25]", Name,reason)) return SendClientMessage(playerid, error, "Usage: /Obanacc <Player Name> <Reason>");
format(file, 100, PATH, Name);
if (!fexist(file)) return SendClientMessage(playerid,error,"Error: This player doesn't have an account!");
CommandToAdmins(playerid,"obanacc");
getdate(year, month, day);
gettime(hour,minute,second);
new INI:ACCOUNT = INI_Open(file);
INI_WriteInt(ACCOUNT, "Banned", 1);
INI_Close(ACCOUNT);
format(astring, sizeof(astring),"Account '%s has been successfully banned!",Name);
SendClientMessage(playerid,-1,astring);
format(astring, sizeof(astring),"AdmCmd: Administrator '%s' has Banned Account '%s'",GetName(playerid),Name);
SendClientMessageToAll(red,astring);
format(astring,sizeof(astring),"[OBAN]: %s has banned account name %s.[Reason: %s] || [Date: %d/%d/%d at %d:%d:%d] ",GetName(playerid),Name,reason,day, month, year ,hour, minute, second);
WriteToLog(astring,"oBans");
return 1;
}
else return ShowMessage(playerid, error, 1);
}


