SA-MP Forums Archive
Matching - 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: Matching (/showthread.php?tid=401671)



Matching - Test23 - 23.12.2012

Hi, I was wondering if there was a way to grab information from game and then see if it matches something which is located in a document?

For example, it should work like when you grab an IP and see if it's in a certain file.

For example if a player's IP is 127.0.0.1 when he joins the server it will grab his IP and search to see if it matches an IP in a document

Код:
if (strcmp(GetPlayerIP(playerid), [filelocation???] -  I don't know what to put here], true) {

Banex ("Your IP is on a ban list");

}
Could someone please help, thanks!


Re: Matching - Test23 - 23.12.2012

bump, anyone?


Re: Matching - Lynn - 23.12.2012

SAMP Automatically saves banned IP's to samp.ban and reads IPS that are saved to it.
However, yes you can save information and read it from a .cfg.
There is multiple ways to create the .cfg, and read from it.


Re: Matching - Test23 - 23.12.2012

Could you please tell me some ways?


Re: Matching - tyler12 - 23.12.2012

pawn Код:
stock IsBanned(ip[])
{
    new BigString[1234];
    new File:File = fopen("Bans.txt",io_read);
    while(fread(File,string))
    {
        if(strfind(string,ip))
        {
            printf("%s is banned.",ip);
        }
        else
        {
            printf("%s is not banned.",ip);
    }
    return 1;
}



Re: Matching - Test23 - 23.12.2012

I need to have it under OnPlayerConnect(playerid) that doesn't work for it


Re: Matching - tyler12 - 23.12.2012

public OnPlayerConnect(playerid)
{
new ip[33];
getplayerip(playerid,ip,33);
isbanned(ip);
return 1;
}


Re: Matching - Test23 - 23.12.2012

I tried something like
Код:
if(strcmp(IP, "127.0.0.1")) {


Ban(playerid);

}
There was no errors, but in game it can't match the IP the player gets with the one inputed there. I even Sent a client message on the IP string and it matched the IP that was there, but it still didn't ban. Do you know why it can't match them both?

The IP is the var which gets the IP from the user.


Re: Matching - Test23 - 23.12.2012

Does anyone know how to fix this? Thanks