26.12.2018, 15:10
(
Последний раз редактировалось StRaphael; 27.12.2018 в 20:34.
)
Hello, anyone knows how to optimize this script?
I mean can I make so the function check and affect only registred players who have variableX equal or higher than x? I mean I don't want to check 10000 users at a time, because that would get a lot of time to execute this loop... and function.
I am using BlueG's mysql plugin.
Any help will be highly appreciate!And Marry Christmas everyone!
PHP код:
mysql_query(SQL, "SELECT * FROM users");
mysql_store_result();
new totalregistred = mysql_num_rows();
mysql_free_result();
new Cache: cache, variable1, variable2, qstr[90];
for(new i=1;i<totalregistred; i++)
{
mysql_format(SQL, qstr, sizeof(qstr), "SELECT * FROM users WHERE `id` = '%d' AND `variableX` >= 1", i);
tut = mysql_query(SQL,qstr);
if(cache_get_row_count() > 0)
{
variable1 = cache_get_field_content_int(0, "variableY");
variable2 = cache_get_field_content_float(0, "variableZ");
if(variable1 >= x)
{
variable1 = variable2*10;
mysql_format(SQL, var, sizeof(var), "UPDATE `users` SET `variable2`='%d' WHERE `id`='%d'", variable1, i);
mysql_tquery(SQL,var,"","");
}
cache_delete(cache);
}
}
//************Read my last reply************\\
I am using BlueG's mysql plugin.
Any help will be highly appreciate!And Marry Christmas everyone!