Calling function from PHP
#1

Hello all,

Is it possible to call a samp function in game as soon as I fill in something like a PHP form in my webbrowser?
I am using MySQL.
Reply
#2

Look into this: https://sampforum.blast.hk/showthread.php?tid=104299

I think you're able to call commands from the API, using: $rcon->Call("LocalFunction");
Reply
#3

Socket plugin.
Reply
#4

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:

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;
}
Is there perhaps a way to do this without having to do a query every second? Or isn't this too bad performance wise?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)