AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [MySQL] Connecting to database time bug (https://forums.alliedmods.net/showthread.php?t=171075)

FEELiFE 11-01-2011 08:07

[MySQL] Connecting to database time bug
 
I have some kind of problem and I realised how it happens. So if the map changes and a user quit the server immediately after connect the his data becomes 0. (the mysql hasn't loaded the data yet, but the user quits and the server saves the data to 0) How can I prevent this "bug" or check if there is connection between the server and the MySQL database, so that I can prevent saving the zero information ?

Federley 11-01-2011 08:24

Re: [MySQL] Connecting to database time bug
 
What plugins do you use? Tell us more about what you use!

FEELiFE 11-01-2011 08:55

Re: [MySQL] Connecting to database time bug
 
Plugin which connects to the database to load and save some information.

I don't think this would be useful and I have already explained the problem in the first post.

Sylwester 11-01-2011 15:38

Re: [MySQL] Connecting to database time bug
 
It's not a fault of mysql. It's a problem with plugin. The solution is simple:
PHP Code:

new bool:g_loaded[33]

public 
load(id){
    if(
g_loaded[id])
        return 
//don't load again if loaded
    //code...
    
SQL_ThreadQuery(tuple"load_query_handler", ...)
}

public 
load_query_handler(...){
    
//code...
    
if( user_completely_loaded )
        
g_loaded[id] = true
}

public 
save(id){
    if(!
g_loaded[id])
        return 
//don't save if not loaded
    //code...
}

public 
client_connect(id){
    
g_loaded[id] = false 
}

public 
client_disconnect(id){
    
save(id)
    
g_loaded[id] = false



FEELiFE 11-01-2011 17:30

Re: [MySQL] Connecting to database time bug
 
Thank you! I think it works fine now :).


All times are GMT -4. The time now is 14:18.

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