Raised This Month: $ Target: $400
 0% 

help with using sqlx


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
mamistikfistik
Junior Member
Join Date: Feb 2024
Old 02-09-2024 , 17:43   Re: help with using sqlx
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Not tested
PHP Code:

#include <amxmodx>
#include <sqlx>

new Handle:g_SQLTuple;

new 
g_szBuffer256 ];

public 
plugin_init() 
{
    new const 
szSteamID[] = "STEAM12345";
    
formatexg_szBuffer charsmaxg_szBuffer ) , "SELECT * FROM players WHERE steam_id = '%s';" szSteamID );
    
    
SQL_SetAffinity"sqlite" );
    
    
g_SQLTuple SQL_MakeDbTuple"host" "user" "pass" "DBName" );
    
    
SQL_ThreadQueryg_SQLTuple "SQLCallBack" g_szBuffer szSteamID sizeofszSteamID )  );
}

public 
SQLCallBack(FailStateHandle:QueryError[], Errcode, const Data[], DataSize)
{
    new 
szSteamID35 ];
    
    if ( !
Errcode )
    {
        if ( 
SQL_NumResultsQuery ) )
        {
            
SQL_ReadResultQuery szSteamID charsmaxszSteamID ) );
            
            
console_print"SteamID Found" );
        }
        else
        {
            
formatexg_szBuffer charsmaxg_szBuffer ) , "INSERT INTO players (steam_id) VALUES ('%s');" Data );
            
SQL_ThreadQueryg_SQLTuple "SQLCallBack" g_szBuffer );
            
            
console_print"SteamID Inserted" );
        }
    }

Can you show me how to use this in client_putinserver, I tried to try it myself but I guess it didn't work.
mamistikfistik 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 00:32.


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