Really nice plugin
But i found something out ... if you have normal or chat-based voting on you can anyway vote without paying
To prevent this go first into
/includes/rasp.settings.php enable chat-based voting and disable normal voting with:
Than go to
/plugins/plugin.rasp_votes.php and change:
(this disable the chat-command /replay)
Code: Select all
Aseco::addChatCommand('replay', 'Starts a vote to replay this track');
to
//Aseco::addChatCommand('replay', 'Starts a vote to replay this track');
Important: Non TMUF players cant vote for replay anymore.
--------
An solution can be that TMUF players must pay and non TMUF players dont.
If you want to do so you can use my fix. (
could not tested because i have no TMNF account ... but should work)
BUT be warned ... non TMUF player can now replay the track how often they want because this script have not the replay_limit from rasp included.
Code: Select all
<?php
/* ReplayCharge v1.0
*
* Plugin by Leigham. With thanks to Xymph, from whom I stole some code :)
*
* Important: This plugin will only work on a TMUF server.
* The server must have at least a small amount of coppers for
* the plugin to work.
*
* Scroll down to configure plugin settings.
*/
Aseco::registerEvent('onPlayerConnect', 'replaychargeOn');
Aseco::registerEvent('onNewChallenge', 'replaychargeOn');
Aseco::registerEvent('onEndRace', 'replaychargeOff');
Aseco::registerEvent('onPlayerManialinkPageAnswer', 'replaychargeClick');
Aseco::registerEvent('onBillUpdated', 'replaychargeBill');
global $position, $coppers, $replaybills;
// Configuration settings below
$position = '-63.8 -17.5 1'; // Position of the manialink. 'X Y Z'
$coppers = 85; // Copper cost to replay the track
// End of config
$replaybills = array();
function replaychargeOn($aseco) {
global $position, $coppers;
$xml = '<manialink id="1234512301">
<frame posn="'.$position.'">
<quad posn="0 0 0" sizen="23 5" style="BgsPlayerCard" substyle="BgCardSystem" action="234561"></quad>
<label posn="11.3 -2.4 1" sizen="23 5" halign="center" valign="center" textsize="2.5" textcolor="FFFF" text="Replay track!"></label>
</frame>
</manialink>';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}
function replaychargeSuccess($aseco) {
global $position;
$xml = '<manialink id="1234512301">
<frame posn="'.$position.'">
<quad posn="0 0 0" sizen="23 5" style="BgsPlayerCard" substyle="BgCardSystem"></quad>
<label posn="11.3 -2.4 1" sizen="23 5" halign="center" valign="center" textsize="2.5" textcolor="FFFF" text="Track is being replayed!"></label>
</frame>
</manialink>';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}
function replaychargeOff($aseco) {
$xml = '<manialink id="1234512301">
<frame posn="0 0 0">
<quad posn="0 0 0" sizen="0 0" halign="center" valign="center" action="234561"></quad>
</frame>
</manialink>';
$aseco->client->addCall('SendDisplayManialinkPage', array($xml, 0, false));
}
function replaychargeClick($aseco, $command) {
global $coppers, $replaybills;
$playerid = $command[0];
$login = $command[1];
$answer = $command[2].'';
$aseco->client->query('GetDetailedPlayerInfo', $login);
$player = $aseco->client->getResponse();
$nickname = $player['NickName'];
if ($answer == '234561') {
$aseco->client->query('GetCurrentChallengeInfo');
$thistrack = $aseco->client->getResponse();
$aseco->client->query('GetNextChallengeInfo');
$nexttrack = $aseco->client->getResponse();
// Check if already being replayed
if ($thistrack['FileName'] != $nexttrack['FileName']) {
// Check for TMF server
if ($aseco->server->getGame() == 'TMF') {
// check for TMUF server
if ($aseco->server->rights) {
// check for TMUF player
if ($player['OnlineRights'] == 3) {
// start the transaction
$message = 'You need to pay '.$coppers.' coppers to replay the track';
$aseco->client->query('SendBill', $login, $coppers, $message, '');
$replaybillid = $aseco->client->getResponse();
$replaybills[$replaybillid] = array($login, $nickname, $coppers, $thistrack);
} else {
//$message = formatText($aseco->getChatMessage('UNITED_ONLY'), 'account');
//$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
$aseco->client->query('ChooseNextChallenge', $thistrack);
$message = '$f90Player $z'.$nickname.'$z$f90 queues challenge for replay!';
$aseco->client->query('ChatSendServerMessage', $message);
}
} else {
$message = formatText($aseco->getChatMessage('UNITED_ONLY'), 'server');
$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
}
} else {
$message = $aseco->getChatMessage('FOREVER_ONLY');
$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
}
} else {
$message = '>$f00 This track is already being replayed';
$aseco->client->query('ChatSendServerMessageToLogin', $message, $login);
}
}
}
// [0]=BillId, [1]=State, [2]=StateName, [3]=TransactionId
function replaychargeBill($aseco, $replaybill) {
global $replaybills;
$replaybillid = $replaybill[0];
// check for known bill ID
if (array_key_exists($replaybillid, $replaybills)) {
// get bill info
$login = $replaybills[$replaybillid][0];
$nickname = $replaybills[$replaybillid][1];
$coppers = $replaybills[$replaybillid][2];
$thistrack = $replaybills[$replaybillid][3];
// check bill state
switch($replaybill[1]) {
case 4: // Payed (Paid)
$track = $thistrack['FileName'];
$message = '$f90Player $z'.$nickname.'$z$f90 pays '.$coppers.' coppers and queues challenge for replay!';
$aseco->client->query('ChooseNextChallenge', $track);
$aseco->client->query('ChatSendServerMessage', $message);
$aseco->console('Player {1} paid {2} coppers to replay the current track', $login, $coppers);
unset($replaybills[$replaybillid]);
replaychargeSuccess($aseco);
break;
case 5: // Refused
$message = '{#server}> {#error}Transaction refused!';
$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
unset($replaybills[$replaybillid]);
break;
case 6: // Error
$message = '{#server}> {#error}Transaction failed: {#highlite}$i ' . $replaybill[2];
if ($login != '')
$aseco->client->query('ChatSendServerMessageToLogin', $aseco->formatColors($message), $login);
else
$aseco->client->query('ChatSendServerMessage', $aseco->formatColors($message));
unset($replaybills[$replaybillid]);
break;
default: // CreatingTransaction/Issued/ValidatingPay(e)ment
break;
}
}
}
?>