Hello guys need a help with this script.
I will explain, I want the plugin to compare steamid the player in the mysql database if it is not registered is kick.
the original plugin does the same thing but in a file and I need q search the database.
someone help me?
sorry my english
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <sqlx>
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
new g_configsdir[64]
new steamid_db[64]
new const restrict_msg[] = "Desculpe, mas voce deve estar registrado para entrar no servidor!"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public plugin_cfg()
{
get_configsdir(g_configsdir, 63 )
format(steamid_db,63,"%s/steamid_db.ini",g_configsdir)
if(!file_exists(steamid_db))
write_file(steamid_db,"");
}
public client_connect(id)
{
if(is_steamid_in_file(id))
return 1;
else
server_cmd("kick #%i ^"%s^"",get_user_userid(id),restrict_msg)
return 1;
}
stock is_steamid_in_file(id) {
new file = fopen(steamid_db,"r")
new mauthid[30],pauthid[30]
get_user_authid(id,pauthid, 29)
if (!pauthid[0] )
return 0;
while (!feof(file))
{
fgets(file, mauthid, 19);
new len = strlen(pauthid);
if (equali(pauthid, mauthid, len))
{
fclose(file)
return 1;
}
}
fclose(file)
return 0;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
*/