Matching
#1

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!
Reply
#2

bump, anyone?
Reply
#3

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.
Reply
#4

Could you please tell me some ways?
Reply
#5

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;
}
Reply
#6

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

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

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.
Reply
#9

Does anyone know how to fix this? Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)