Raised This Month: $ Target: $400
 0% 

Need help with sql and amxx.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
xd346
Junior Member
Join Date: Aug 2019
Old 08-26-2019 , 15:48   Re: Need help with sql and amxx.
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
That guide is outdated use sqlx include file, for more info about sqlx natives you can search for it...
Thanks for the reply, I've tried rewriting it and still get the same error.

Code:

PHP Code:
#include <amxmodx> 
#include <sqlx> 
#include <amxx\amxmod_compat\mysql> 
#include <esf> 
#include <ipci\ascend> 
#include <esf_util> 
#include <fun> 
#include <fakemeta> 
#include <fakemeta_const> 
#include <hamsandwich>  

new Handle:g_SqlTuple
new g_Error[512]
new 
ErrorCode,Handle:SqlConnection

public plugin_init()  

  
register_plugin("Database Data","1.0",""
  
register_clcmd("say steamid","plugintriggertest"); 
  
RegisterHam(Ham_Killed"player""fwdPlayerDeath"0);
  
g_SqlTuple=SQL_MakeDbTuple("127.0.0.1","root","","esf_data")
  
  
SqlConnectionSQL_Connect(g_SqlTuple,ErrorCode,g_Error,511)
  if(
SqlConnection == Empty_Handle)
        
set_fail_state(g_Error)


new 
steamid[32
new 
username[40
new 
powerlevel 
new charactername[32
new 
characterid  

public plugintriggertest(id

    
get_user_name(id,username,40
    
get_user_authididsteamid32
    
powerlevel=getClientPL(id); 
    
characterid=getClientCLASS(id); 
    
getClassDATAvcharacteridcxNamecharactername32 ); 
    
    new 
Handle:Query=SQL_PrepareQuery(SqlConnection,"INSERT INTO general_information (SteamID,Username,Character_1,Powerlevel_1) VALUES ('%s','%s','%s',%i);",steamid,username,charactername,powerlevel)
    
    if(!
SQL_Execute(Query))
    {
        
SQL_QueryError(Query,g_Error,511)
        
set_fail_state(g_Error)
    }
    
    
SQL_FreeHandle(Query)

Error:
PHP Code:
L 08/26/2019 21:45:54: [SQLITEInvalid database handle0
L 08
/26/2019 21:45:54: [AMXXDisplaying debug trace (plugin "DBContent.amxx")
L 08/26/2019 21:45:54: [AMXXRun time error 10native error (native "SQL_PrepareQuery")
L 08/26/2019 21:45:54: [AMXX]    [0DBContentSQLX.sma::plugintriggertest (line 42
xd346 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 17:25.


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