|
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
|

03-15-2011
, 14:37
SQLx problem... again.
|
#1
|
This is completely illogical. I've been creating plugins this way many times and never experienced this error before (happens only on some servers):
Code:
L 03/15/2011 - 18:33:33: [AMXX] Plugin ("propojeni.amxx") is setting itself as failed.
L 03/15/2011 - 18:33:33: [AMXX] Plugin says: Unknown database 'amx'
L 03/15/2011 - 18:33:33: [AMXX] Displaying debug trace (plugin "propojeni.amxx")
L 03/15/2011 - 18:33:33: [AMXX] Run time error 1: forced exit
L 03/15/2011 - 18:33:33: [AMXX] [0] propojeni.sma::LoadHandle (line 82)
That's pretty wrong. amx_sql_db cvar IS 'amxbans', but it somehow wants to take 'amx' only. Happens not always, only after some restarts.
The code is here:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <sqlx>
#define PLUGIN "Webacc connect"
#define VERSION "1.0"
#define AUTHOR "IdiotStrike"
new Handle:g_SqlTuple
new g_SqlQuery[512]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("webreg", "cmdHook", 0, "Pouziti: <ID na webu> <heslo> [napr: webreg 15 tomas2] ^nID na webu zjistite tak, ze se prihlasite a podivate se na horni listu pod citace. Tam jej najdete.")
new Host[64],User[64],Pass[64],Db[64]
get_cvar_string("amx_sql_host",Host,63)
get_cvar_string("amx_sql_user",User,63)
get_cvar_string("amx_sql_pass",Pass,63)
get_cvar_string("amx_sql_db",Db,63)
g_SqlTuple = SQL_MakeDbTuple(Host, User, Pass, Db)
}
public cmdHook(id)
{
new authid[36]
get_user_authid(id, authid, 35)
if(equali(authid, "STEAM_ID_PENDING"))
{
client_print(id, print_console, "Nebylo vam prirazeno steamID. Prikaz neuspesny.")
return PLUGIN_HANDLED
}
new buffer[34], buffer1[34]
new pass_cache[128]
new webid_cache[10]
new webid
read_argv(1, webid_cache, 9)
read_argv(2, pass_cache, 127)
if(!webid_cache[0] || !pass_cache[0])
{
client_print(id, print_console, "Pouziti: <ID na webu> <heslo> [napr: webreg 15 tomas2] ^nID na webu zjistite tak, ze se prihlasite a podivate se na horni listu pod citace. Tam jej najdete.")
return PLUGIN_HANDLED
}
remove_quotes(webid_cache)
webid = str_to_num(webid_cache)
remove_quotes(webid_cache)
md5(pass_cache, buffer1)
md5(buffer1, buffer)
//client_print(id, print_console, "Vlozene: webid=%d, pass=%s, pass_md5=%s", webid, pass_cache, buffer)
format(g_SqlQuery, 511, "SELECT user_id FROM fusion_users WHERE user_id=%d AND user_password='%s'", webid, buffer)
new Data[2]
Data[0] = id
Data[1] = webid
SQL_ThreadQuery(g_SqlTuple, "LoadHandle", g_SqlQuery, Data, 2)
return PLUGIN_HANDLED
}
public LoadHandle(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
return set_fail_state(Error)
else if(FailState == TQUERY_QUERY_FAILED)
return set_fail_state(Error)
if(Errcode)
return set_fail_state(Error)
new id = Data[0]
new webid = Data[1]
if(SQL_NumResults(Query) > 0)
{
new authid[36]
get_user_authid(id, authid, 35)
format(g_SqlQuery, 511, "INSERT INTO amx_fusionconnect VALUES ('%d', '%s') ON DUPLICATE KEY UPDATE id=%d, auth='%s'", webid, authid, webid, authid)
SQL_ThreadQuery(g_SqlTuple, "DummyHandler", g_SqlQuery)
client_print(id, print_console, "Nyni byl vas ucet propojen s webovym uctem. Spravovat jej muzete v uzivatelskem nastaveni na webu www.traxxzone.cz.")
}
else
client_print(id, print_console, "Vlozili jste nespravna data. Prosim, zkontrolujte je.")
return PLUGIN_HANDLED
}
public DummyHandler(FailState, Handle:Query, Error[], Errcode, Data[], DataSize)
{
if(FailState == TQUERY_CONNECT_FAILED)
return set_fail_state(Error)
else if(FailState == TQUERY_QUERY_FAILED)
return set_fail_state(Error)
if(Errcode)
return set_fail_state(Error)
return PLUGIN_CONTINUE
}
public plugin_end()
SQL_FreeHandle(g_SqlTuple)
Anybody knows what the hell is wrong?
|
|