Ip Bans
#3

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
Reply


Messages In This Thread
Ip Bans - by DarkMythHunter - 25.05.2018, 17:39
Re: Ip Bans - by Logic_ - 25.05.2018, 17:51
Re: Ip Bans - by Mobtiesgangsa - 26.05.2018, 02:03
Re: Ip Bans - by GTLS - 26.05.2018, 06:33

Forum Jump:


Users browsing this thread: 1 Guest(s)