Raised This Month: $ Target: $400
 0% 

SQLx problem... again.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-15-2011 , 14:37   SQLx problem... again.
Reply With Quote #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(PLUGINVERSIONAUTHOR)
    
    
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(HostUserPassDb)
}


    

public 
cmdHook(id)
{
    new 
authid[36]
    
get_user_authid(idauthid35)
    
    if(
equali(authid"STEAM_ID_PENDING"))
    {    
        
client_print(idprint_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
(1webid_cache9)
    
read_argv(2pass_cache127)
    
    if(!
webid_cache[0] || !pass_cache[0])
    {
        
client_print(idprint_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_cachebuffer1)
    
md5(buffer1buffer)
    
    
//client_print(id, print_console, "Vlozene: webid=%d, pass=%s, pass_md5=%s", webid, pass_cache, buffer)
    
    
format(g_SqlQuery511"SELECT user_id FROM fusion_users WHERE user_id=%d AND user_password='%s'"webidbuffer)
    
    
    
    new 
Data[2]
    
Data[0] = id
    Data
[1] = webid
    
    SQL_ThreadQuery
(g_SqlTuple"LoadHandle"g_SqlQueryData2)

    return 
PLUGIN_HANDLED
    
}

public 
LoadHandle(FailStateHandle:QueryError[], ErrcodeData[], 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(idauthid35)
        
        
format(g_SqlQuery511"INSERT INTO amx_fusionconnect VALUES ('%d', '%s') ON DUPLICATE KEY UPDATE id=%d, auth='%s'"webidauthidwebidauthid)

        
SQL_ThreadQuery(g_SqlTuple"DummyHandler"g_SqlQuery)
    
        
client_print(idprint_console"Nyni byl vas ucet propojen s webovym uctem. Spravovat jej muzete v uzivatelskem nastaveni na webu www.traxxzone.cz.")
    
    }
    else
        
client_print(idprint_console"Vlozili jste nespravna data. Prosim, zkontrolujte je.")
        
    return 
PLUGIN_HANDLED
    
}


public 
DummyHandler(FailStateHandle:QueryError[], ErrcodeData[], 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?
Backstabnoob is offline
minimiller
Veteran Member
Join Date: Aug 2007
Location: United Kingdom
Old 03-15-2011 , 16:49   Re: SQLx problem... again.
Reply With Quote #2

i used to get that alot
i gave up using sql.cfg in the end and just hard coded everything into the plugin
__________________
minimiller is offline
Send a message via MSN to minimiller
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2011 , 16:56   Re: SQLx problem... again.
Reply With Quote #3

It's because the sql.cfg file has not been executed yet.
Either create the tuple in plugin_cfg(), or force exec the config before you get the cvar values.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-16-2011 , 08:49   Re: SQLx problem... again.
Reply With Quote #4

Thank you, plugin_cfg() possibly works (at least it seems like that atm). I'll post again if there will be problems after deeper testing.

Thanks for help.
Backstabnoob is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode