[XASECO] Plugin: Alternate Scoretable 0.9.2 (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
undef.de
Pit Crew
Pit Crew
Posts: 1323
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

Re: [XASECO] Plugin: Alternate Scoretable 0.9.1 (UPDATE)

Post by undef.de » 09 Oct 2013 18:48

Just wanna say: There is an update out there... see my first post.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm

User avatar
undef.de
Pit Crew
Pit Crew
Posts: 1323
Joined: 31 Aug 2009 18:38
Owned TM-games: TMF, TM2C/S/V, SM
Manialink(s): undef, tmkarma
Location: Germany
Contact:

Re: [XASECO] Plugin: Alternate Scoretable 0.9.1 (UPDATE)

Post by undef.de » 21 Jul 2016 16:15

Just wanna say: There is an update out there... see the related Site at my Lab.
Developer of various plugins for XAseco/XAseco2 and MPAseco,
like Records-Eyepiece, TM-Karma, Alternate Scoretable...
Visit my Lab: www.undef.name

Get it now:
» TM2 Valley
» TM2 Canyon
» TM2 Stadium
» SM Storm

User avatar
L3cKy
happy cruiser
happy cruiser
Posts: 163
Joined: 05 Sep 2007 13:55
Owned TM-games: TMUF
Location: Berlin
Contact:

Re: [XASECO] Plugin: Alternate Scoretable 0.8.8 (UPDATE)

Post by L3cKy » 08 Aug 2018 09:59

undef.de wrote:
29 Jun 2011 16:00
This problem i already know, but i can´t do anything to fix this. My Plugin just tell the TM-Client to display the Avatar, nothing magic. 8)
The TM-Client get confused with animated Avatars... i think it´s a bug in the TM-Client, maybe Nadeo reads here too and wanna fix this? :lovetm

Temporary Fix ^^: I use the "http://" tag instead of the tm protocol.
It works like a charm without any freezing avatars. ^^

What it does?
I just copy the local avatar to a web space and open it with a http instead of tmtp tag ...

ATTENTION: THIS IS A TEMPORARY FIX - DON'T USE IT IF YOU DON'T KNOW WHAT TO DO
(this one here works only with linux/ubuntu/Plesk 17 and with user rights who DONT have access to the httpdocs user/folders
on my server it is not possible to give rights to users/folders -.-)

Step 1:

Code: Select all

open the plugin.alternate_scoretable.php and search for every:

image="tmtp://'. $ast_config['PLAYERS'][$login]['avatar'] .'

and replace it into:

image="'. $ast_config['PLAYERS'][$login]['avatar'] .'"

Step 2:

Code: Select all

... search for the "function ast_onPlayerConnect" and look for the following line (inside the function)

$ast_config['PLAYERS'][$player->login]['avatar'] = $info['Avatar']['FileName'];

and comment this line out like this >

//$ast_config['PLAYERS'][$player->login]['avatar'] = $info['Avatar']['FileName'];

Step 3:

Code: Select all

 Add directly under this line (from Step 2) following code:
 
//$ast_config['PLAYERS'][$player->login]['avatar'] = $info['Avatar']['FileName']; 

#############################################################

NOTE: If you can handle user rights/permissions you can use "cp" instead of "ssh2"
If you dont know what iam writing about ... just dont go on XD

If you use linux/ubuntu with Plesk and cant also handle the user rights/permissions you maybe need to install "libssh2-php" (if u dont have it) before using "ssh2"

#############################################################


// NOTE: Take care about the Domain & Path`s replacements ... ;)


		// ssh2 connection
		$ssh2_host = 'localhost'; //ip of the web space
		$ssh2_user = 'user'; // user of the plesk web space / domain user
		$ssh2_pw = 'pass';
		$ssh2_port = '22';

		// original avatar path and filename
		$avatar_file = $info['Avatar']['FileName'];
		// we just want the avatar filename without the path
		$avatar = substr($avatar_file, 14);
		//  belongs to $checks
		$file_check = ''.$player->login.'_'.$avatar.'';
		// get the extension
		$avatar_extension = substr($avatar_file, -4);
		// url for checkup if file exists
		$checks = @fopen('http://DOMAIN/'.$file_check.'','r'); // and PATH

		// check if file exists > do to the new link
		if ($checks) {
			$newfile = 'http://DOMAIN/PATH/'.$file_check.''; // and PATH
			$ast_config['PLAYERS'][$player->login]['avatar'] = $newfile;

    	// if file not exists > create a copy
		} elseif (!$checks && $avatar_extension == '.bik') {

			// searching for all .bik files in the server cache folder
			foreach (glob('/PATH_TO_THE_SERVER/GameData/Cache/*.bik', GLOB_BRACE) as $filename) {
				$str = $filename;
				$str = str_replace(array('/PATH_TO_THE_SERVER/GameData/Cache/'),'',$str);
				$check = str_replace(array('Skins%5cAvatars%5c'),'',$str);
				$checker = substr($check, 33);

				// if we found some lets check if its the right one from the user and create the copy
				if ($avatar == $checker) {
					// create a new unique filename
					$file = ''.$player->login.'_'.$checker.'';
					// ssh2 connection ##### OR you use cp instead of ssh2
					$ssh2_connection = ssh2_connect($ssh2_host, $ssh2_port);
					ssh2_auth_password($ssh2_connection, $ssh2_user, $ssh2_pw);
					ssh2_scp_send($ssh2_connection, ''.$filename.'', '/var/www/vhosts/DOMAIN/httpdocs/PATH/'.$file.'', 0644);
					// unset connection
					unset($ssh2_connection);

					// file created lets do to the new link ## wont work anyway at the first time cause it needs a reconnect or a new challenge ... but just in case XD
					$newfile = 'http://DOMAIN/PATH/'.$file.'';
					$ast_config['PLAYERS'][$player->login]['avatar'] = $newfile;
				}
			}

		} else {
			// static avatars
			$ast_config['PLAYERS'][$player->login]['avatar'] = 'tmtp://'.$info['Avatar']['FileName'].'';
		}
		unset($checks);

Step 4: // we just check here if the avatar is already cached so we can copy it to the web space and provide the new link ... (so we dont need to reconnect before getting the new avatar/link) (same code like above)

Code: Select all

search for the "function ast_onNewChallenge" and add directly under this line

"if ( !$aseco->client->isError() ) {"

following code:

#############################################################

NOTE: If you can handle user rights/permissions you can use "cp" instead of "ssh2"
If you dont know what iam writing about ... just dont go on XD
If you use linux/ubuntu with Plesk and cant also handle the user rights/permissions you maybe need to install "libssh2-php" (if u dont have it) before using "ssh2"

#############################################################


// NOTE: Take care about the Domain & Path`s replacements ... ;)


		// ssh2 connection
		$ssh2_host = 'localhost'; //ip of the web space
		$ssh2_user = 'user'; // user of the plesk web space / domain user
		$ssh2_pw = 'pass';
		$ssh2_port = '22';

		// original avatar path and filename
		$avatar_file = $info['Avatar']['FileName'];
		// we just want the avatar filename without the path
		$avatar = substr($avatar_file, 14);
		//  belongs to $checks
		$file_check = ''.$player->login.'_'.$avatar.'';
		// get the extension
		$avatar_extension = substr($avatar_file, -4);
		// url for checkup if file exists
		$checks = @fopen('http://DOMAIN/'.$file_check.'','r'); // and PATH

		// check if file exists > do to the new link
		if ($checks) {
			$newfile = 'http://DOMAIN/PATH/'.$file_check.''; // and PATH
			$ast_config['PLAYERS'][$player->login]['avatar'] = $newfile;

    	// if file not exists > create a copy
		} elseif (!$checks && $avatar_extension == '.bik') {

			// searching for all .bik files in the server cache folder
			foreach (glob('/PATH_TO_THE_SERVER/GameData/Cache/*.bik', GLOB_BRACE) as $filename) {
				$str = $filename;
				$str = str_replace(array('/PATH_TO_THE_SERVER/GameData/Cache/'),'',$str);
				$check = str_replace(array('Skins%5cAvatars%5c'),'',$str);
				$checker = substr($check, 33);

				// if we found some lets check if its the right one from the user and create the copy
				if ($avatar == $checker) {
					// create a new unique filename
					$file = ''.$player->login.'_'.$checker.'';
					// ssh2 connection ##### OR you use cp instead of ssh2
					$ssh2_connection = ssh2_connect($ssh2_host, $ssh2_port);
					ssh2_auth_password($ssh2_connection, $ssh2_user, $ssh2_pw);
					ssh2_scp_send($ssh2_connection, ''.$filename.'', '/var/www/vhosts/DOMAIN/httpdocs/PATH/'.$file.'', 0644);
					// unset connection
					unset($ssh2_connection);

					// file created lets do to the new link
					$newfile = 'http://DOMAIN/PATH/'.$file.'';
					$ast_config['PLAYERS'][$player->login]['avatar'] = $newfile;
				}
			}

		} else {
			// static avatars
			$ast_config['PLAYERS'][$player->login]['avatar'] = 'tmtp://'.$info['Avatar']['FileName'].'';
		}
		unset($checks);

That should be all ...


PS: If you can provide a cleaner/better version of my crappy fix here ... we would be all happy ;)

Greetingws L3cKy

Post Reply