Raised This Month: $ Target: $400
 0% 

Save User XP [ MYSQL ]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 06-04-2013 , 06:52   Re: Save User XP [ MYSQL ]
Reply With Quote #1

Free the connection and tuple only in plugin end and as the documentation threaded queryies do not require freeing the query. Also your code it's kinda bad writing and due to this bugs could occur.
Clauu is offline
hadesownage
AlliedModders Donor
Join Date: Jun 2013
Location: Romania, Iași
Old 06-04-2013 , 09:07   Re: Save User XP [ MYSQL ]
Reply With Quote #2

Xp is saved, the plugin is connected to mysql and the tabels is created.
But, sometimes.. the xp is not loaded, is 0, and the xp table is changed to 0 .

PHP Code:
public plugin_end( ) {
 
SQL_FreeHandleg_SqlTuple )
}

public 
client_connect(id)
{
    
get_user_nameidg_szNameid ], charsmaxg_szName[ ] ) )
    
set_task(1.5,"LoadData",id)
    
set_task(2.0,"LoadData",id)
    
set_task(1.5,"RemoveAll",id)
}

public 
client_disconnect id ) {
    
    
SaveData id );
    
RemoveAll id );

</b>

In client_disconnect is necessary to add get_user_name ?

Last edited by hadesownage; 06-04-2013 at 09:16.
hadesownage is offline
Send a message via Yahoo to hadesownage Send a message via Skype™ to hadesownage
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-04-2013 , 09:30   Re: Save User XP [ MYSQL ]
Reply With Quote #3

Quote:
Originally Posted by hadesownage View Post
Xp is saved, the plugin is connected to mysql and the tabels is created.
But, sometimes.. the xp is not loaded, is 0, and the xp table is changed to 0 .

PHP Code:
public plugin_end( ) {
 
SQL_FreeHandleg_SqlTuple )
}

public 
client_connect(id)
{
    
get_user_nameidg_szNameid ], charsmaxg_szName[ ] ) )
    
set_task(1.5,"LoadData",id)
    
set_task(2.0,"LoadData",id)
    
set_task(1.5,"RemoveAll",id)
}

public 
client_disconnect id ) {
    
    
SaveData id );
    
RemoveAll id );

</b>

In client_disconnect is necessary to add get_user_name ?
it's not needed, you can get client name only when he connects, you don't need to get his name when he disconnects.
TheDS1337 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 16:18.


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