21.05.2010, 20:31
Code:
private function Run($sCommand) { require('auth.php'); require('GetServer.php'); shell_exec('cd /var/www/sampservers/s1'); shell_exec('./samp02Xsvr'); shell_exec('cd'.GAME_DIRECTORY.''); shell_exec('nohup'.GAME_BIN_NAME.'&'); exec('nohup'.GAME_BIN_NAME.'&'); $sCommand = 'cmd /C '.$sCommand; $oShell = new COM("WScript.Shell"); $oShell->Run($sCommand, 0, false); $aTemp = array(); proc_close(proc_open('cd'.GAME_DIRECTORY.'nohup ./s1 &', array(), $aTemp)); return true; }
Code:
public function Start() { require('auth.php'); require('GetServer.php'); shell_exec('cd /var/www/sampservers/s1'); shell_exec('./samp02Xsvr'); shell_exec('cd'.GAME_DIRECTORY.''); shell_exec('nohup'.GAME_BIN_NAME.'&'); exec('nohup'.GAME_BIN_NAME.'&'); $this->Run('start /D "'.GAME_DIRECTORY.'" /B '.GAME_BIN_NAME); $aTemp = array(); proc_close(proc_open('cd'.GAME_DIRECTORY.'nohup ./s1 &', array(), $aTemp)); return true; }
Code:
public function Stop() { require('auth.php'); require('GetServer.php'); $this->Run('taskkill /F /IM '.GAME_BIN_NAME.' /T'); return true; }
Here's what I've got so far but it does not seem to start the server, it's a variation of Nitok's Starter code (http://forum.sa-mp.com/index.php?topic=138092.0) - I took the Windows version of the code and add bits into it to see if I could start SA-MP on a linux server but.. phail.
Any help...?