[XASECO] Plugin: Vote Manager 1.0.0 (UPDATE)

Discuss everything about Xymph's Aseco flavoured server control scripts for TM Forever / classic TMN and for TM² Canyon.

Moderators: Xymph, TM-Patrol

User avatar
L3cKy
smooth traffic navigator
smooth traffic navigator
Posts: 191
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: [XASECO] Plugin: Vote Manager 1.0.0 (UPDATE)

Post by L3cKy » 10 Feb 2019 14:34

UPDATE:

Open vote_manager.xml and add inside <messages> following line:

Code: Select all

<vote_rank>{#server}>$FA0You need a {#highlite}rank $FA0before you can use {#highlite}votes$FA0!</vote_rank>
---

Open plugin.vote_manager.php - search for "function vm_checkVotePossibility" and replace the whole function with this function:

Code: Select all

function vm_checkVotePossibility ($type, $login = false) {
	global $aseco, $vm_config, $rasp;
	
	$rank = $rasp->getRank($login);
	
	if ( in_array($login, $vm_config['Cache']['IgnoreLogin']) ) {
		// Login are on the <ignore_list>, skipping
		$aseco->console('[plugin.vote_manager.php] Skipping vote attempt from "'. $login .'" because player is in the <ignore_list>.');
		$message = formatText($vm_config['MESSAGES'][0]['VOTE_IGNORED'][0]);
		vm_sendChatmessage($message, $login);
		return false;
	}

	if ($rank == 'None') {
		vm_sendChatmessage($vm_config['MESSAGES'][0]['VOTE_RANK'][0], $login);
		return false;
	}

	if ( ($type == 'Restart') && ($vm_config['Cache']['LastMap']['Runs'] >= $vm_config['VOTING'][0]['MAX_RESTARTS'][0]) ) {
		// Max. restarts reached, cancel this request
		$message = formatText($vm_config['MESSAGES'][0]['VOTE_RESTART_LIMITED'][0],
			$vm_config['VOTING'][0]['MAX_RESTARTS'][0],
			(($vm_config['VOTING'][0]['MAX_RESTARTS'][0] == 1) ? '' : 's')
		);
		vm_sendChatmessage($message, $login);
		return false;
	}

	if ( ($type == 'Skip') && ($vm_config['Cache']['Todo']['onEndRace'] == 'Restart') ) {
		// There was a successfully restart vote before, cancel this skip request
		vm_sendChatmessage($vm_config['MESSAGES'][0]['VOTE_SKIP_CANCEL'][0], $login);
		return false;
	}

	if ($vm_config['RunningVote']['Active'] == true) {
		// There is already a running vote, cancel this request
		vm_sendChatmessage($vm_config['MESSAGES'][0]['VOTE_ALREADY_RUNNING'][0], $login);
		return false;
	}

	if ( ($aseco->server->gameinfo->mode == 1) && ($vm_config['TimeAttackTimelimit'] != -1) ) {
		if ($vm_config['TimeAttackTimelimit'] > (time() + $vm_config['VOTING'][0]['TIMEOUT_LIMIT'][0])) {
			return true;
		}
		else {
			vm_sendChatmessage($vm_config['MESSAGES'][0]['VOTE_TOO_LATE'][0], $login);
			return false;
		}
	}

	// All ok, go ahead
	return true;
}

NOTE: If you have done previous changings please change the next functions back to original. ;)

Code: Select all

function chat_next ($aseco, $command) {
	global $vm_config;

	if ( vm_checkVotePossibility('Skip', $command['author']->login)) {
		// Setup new vote
		vm_setupNewVote('Skip', $command['author']->login, $command['author']->nickname, $vm_config['MESSAGES'][0]['QUESTION_SKIP'][0]);
	}
}

Code: Select all

function chat_restart ($aseco, $command) {
	global $vm_config;


	if ( vm_checkVotePossibility('Restart', $command['author']->login)) {
	     // Setup new vote
	     vm_setupNewVote('Restart', $command['author']->login, $command['author']->nickname, $vm_config['MESSAGES'][0]['QUESTION_RESTART'][0]);
	}
}

NoTimeToDrive
sunday driver
sunday driver
Posts: 50
Joined: 31 Mar 2013 15:13
Owned TM-games: TMU TMUF

Re: [XASECO] Plugin: Vote Manager 1.0.0 (UPDATE)

Post by NoTimeToDrive » 11 Feb 2019 18:08

Thanks L3cKy for update :thumbsup:

Post Reply