-
Notifications
You must be signed in to change notification settings - Fork 6
Developer Guide
If you want to use the callbacks thrown by the script on the dedicated, you can use the function onModeScriptCallback($param1, $param2);
However, if you register your plugin with MLEPP, those callbacks (the ones standard included in the script provided by MLEPP) will be send you your plugin.
You can register your plugin by putting the following in your onLoad() function:
$this->callPublicMethod('MLEPP\Core', 'registerPlugin', 'PLUGINNAME', $this); (replace PLUGINNAME with your pluginname, leave out the author)
The following functions will be called if you register your plugin with MLEPP (you don't need to add them all in your class):
function mode_onBeginMap($mapname);
This function is called on the begin of the map and provides you with the mapname.
function mode_onEndMap($scores);
This function is called on the end of the map and provides you with the scores.
The scores are like this: login:score (f.e. them:85)
function mode_onBeginRound($mapname);
This function is called on the begin of a round and gives you the mapname.
function mode_onEndRound($mapname);
This function is called on the end of a round and gives you the mapname.
function mode_onPoleCapture($capturedby);
This function is called when the pole is captured (currently only in Royal) and gives you the login of the person who captured it.
function mode_onPlayerRespawn($login);
This function is called when someone respawns and gives you the login of that player.
function mode_onPlayerDeath($login, $shooter = null);
This function is called when someone died and gives you the login of the player who died.
It also gives you the login of the shooter, if the person was shot to death.
If the player died by the offzone, or something else, $shooter will be null.
function mode_onPlayerHit($victim, $shooter);
This function is called when someone hit someone else.
The person who was hit is $victim and the person who shot is $shooter.
sendCallbacks function (since ecae842286 / v0.2.2)
$this->callPublicMethod('MLEPP\Core', 'sendCallbacks', $callback, $param1 = null, $param2 = null, $param3 = null);
Start your $callback with 'mode_on' and then add what happens.
You can add up to three callbacks, which can be of all types you want.
Functions in other plugins (registered with MLEPP) can be called by using this function.
You can get the player information from the MLEPP database by using the following function:
$playerinfo = $this->callPublicMethod('MLEPP\Core', 'getPlayerInfo', $login);
This will return you an SQL-object including an entry out of the players table.
The Ranks plugin provides the server with an nice statistics plugin.
It registers kills, deaths, pole captures, points and gives the players a rank (according to the points).
You're able to get this rank by doing the following:
getRank function (till 014370d234 / v0.2.1)
$rankinfo = $this->callPublicMethod('MLEPP\Ranks', 'getRank', $login);
Using this in your plugin will return an array:
Array { 'score' => 85, 'rank' => 'Private' }
getRank function (since 41c5adabbd / v0.2.2)
$rankinfo = $this->callPublicMethod('MLEPP\Ranks', 'getRank', $login);
Using this in your plugin will return an array:
Array { 'score' => 85, 'rank' => 'Private', 'kills' => 12, 'deaths' => 4, 'killdeath' => 3.00, 'captures' => 1 }