this plugin is obvious to how many players entered the server
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#include <special_geoip>
#define PLUGIN "Evidenta"
#define VERSION "1.1"
#define AUTHOR "Author"
#define szHost "ip"
#define szUser "name"
#define szPass "pass"
#define szDb "Db name"
new Handle:g_SqlTuple
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
g_SqlTuple = SQL_MakeDbTuple(szHost, szUser, szPass, szDb, 10)
}
public client_connect(id){
if(is_user_bot(id)){
server_cmd("kick #%d", id)
return PLUGIN_HANDLED
}
inregistrare(id)
static sql[256]
// --------------- Preluare IP -----------------
//new szIp[32];
//get_user_ip (id, szIp, charsmax(szIp), 1);
//new Country[32];
//geoip_country(szIp, Country, charsmax(Country));
//new country[33];
//new ip[32];
//get_user_ip( id, ip, charsmax( ip ));
//geoip_country( ip, country, charsmax( country ) );
static Name[64], ip[64], Country[64], City[64], AreaCode[64];
get_user_ip(id, ip, 63, 1);
get_user_name(id, Name, 63);
GeoipInfo(ip, GI_Country, Country, charsmax(Country));
GeoipInfo(ip, GI_City, City, 63);
GeoipInfo(ip, GI_CountryCode, AreaCode, charsmax(AreaCode));
// -------------- Preluare Data -----------------
static preluare_an[5],time_an;
static preluare_luna[3],time_luna;
static preluare_zi[3],time_zi;
static preluare_ora[3],time_ora;
static preluare_minute[3],time_minute;
static preluare_secunde[3],time_secunde;
get_time("%Y", preluare_an, 4);
get_time("%m", preluare_luna, 2);
get_time("%d", preluare_zi, 2);
get_time("%H", preluare_ora, 2);
get_time("%M", preluare_minute, 2);
get_time("%S", preluare_secunde, 2);
time_an = str_to_num(preluare_an);
time_luna = str_to_num(preluare_luna);
time_zi = str_to_num(preluare_zi);
time_ora = str_to_num(preluare_ora);
time_minute = str_to_num(preluare_minute);
time_secunde = str_to_num(preluare_secunde);
formatex(sql, charsmax(sql), "INSERT INTO `logs` (`name`, `country`, `timehour`, `timeyear`, `timemonth`, `timeday`, `timeminute`, `timesecound`, `ip`, `type`, `areacode`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%s', 'cs', '%s', '%s', '%s'); ",time_an, time_luna, time_zi, time_ora, time_minute, time_secunde, ip, Name, Country, AreaCode);
SQL_ThreadQuery(g_SqlTuple, "IgnoreHandle", sql)
return PLUGIN_CONTINUE
}
public IgnoreHandle(FailState, Handle:Query, szError[], Errcode)
{
QueryStatus(FailState, szError, Errcode)
new DataNum
while(SQL_MoreResults(Query))
{
DataNum = SQL_ReadResult(Query,0)
server_print("zomg, some data: %s",DataNum)
SQL_NextRow(Query)
}
SQL_FreeHandle(Query);
return PLUGIN_HANDLED;
}
public client_putinserver(id){
if(is_user_bot(id)){
server_cmd("kick #%d", id)
return PLUGIN_HANDLED
}
set_task(3.0, "inregistrare", id)
return PLUGIN_CONTINUE
}
public inregistrare(id){
return PLUGIN_CONTINUE
}
public QueryStatus(FailState, szError[], Errcode){
static szDate[32], error[512]
get_time("%d.%m.%y - %H:%M:%S", szDate, 31)
if(FailState == TQUERY_CONNECT_FAILED){
formatex(error, charsmax(error), "[MYSQL CONNECT ERROR] - [%s] - MySQL: %s | Errcode: %d^n", szDate, szError, Errcode)
write_file("addons/amxmodx/logs/mysql_log.log", error, -1)
server_print("A aparut o eroare ! Info in logs !")
}
else if(FailState == TQUERY_QUERY_FAILED){
formatex(error, charsmax(error), "[MYSQL QUERY ERROR] - [%s] - MySQL: %s | Errcode: %d^n", szDate, szError, Errcode)
write_file("addons/amxmodx/logs/mysql_log.log", error, -1)
server_print("A aparut o eroare ! Info in logs !")
}
else if(Errcode){
formatex(error, charsmax(error), "[MYSQL ERROR CODE] - [%s] - MySQL: %s | Errcode: %d^n", szDate, szError, Errcode)
write_file("addons/amxmodx/logs/mysql_log.log", error, -1)
server_print("A aparut o eroare ! Info in logs !")
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1033\\ f0\\ fs16 \n\\ par }
*/