24.02.2016, 03:49
Hello, I've spent a good amount of time rewriting this command through different ways but I still get the same result every time which is unknown command, am not sure if I am just tired and that the error is right infront of me or that it's something else.
Here's the command..
I open/close the file using the same way to ban offline player and it works fine.
Here's the command..
Код:
CMD:tempban(playerid, params[])
{
new id[24], days, reason[128], banner[128];
if(pInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_RED, "You're not authorized to use this command.");
if(sscanf( params, "s[24]is[128]", id, days, reason)) return SCM(playerid, -1, "USAGE: /tempban [player name] [days] [reason]");
new filestring[79], exp = gettime()+(60*60*24*days);
format(filestring, sizeof(filestring), "/Users/%s.ini", id);
if(!fexist(filestring)) return SCM(playerid, COLOR_RED, "This username doesnt exist! ");
else
{
new INI:File = INI_Open(filestring);
INI_SetTag(File, "User Data");
INI_WriteInt(File, "pBanned", 1);
INI_WriteInt(File, "pBannedExp",exp);
INI_Close(File);
}
format(banner, sizeof(banner), "You have banned %s from the server for %d days.", id, days);
SCM(playerid, COLOR_RED, banner);
format(banner, sizeof(banner), "%s has been temporarily banned by %s %s for %d days | Reason: %s", id, AdminRank(playerid), RemoveUnderScore(playerid), days, reason);
SCMToAll(COLOR_RED, banner);
return 1;
}

