[HELP] /aunban What's Wrong?! - INI_RemoveEntry.
#1

pawn Код:
CMD:aunban(playerid,params[])
{
    new stringa[128], nomep[34];
    format(stringa,sizeof(stringa),"{FF0000}[SERVER]**{FFFFFF}You can't use this command, level so low or you aren't an admin");
    if(pinfo[playerid][adminlevel] < 4) return SendClientMessage(playerid,-1,stringa);
    format(stringa,sizeof(stringa),"{FF0000}[SERVER]**{FFFFFF}Use: /aunban [playername]");
    if(sscanf(params,"s[34]",nomep)) return SendClientMessage(playerid,-1,stringa);
    format(stringa,128,"utenti/%s.ini",nomep);
    if(fexist(stringa))
    {
        format(stringa,128,"utenti/%s.ini",nomep);
        new INI:file = INI_Open(stringa);
        INI_RemoveEntry(file,"bannato");
        INI_Close(file);
        format(stringa,128,"{FF0000}[SERVER]**{FFFFFF}You have unbanned the player: %s",nomep);
        SendClientMessage(playerid, -1, stringa);
    }
    else
    {
        format(stringa,128,"{FF0000}[SERVER]**{FFFFFF}This player don't exist in our database");
        SendClientMessage(playerid, -1, stringa);
    }
    return 1;
}
The field of the file of the player that i want unban, don't is deleted, why.?!
Reply
#2

just set the bannato to 0,and when he connects if it's 0 he wouldnt be banned and if 1 = banned...use:
pawn Код:
INI_WriteInt(stringa, "bannato", 0);
Reply
#3

Quote:
Originally Posted by XK
Посмотреть сообщение
just set the bannato to 0,and when he connects if it's 0 he wouldnt be banned and if 1 = banned...use:
pawn Код:
INI_WriteInt(stringa, "bannato", 0);
Not, because the field is already writed when the player disconnect, then in my .ini file this field is repeated two times..
Reply
#4

Nobody knows why this function don't works ?!

I have make it, for not create a new directory (like: bans).
Reply
#5

Get up to MySQL, it would be harder, better, faster, stronger (i'm kidding, but it would be really better for you to go up on mysql and for us to help u)
Reply
#6

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
Get up to MySQL, it would be harder, better, faster, stronger (i'm kidding, but it would be really better for you to go up on mysql and for us to help u)
I have experience with MySQL, and i can do it. But i have choise to read and to load INI files because it is faster and don't take much time, at my real work.

Thank you anyway for your off suggestion.
Reply
#7

Even if I did not know how ini works, because I've never used, when you get banned with Ban(Ex)();, the ip and other informations about the ban are located in a samp.ban file. If you get kicked just after connecting, take a look in this file.
Reply
#8

Quote:
Originally Posted by S4t3K
Посмотреть сообщение
Even if I did not know how ini works, because I've never used, when you get banned with Ban(Ex)();, the ip and other informations about the ban are located in a samp.ban file. If you get kicked just after connecting, take a look in this file.
I don't use function Ban() i use YSI INI instead of it, save and load a boolean variable for check if the player is banned or not.
Reply
#9

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
The code looks alright (apart from formatting "stringa" twice, you don't need to do that for the filename).

Place some prints such as the INI handle ID (it should be > -1) and return values of the INI functions. Run crashdetect to see if any code is breaking. Ensure your server executable has sufficient permissions to read/write files in that directory. Also, ensure you have the latest stable version of YSI (3.1 or 4.0)

Do some more testing with y_ini and ensure it's all working properly (in a filterscript with static filenames etc).
Thanks for your help, anyway i have solved creating another directory called bans, inside users directory.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)