| BloodyNuker |
02-24-2006 18:22 |
Show if IP registered (mysql)
Hello I create a program, that register IP of the player and save in a database table contacts column first (This program i need, all people download from my web and execute, to play in the servers)(Is anti cheat)
I need the plugin show if the ip of player exist in the data base,(if ip donīt equali of anything ip in database, must kick player)
i make this but donīt work because i donīt know what must i put to show get_user_ip if equali to any ip from database, plz help! Tnkz! :D
Code:
#include <amxmodx>
#include <dbi>
new Sql:dbc
// Start of plugin
public plugin_init() {
register_plugin("IP player registered?","1.0","ACA")
register_cvar("amx_aca_host","server")
register_cvar("amx_aca_user","acc")
register_cvar("amx_aca_pass","password")
register_cvar("amx_aca_db","data base")
set_task(1.0,"start_sql")
}
public client_putinserver(id){
set_task(5.0,"show_ipdb")
set_task(1.0 , "show_ip" , id)
set_task(10.0, "client_verificacion", id, "b")
}
//Create a connection
public start_sql()
{
new host[32], username[32], password[32], dbname[32], error[32]
get_cvar_string("amx_aca_host",host,32)
get_cvar_string("amx_aca_user",username,32)
get_cvar_string("amx_aca_pass",password,32)
get_cvar_string("amx_aca_db",dbname,32)
dbc = dbi_connect(host,username,password,dbname,error,32)
if (dbc == SQL_FAILED)
{
server_print("[ACA] Could Not Connect To SQL Database^n")
}
else
{
server_print("[ACA] Connected To SQL, Have A Nice Day!^n")
}
//Show IP data base
public show_ipdb()
{
SELECT * FROM contacts WHERE first LIKE 'userip'
}
public client_verificacion(id)
{
if( !is_user_connected(id) ) { return PLUGIN_HANDLED; }
new name[32];
new password[64];
get_user_info(id, "model",password,63);
get_user_name( id , name , 31 );
if( equali(password,client_model_password) )
{
client_cmd(id,"echo ^"*** OK ***^"")
}
else
{
client_cmd(id,"echo ^"*** BAD ***^";disconnect")
client_cmd(id,"toggleconsole")
}
return PLUGIN_CONTINUE
}
//Show IP player
public show_ip(id)
{
get_user_ip(players[i],userip,16,1)
}
}
|