m002.p
01-17-2009, 07:57 PM
Hello to everyone.
In a script ive coded, I want to pause within executing a set of commands, but I would rather it didnt php sleep(); as this obviously means the whole script is delayed then affecting the intervals it is executed using PHP code which runs the script every X seconds, in addition to 1 minute CRON.
The commands in question often refer to my MYSQL database of cheating players in a gameserver, and should the conditionals be met, actions are taken against the individuals.
The reason I need a pause is to warn a player before booting them so they can see why they were kicked from the server.
An example:
if ((strtolower($disresult['names']) == strtolower($player['name'])) && ($disresult['search'] == 'Exact'))
{
$boot = 'kick';
sleep(10); // Wait to ensure the player has connected to the server and may see the warning
admin_command();
sleep(10); // Pause while player sees reason for removal
admin_command();
}
I understand you could use MYSQL to check the time but that uses additional queries, so really the answer to my question could simply be "Not possible", but if anyone knows a better way of pausing without affecting the whole script I would appreciate it.
Matt
In a script ive coded, I want to pause within executing a set of commands, but I would rather it didnt php sleep(); as this obviously means the whole script is delayed then affecting the intervals it is executed using PHP code which runs the script every X seconds, in addition to 1 minute CRON.
The commands in question often refer to my MYSQL database of cheating players in a gameserver, and should the conditionals be met, actions are taken against the individuals.
The reason I need a pause is to warn a player before booting them so they can see why they were kicked from the server.
An example:
if ((strtolower($disresult['names']) == strtolower($player['name'])) && ($disresult['search'] == 'Exact'))
{
$boot = 'kick';
sleep(10); // Wait to ensure the player has connected to the server and may see the warning
admin_command();
sleep(10); // Pause while player sees reason for removal
admin_command();
}
I understand you could use MYSQL to check the time but that uses additional queries, so really the answer to my question could simply be "Not possible", but if anyone knows a better way of pausing without affecting the whole script I would appreciate it.
Matt