SA-MP Forums Archive
Y_INI RemoveEntry Issue - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Y_INI RemoveEntry Issue (/showthread.php?tid=286758)



Y_INI RemoveEntry Issue - Jafet_Macario - 30.09.2011

Any idea why this command won't remove the player's file from ...scriptfiles/jAdmin/Accounts ?
pawn Code:
YCMD:ban(params)
{
    if(help) return SCM(playerid, HELP,"[Ban] With this command you can ban a player");
    new id, name2[MAX_PLAYER_NAME], str[128], reason[35], file[30];
    if(sscanf(o,"us[35]", id, reason)) return SCM(playerid, GREY,"Syntax Error: /ban [PlayerName/ID] [Reason]");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, GREY,"This player is offline");
    GetPlayerName(id, name2, sizeof(name2));
    format(file,sizeof(file),"/jAdmin/Accounts/%s.ini",name2);
    new INI:File = INI_Open(file);
    INI_RemoveEntry(File, file);
    INI_Close(File);
    format(str, sizeof(str),"banip %s", GetIP(id));
    SendRconCommand(str);
    Ban(id);
    #if SAVE_LOGS == true
    DATE;
    format(str, sizeof(str),"%s has been banned for %s on date %d/%d/%d", name2, reason, y,m,d);
    BanLog(str);
    #endif
    return 1;
}



Re: Y_INI RemoveEntry Issue - Jafet_Macario - 30.09.2011

Is there any function I can remove the whole .ini file?


Re: Y_INI RemoveEntry Issue - Jafet_Macario - 30.09.2011

Quote:
Originally Posted by Y_Less
View Post
Yes - fremove!
Okay, I did this, but it still doesn't delete the file.
pawn Code:
YCMD:ban(params)
{
    if(help) return SCM(playerid, HELP,"[Ban] With this command you can ban a player");
    new id, name2[MAX_PLAYER_NAME], str[128], reason[35], file[30];
    if(sscanf(o,"us[35]", id, reason)) return SCM(playerid, GREY,"Syntax Error: /ban [PlayerName/ID] [Reason]");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, GREY,"This player is offline");
    GetPlayerName(id, name2, sizeof(name2));
    format(file,sizeof(file),"/jAdmin/Accounts/%s.ini",name2);
    fremove(file);
    format(str, sizeof(str),"banip %s", GetIP(id));
    SendRconCommand(str);
    Ban(id);
    #if SAVE_LOGS == true
    DATE;
    format(str, sizeof(str),"%s has been banned for %s on date %d/%d/%d", name2, reason, y,m,d);
    BanLog(str);
    #endif
    return 1;
}



Re: Y_INI RemoveEntry Issue - Jafet_Macario - 30.09.2011

Tried with "path" instead of "/path" but it still doesn't remove the file.