25.10.2008, 12:12
PHP RCON Include
Here's an include for your PHP administration panel allowing you to parse RCON commands through PHP, all you need to do is to include this the file in "includes" to your code, as shown in the example code, and you're good to use the object.There are some checks inside the functions here, but however, I'm not able to determine whether filterscripts/gamemodes etc. exists on the game server, however, if you have your web server running on the same server as your sa-mp server, it isn't too hard to have a "file_exists" function added to the gamemode/FS change functions inside the object, but as it's very few having that benefit, I didn't see the reason to add it.
NOTE: This is not a working control panel of any kind, this is simply an include/SDK for web developers to be able to use RCON functions/commands inside their code easily.
Important note: All functions returns whatever RCON returned, so bare in mind that you can easily store the result in a variable and log or print it's output.
Function list
CRcon::GetCommandList(/* No params */)
CRcon::TerminateServer(/* No params */)
CRcon::SendRconAdminsMessage(/* String */ $sMessage)
CRcon::Kick(/* Integer */ $iPlayerID)
CRcon::Ban(/* Integer */ $iPlayerID)
CRcon::RconExec(/* String */ $sFilename)
CRcon::ChangeMode(/* String */ $sModeName)
CRcon::GameModeExit(/* No params */)
CRcon::Reloadlog(/* No params */)
CRcon::ReloadBans(/* No params */)
CRcon::SendMessage(/* String */ $sMessage)
CRcon::GetPlayerList(/* No params */)
CRcon::BanIP(/* String */ $sIP, /* Integer */ $iReloadBans = 1)
CRcon::UnbanIP(/* String */$sIP, /* Integer */$iReloadBans = 1)
CRcon::SetGravity(/* Float */ $fGravity)
CRcon::SetWeather(/* Integer */ $iWeatherID)
CRcon::LoadFS(/* String */ $sFScriptName)
CRcon::UnloadFS(/* String */ $sFScriptName)
(P.S. if you ever need to call CRcon::Raw($raw_command) you'll have to remove or replace the "private" flag on the function inside the object with either nothing or with "public".)
Download here!