13.06.2016, 21:40
Yup, I looked through that one already but I don't think that will let me call an actual function.
What I want to do is letting a bomb explode as soon as someone hits a button on my website. I have that working, but I have a timer running each second to check if a value in my database has changed. That means that I am running a select query every single second which I think is bad for the server performance.
This is the code:
Is there perhaps a way to do this without having to do a query every second? Or isn't this too bad performance wise?
What I want to do is letting a bomb explode as soon as someone hits a button on my website. I have that working, but I have a timer running each second to check if a value in my database has changed. That means that I am running a select query every single second which I think is bad for the server performance.
This is the code:
Code:
SetTimer("bomb", 1000, true); forward bomb(playerid); public bomb(playerid) { new query2[128], query[128], active; mysql_format(mysql, query, sizeof(query), "SELECT `active` FROM `explosions`"); mysql_query(mysql, query); if(cache_num_rows()) { active = cache_get_field_content_int(0, "active"); if(active == 1){ CreateExplosion(10, 10, 4, 12, 10.0); mysql_format(mysql, query2, sizeof(query), "UPDATE `explosions` SET `active` = 0"); mysql_query(mysql, query2); return 1; } } return 1; }