Raised This Month: $ Target: $400
 0% 

SQL_ConnectCustom for threaded MySQL


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
busy.orange
Member
Join Date: May 2009
Old 08-25-2009 , 13:32   Re: SQL_ConnectCustom for threaded MySQL
Reply With Quote #1

PHP Code:
new Handle:hDatabase INVALID_HANDLE;
 
StartSQL()
{
    
SQL_TConnect(GotDatabase);
}
 
public 
GotDatabase(Handle:ownerHandle:hndl, const String:error[], any:data)
{
    if (
hndl == INVALID_HANDLE)
    {
        
LogError("Database failure: %s"error);
    } else {
        
hDatabase hndl;
    }
}

CheckSteamID(userid, const String:auth[])
{
    
decl String:query[255];
    
Format(querysizeof(query), "SELECT userid FROM users WHERE steamid = '%s'"auth);
    
SQL_TQuery(hdatabaseT_CheckSteamIDqueryuserid)
}
 
public 
T_CheckSteamID(Handle:ownerHandle:hndl, const String:error[], any:data)
{
    new 
client;
 
    
/* Make sure the client didn't disconnect while the thread was running */
    
if ((client GetClientOfUserId(data)) == 0)
    {
        return;
    }
 
    if (
hndl == INVALID_HANDLE)
    {
        
LogError("Query failed! %s"error);
        
KickClient(client"Authorization failed");
    } else if (!
SQL_GetRowCount(hndl)) {
        
KickClient(client"You are not a member");
    }

I whant CheckSteamID in OnClientPostAdminCheck.
but i have problem:
How proces new players, when have no DB connection?
busy.orange 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 18:40.


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