SA-MP Forums Archive
Looping through .INI files - 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: Looping through .INI files (/showthread.php?tid=456035)



Looping through .INI files - Vanter - 04.08.2013

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?


Re: Looping through .INI files - Vanter - 05.08.2013

bump


Re: Looping through .INI files - Vanter - 05.08.2013

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