Raised This Month: $ Target: $400
 0% 

SQL_FreeHandle problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 10-18-2010 , 07:36   SQL_FreeHandle problem
Reply With Quote #1

Hey, why I'm getting this error in my logs:
PHP Code:
L 10/18/2010 15:24:26: [AMXXDisplaying debug trace (plugin "report.amxx")
L 10/18/2010 15:24:26: [AMXXRun time error 10native error (native "SQL_FreeHandle")
L 10/18/2010 15:24:26: [AMXX]    [0report.sma::plugin_end (line 111
here is the plugin code:

PHP Code:
#include <amxmodx>
#include <sqlx>


#define PLUGINNAME    "Report system"
#define VERSION        "1.0"
#define AUTHOR        "addinol"
#define table           "amx_report_log"

new Handle:g_SqlX
new Handle:g_SqlConnection
new g_error[512]

new 
bool:alreadyreported[33] = false;

public 
plugin_init()
{
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)

    
register_clcmd("say""hook_say")
    
register_clcmd("say_team""hook_say")
    
set_task(0.1"check_sql")
    return 
PLUGIN_CONTINUE 
}

public 
check_sql()
{

    new 
host[64], user[64], pass[64], db[64],errorcode

    get_cvar_string
("amx_sql_host"host63)
    
get_cvar_string("amx_sql_user"user63)
    
get_cvar_string("amx_sql_pass"pass63)
    
get_cvar_string("amx_sql_db"db63)

    
g_SqlX SQL_MakeDbTuple(hostuserpassdb)
    
g_SqlConnection SQL_Connect(g_SqlX,errorcode,g_error,511);
  
    if (!
g_SqlConnection) {
        return 
log_amx("Chat log SQL: Could not connect to SQL database.")
    }
    
    new 
query_create[1001]
    
format(query_create,1000,"CREATE TABLE IF NOT EXISTS `%s`(`id` int(11) NOT NULL auto_increment,`name` varchar(100) NOT NULL default '',`authid` varchar(100) NOT NULL default '',`ip` varchar(100) NOT NULL default ''`date` date NOT NULL default '0000-00-00',`time` time NOT NULL default '00:00:00', `message` text NOT NULL,PRIMARY KEY  (`id`));",table)
    
SQL_ThreadQuery(g_SqlX,"QueryHandle",query_create)
    
    return 
PLUGIN_CONTINUE 
}

public 
hook_say(id
{
    if(
is_user_bot(id)){
    return 
PLUGIN_CONTINUE;
    }
    
    static 
datestr[11]
    new 
authid[16],name[32],ip[16],timestr[9]
    new 
cmd[9
    
    if(!
is_user_connected(id)){
    return 
PLUGIN_CONTINUE;
    }
    
    
read_argv(0,cmd,8
    
    new 
message[192
    
read_args(message,191)
    
remove_quotes(message)
    if(
containi(message"/report")){
        if(
alreadyreported[id]){
        
client_print(idprint_chat"Reportinti galima tik kas 5 minutes")
    }else{
        
get_user_authid(id,authid,15)  
        
get_user_name(id,name,31)
        
get_user_ip(idip151)
         
        
get_time("%Y.%m.%d"datestr10)
        
get_time("%H:%M:%S"timestr8)
    
        new 
query[1001]
        
format(query,1000,"INSERT into %s (name,authid,ip,date,time,message) values ('%s','%s','%s','%s','%s','%s')",table,name,authid,ip,datestr,timestr,message
        
SQL_ThreadQuery(g_SqlX,"QueryHandle",query)
        
alreadyreported[id] = true;
        
set_task(300.0"report0"id)
    }
    return 
PLUGIN_HANDLED_MAIN;
    }
    return 
PLUGIN_HANDLED;


public 
report0(id){
    
alreadyreported[id] = false;
}

public 
QueryHandle(FailState,Handle:Query,Error[],Errcode,Data[],DataSize)
{
    if(
FailState == TQUERY_CONNECT_FAILED)
    return 
log_amx("Chat log SQL: Could not connect to SQL database.")
    
    else if(
FailState == TQUERY_QUERY_FAILED)
        return 
log_amx("Chat log SQL: Query failed")
        
    if(
Errcode)
        return 
log_amx("Chat log SQL: Error on query: %s",Error)
    
    return 
PLUGIN_CONTINUE
}

public 
plugin_end() 

    
SQL_FreeHandle(g_SqlConnection)
    return;

reinert is offline
 



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 10:25.


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