Looping through .INI files
#1

so I'm working on a ban system

in my server, onplayerdisconnect, I made it saves the IP, as IP. IP == ***.***.**.**
and also when banned, anti cheat banned, Banned == 1

I want it to loop through all offline INI files to check for the IP and Banned
for example
pawn Код:
if(PlayerInfo[playerid][pBanned] == 1)  //Kicks from server, that's for name ban


//for IP matching ban..
//I want it to loop through all offline members in the "PATH" and check for IP matching and IP in Y_INI files and if banned == 1

//I tried doing something bbut it didn't work, look
//under OnPlayerConnect



    new pIPp[16];
    //new file[60];
    GetPlayerIp(playerid, pIPp, sizeof(pIPp));
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        /*for(new i=0; i<MAX_PLAYERS; i++)
        {
           format(file,sizeof(file),"Users/%s.ini",i);
           if(fexist(file))
           {
             INI_ParseFile(UserPath(i), "LoadUser_%s", .bExtra = true, .extra = i);
             GetPlayerName(playerid,pname,sizeof(pname));
             if(pIPp[playerid] == PlayerInfo[i][pIP] && PlayerInfo[i][pBanned] == 1 && strcmp(UserPath(i),pname) == 0)
             {
               format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: Ban Evading]");
               SendClientMessage(playerid, COLOR_RED,string);
               new INI:File = INI_Open(UserPath(playerid));
               INI_WriteString(File,"Reason2","Ban Evading");
               INI_Close(File);
               SendClientMessage(playerid, COLOR_RED,"[BANNED] Your ban duration is now increased due to ban evading.");
               SetTimerEx("KickPlayer",1000,false,"i",playerid);
               return 1;
             }
           }
        }*/

        if(PlayerInfo[playerid][pBanned] == 1)
        {
          format(string,sizeof(string),"[BANNED] You are currently banned from the server. [Reason: %s]",PlayerInfo[playerid][pBanReason]);
          SendClientMessage(playerid, COLOR_RED,string);
          SendClientMessage(playerid, COLOR_RED,"[BANNED] Please Ban Appeal on our forums at www.website.net");
          SetTimerEx("KickPlayer",1000,false,"i",playerid);
          return 1;
        }
What do you think?
Reply
#2

bump
Reply
#3

I'd like to know what is the right format or way to do it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)