Raised This Month: $ Target: $400
 0% 

sql


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-05-2021 , 09:15   Re: sql
Reply With Quote #3

Quote:
Originally Posted by Dragos View Post
One thing that I saw as useless was this,

PHP Code:
set_task(0.1"MySql_Init"); 
You can simply call the function "MySql_Init()" without using set_task for every 0.10 seconds because that function will be automatically called when the plugin is loaded.

Using your method can supercharge the CPU of that database and crash it.
What is this nonsense?

Using a delay is not a bad idea, imagine alot of plugins connecting on plugin_init this will cause a bit server lag until all the data is processed.

How ever i saw some potential mistakes you might want to avoid

client_putinserver(id) forward is not guaranteed to be called after client_authorized(id) so you might want to do the following code in client_authorized(id) body because its guaranteed that steam id is ready to be retrieved.

PHP Code:
{
    new 
szQuery[512];
    new 
szData[1];

    
szData[0] = id;

    
formatex(szQuerycharsmax(szQuery), "SELECT * FROM `%s` WHERE `steamid` = '%s'"g_szTableg_PlayerData[id][STEAMID]);
    
SQL_ThreadQuery(g_SqlTuple"GetPoints"szQueryszData1);

Also you can you use static to initialize big arrays, for a better speed performance.


---------- optimization -------
PHP Code:
server_print(" ");
        
server_print("[%s] SQL ERROR: %s"szErrorg_szPluginName);
        
server_print(" "); 


PHP Code:
server_print("^n[%s] SQL ERROR: %s^n"szErrorg_szPluginName); 
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-05-2021 at 09:27.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
 



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 02:39.


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