Code: Select all
<?php
/**
* FreeZone Chat-Fixulator v.chimichanga by -nocturne=-
* no license, no support -- use at your own risk
*/
Aseco::registerEvent('onStatusChangeTo4', 'do_Stuff');
Aseco::registerEvent('onPlayerConnect', 'playerConnect');
function do_Stuff ($aseco) {
global $aseco;
$aseco->client->query('GetPlayerList', 300, 0);
$players = $aseco->client->getResponse();
if ($aseco->client->isError()) {
trigger_error('[' . $aseco->client->getErrorCode() . '] ' . $aseco->client->getErrorMessage(), E_USER_WARNING);
} else {
foreach ($players as $pl) {
if (($pl['Flags'] % 10) > 0) {
$aseco->client->query('GetDetailedPlayerInfo', $pl['Login']);
$info = $aseco->client->getResponse();
if ($info['OnlineRights'] != 3) {
disableChat($pl['Login']);
}
}
}
}
}
function playerConnect ($aseco, $player) {
$login = $player->login;
$aseco->client->query('GetPlayerInfo', $login);
$pl = $aseco->client->getResponse();
if (($pl['Flags'] % 10) > 0) {
$aseco->client->query('GetDetailedPlayerInfo', $login);
$info = $aseco->client->getResponse();
if ($info['OnlineRights'] != 3) {
disableChat($login);
}
}
}
function disableChat ($login) {
global $aseco;
$xml = '<?xml version="1.0" encoding="UTF-8"?>';
$xml .= '<manialinks>';
$bla = getCustomUIBlock();
$xml .= str_replace('<chat visible="True"/>', '<chat visible="False"/>', $bla);
$xml .= '</manialinks>';
$aseco->client->query('SendDisplayManialinkPageToLogin', $login, $xml, 0, false);
}
?>
Edit: Updated to v.chimichanga