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



Ip Bans - DarkMythHunter - 25.05.2018

So as the title says? How should I make an ip ban thing? ipban and unban ip? And connect it to a current mysql database? Thanks! An example would be pretty helpful


Re: Ip Bans - Logic_ - 25.05.2018

You are basically requesting us a system, so no, we're not going to give it to you.

Use wildcards since you use SQL.


Re: Ip Bans - Mobtiesgangsa - 26.05.2018

The Requirements are:

MySQL by BlueG - MySQL R41-4
3rd Party WebServer for your pc - Download XAMPP
Basic Knowledge pawn - You must have it in your downloaded ZIP 0.3.7-r2


include:

Код:
#include <a_samp> first
#include <a_mysql> second
make a connection to your database:

Код:
#define MYSQL_HOST    "localhost" //by default
#define MYSQL_USER    "root" //by default
#define MYSQL_PASSWORD "" // default user does not has password
#define MYSQL_DATABASE "test" // its allready set by default
Код:
new MySQL:g_SQL; //this is MySQL tag & variable to connect to your webserver mysql
OnGameModeInit() if its for your gamemode
OnFilterScriptInit() if its for your filterscripts

Код:
public OnSomethingInit() // this is example
{
       new MySQLOpt:Option_Id = mysql_init_options(); // that depends what option you will set it
       mysql_set_option(Option_Id, SERVER_PORT, 3306); // lets say you set it for MySQL Default Port
       
       g_SQL = mysql_connect(.....); // Here goes your defines MYSQL_1, 2, 3, 4

       // than you check is your mysql open or closed by doing
       if(mysql_errno() != 0)
       {
              //print failed
       }
       else
       {
             //print success
       }

       // here you can create your table for your banned Ips depending on what you want to store
       return 1;
}
Код:
public OnSomeThingExit()
{
       mysql_close(g_SQL); // make sure you close your connection on gamemode exit or filterscript exit
       return 1;
}
----- Still adding info of help


Re: Ip Bans - GTLS - 26.05.2018

It was just one internet search and Look what I found - https://sampforum.blast.hk/showthread.php?tid=592669