Raised This Month: $ Target: $400
 0% 

Solved [MySQL] Return function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 01-09-2022 , 10:20   Re: [MySQL] Return function
Reply With Quote #5

Quote:
Originally Posted by wilian159 View Post
so there's no way to do what I want?


does this make no sense here?

PHP Code:
new VarTest

public SqlGetUserIndex(id)
{
    
SQL_ThreadQuery(handle"_SqlGetUserIndex""SELECT id FROM users WHERE authid = 'STEAM_XXXXXXXX'")

    return 
VarTest
}

public 
_SqlGetUserIndex(fail_stateHandle:queryerror[], error_codedata[], data_size)
{
    
// check fails, etc....

    
if(SQL_NumResults(query))
    {
        
VarTest SQL_ReadResult(xQuery0)
    }
    else
    {
        
VarTest = -1
    
}

Yes, there is a way, using SQL_Execute. HamletEagle explained the difference between this and SQL_ThreadQuery.

No, it won't work, because the callback is executed after the SqlGetUserIndex() function ends. Test it by yourself by adding debug messages.

PHP Code:
new VarTest

public SqlGetUserIndex(id)
{
    
SQL_ThreadQuery(handle"_SqlGetUserIndex""SELECT id FROM users WHERE authid = 'STEAM_XXXXXXXX'")
    
server_print("SqlGetUserIndex() function")

    return 
VarTest
}

public 
_SqlGetUserIndex(fail_stateHandle:queryerror[], error_codedata[], data_size)
{
    
// check fails, etc....

    
if(SQL_NumResults(query))
    {
        
VarTest SQL_ReadResult(xQuery0)
    }
    else
    {
        
VarTest = -1
    
}

    
server_print("_SqlGetUserIndex() function")

__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi 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 11:44.


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