ASECO2.x Plugin | Player join/leave message on chat

This forum is dedicated to the Aseco/Rasp 2 server records and control script by Flo and Assembler Maniac. Announcements and issues can be discussed in this forum.

Moderators: Flo, f*ckfish, Assembler Maniac, TM-Patrol

User avatar
daemon
sunday driver
sunday driver
Posts: 68
Joined: 09 Mar 2006 17:28
Location: México
Contact:

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by daemon » 12 Jun 2008 02:16

Yea it would be good to make it more formal and easy to customize, maybe when i finish this other music plugin hehe. :grmblz:
Image
It's the decisions you make, when you have no time to make them, that define who you are.

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by nocturne » 13 Jun 2008 19:47

Well... I have a similar version I made a while back for TMN that had a config for everything. I thought about updating it and popping it on here, but I didn't want to step on your toes... You can have it if you're interested (I'd just need to make it compatible, ie. use the sRank function, switch to zones instead of nations).

dedderek
pedestrian
pedestrian
Posts: 6
Joined: 18 Apr 2008 01:36
Owned TM-games: TMU, TMN, TMNF

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by dedderek » 15 Jun 2008 06:41

Can I suggest a single line addition to the top of the pconnect function

Code: Select all

if($this->Aseco->getUptime() < 5){ return; }
This code will check to see if aseco has started up within the last 5 seconds and if it has then will not show the player joined message.
I found on my server that it was annoying to see all these useless player join messages when aseco was starting up with players in the server.

Derek

nocturne
solid chaser
solid chaser
Posts: 1390
Joined: 08 Jun 2007 18:48
Owned TM-games: all
Contact:

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by nocturne » 16 Jun 2008 18:56

dedderek wrote:Can I suggest a single line addition to the top of the pconnect function

Code: Select all

if($this->Aseco->getUptime() < 5){ return; }
This code will check to see if aseco has started up within the last 5 seconds and if it has then will not show the player joined message.
I found on my server that it was annoying to see all these useless player join messages when aseco was starting up with players in the server.

Derek
Ah, thx for the tip! I was just using a boolean 'flag' using the onStartup and onSync events, but that's much cleaner...
:1

User avatar
daemon
sunday driver
sunday driver
Posts: 68
Joined: 09 Mar 2006 17:28
Location: México
Contact:

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by daemon » 17 Jun 2008 03:01

nocturne wrote:Well... I have a similar version I made a while back for TMN that had a config for everything. I thought about updating it and popping it on here, but I didn't want to step on your toes... You can have it if you're interested (I'd just need to make it compatible, ie. use the sRank function, switch to zones instead of nations).
No no no stepping in toes hehe, I'm sure its better than mine because all I did was almost copy paste, release it too! :D

Also with this version, when a player joins, sometimes the game freezes for a split second, it can be annoying when there's a lot of connections going on. Then again, I've noticed this behavior on servers running XASECO which is where I got most of the code from :oops:, what could it be mmm :grmblz: :P
Image
It's the decisions you make, when you have no time to make them, that define who you are.

Doudou
pedestrian
pedestrian
Posts: 10
Joined: 04 Jun 2008 08:01
Owned TM-games: TMNF

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by Doudou » 19 Jun 2008 07:52

Hi,

Regarding one of my post here, I modified your plugin to update the nation value of players. Here is the code :

Code: Select all

<?php

class JoinLeave extends Plugin {

        function pconnect($player)
        {
        #Doudou 20080617
        if($this->Aseco->getUptime() < 5){ return; }
        ##Doudou 20080617
                $this->Aseco->client->query('GetDetailedPlayerInfo', $player->login);   // Gets player array
                $PlayerDetailedInfo = $this->Aseco->client->getResponse();
                $path = $PlayerDetailedInfo['Path'];
                $zone = substr($path, strpos($path, '|')+1);                                                    // Gets full zone

                #Doudou 20080617
                $pos = strpos($zone, '|');
                if ($pos != false) {
                        $nation = strtoupper(substr($zone, 0, 3));
                }
                ##Doudou 20080617
                $rank = $PlayerDetailedInfo['LadderStats']['PlayerRankings']['0']['Ranking'];           // Gets Player Ladder Rank from player array
                $rank = str_replace(' ', '$n $m', number_format($rank, 0, ' ', ' '));
                #Doudou 20080617
                #$localrank = $this->sRank($player);
                $localrank = $this->sRank($player,$nation);
                ##Doudou 20080617
...
...
...
                #Doudou 20080617
        #function sRank($player) {                                                      // Gets player local rank from database
        function sRank($player,$nation) {                                                       // Gets player local rank from database and set country
                ##Doudou 20080617
                $mode = $this->Aseco->server->gameinfo->getMode();
                $pid = $this->Aseco->plugins['LocalDb']->dbGetPlayerId($player);
                $query = 'SELECT avg FROM rs_rank WHERE playerID=' . $pid . ' ORDER BY avg ASC';
                $res = mysql_query($query);
                #Doudou 20080617
                $query4 = 'UPDATE players SET Nation="'.$nation.'" WHERE id='.$pid;
                $res4 = mysql_query($query4);
                if (!$res4) {
                    echo 'Impossible d\'exécuter la requête : ' . mysql_error();
                }
                ##Doudou 20080617
...
...
...
?>
I'm not a developer so maybe the code is not really clean but it works (I had to change some flag name on "Stats for TMN Aseco + RASP"). Here a sample : http://tmnf.masked-gaming.com/?lang=ENG&page=players

Cheers, Doudou.

rez667
cyclist
cyclist
Posts: 41
Joined: 18 May 2008 18:37
Owned TM-games: nations, united

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by rez667 » 24 Jun 2008 14:12

this is the error im getting when i try and use your modified code.. I dunno, wtf im doing wrong.. nor do i care anymore.. but i thought you might wanna know if there is somethingwrong with yor code.. all that i found on that line is .....

Code: Select all

Parse error: syntax error, unexpected '.' in D:\Trackmania Server\ASECO NEW\ASEC
O 214\plugins\plugin.joinleavemod.php on line 111

Thx for the codeing.. all of you guys..

Rez

Doudou
pedestrian
pedestrian
Posts: 10
Joined: 04 Jun 2008 08:01
Owned TM-games: TMNF

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by Doudou » 01 Jul 2008 08:41

Can you give me the lines 110 to 112 please?

calsmurf2904
smooth traffic navigator
smooth traffic navigator
Posts: 199
Joined: 08 Jul 2008 15:23
Owned TM-games: TMNF,TMN
Location: Netherlands
Contact:

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by calsmurf2904 » 20 Jul 2008 14:09

i hope you don't mind but i edited it so that it shows if the player is a clanmember.... (that requires my clanmember plugin)

Code: Select all

<?php

class JoinLeave extends Plugin {

	function pconnect($player)
	{
            if($this->Aseco->getUptime() < 5){ return; }
		$this->Aseco->client->query('GetDetailedPlayerInfo', $player->login);	// Gets player array
		$PlayerDetailedInfo = $this->Aseco->client->getResponse();
		$path = $PlayerDetailedInfo['Path'];
		$zone = substr($path, strpos($path, '|')+1);							// Gets full zone									
		$rank = $PlayerDetailedInfo['LadderStats']['PlayerRankings']['0']['Ranking'];		// Gets Player Ladder Rank from player array
		$rank = str_replace(' ', '$n $m', number_format($rank, 0, ' ', ' '));
		$localrank = $this->sRank($player);
		if ($this->Aseco->isAdmin($player->login))  {	// Checks for admin privileges
			$adminornot = '[$0f3Admin]';
		}
		else {
			$adminornot = '';
		}
            $query = "SELECT * FROM clanmembers WHERE Login = '".$player->login."'";
            $response = mysql_query($query);
            if (mysql_num_rows($response)>0){
            $clanmemberornot = '[$0f3ClanMember]';
            }else{
            $clanmemberornot = '';
            }
		if ($localrank[0] == 0){						// Checks for valid WR and LR
			 if($rank == -1)
			 {
				 $message = stripFormatting($player->nickname).$adminornot.$clanmemberornot.' $39ffrom $fff'.$zone.' $39fconnected [WR: $fff NA $39f| LR: $fff NA$39f]';
			 }
			 else {
				 $message = stripFormatting($player->nickname).$adminornot.$clanmemberornot.' $39ffrom $fff'.$zone.' $39fconnected [WR: $fff'.$rank.' $39f| LR: $fff NA$39f]';
			 }
      	}
		else {
			$message = stripFormatting($player->nickname).$adminornot.$clanmemberornot.' $39ffrom $fff'.$zone.' $39fconnected [WR: $fff'.$rank.' $39f| LR: $fff'.$localrank[0].'/'.$localrank[1].'$39f]';
		}
		$this->Aseco->addCall('ChatSendServerMessage', array($message));	
	}  

	function pdisconnect($player)
	{
		$message = stripFormatting($player->nickname).' $39fdisconnected';
		$this->Aseco->addCall('ChatSendServerMessage', array($message));
	}  


	function sRank($player) {							// Gets player local rank from database
		$mode = $this->Aseco->server->gameinfo->getMode();
		$pid = $this->Aseco->plugins['LocalDb']->dbGetPlayerId($player);
		$query = 'SELECT avg FROM rs_rank WHERE playerID=' . $pid . ' ORDER BY avg ASC';
		$res = mysql_query($query);
		if (mysql_num_rows($res) > 0) {
			$row = mysql_fetch_array($res);
			$query2 = 'SELECT * FROM rs_rank WHERE avg>0 and avg <' . $row['avg'];
			$res2 = mysql_query($query2);
			$query3 = 'SELECT * FROM rs_rank';
			$res3 = mysql_query($query3);
			$message[0] = mysql_num_rows($res2)+1;
			$message[1] = mysql_num_rows($res3);
			mysql_free_result($res2);
			mysql_free_result($res3);
			return ($message);
		} else {
			$message[0] = 0;
			$message[1] = 0;
			return ($message);
		}
		mysql_free_result($res);
	}

}



$_PLUGIN = new JoinLeave();
$_PLUGIN->addEvent('onPlayerConnect', 'pconnect');
$_PLUGIN->addEvent('onPlayerDisconnect', 'pdisconnect');
$_PLUGIN->setAuthor('Lacho aka daemon');
$_PLUGIN->setVersion(0.1);
$_PLUGIN->setDescription('When a player joins or leaves, it displays the info on the chat (including Nation, World Rank and Local Rank)');
?>
I will post my clan plugin later this day
Image
Current Projects :
Aseco 2.x Dedimania plugin
Aseco 2.x Clan management Plugin
Servers :
LSR Race Server
Server Specs :
TmForever Server 2.11.16 05-08-08 (D-M-Y)
Xaseco 1.03 with FufiMenu and FufiWidgets

Sopy22
cyclist
cyclist
Posts: 41
Joined: 21 Jul 2008 22:54
Owned TM-games: TMNF,TMN,TMU
Location: Cluj-Napoca (Klausenburg) Romania

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by Sopy22 » 25 Aug 2008 13:28

calsmurf i installed your clanmember plugin and the modified joinleavemod to work with your clanmember plugin.

Can you add a feathure to show the name of the clan ?

calsmurf2904
smooth traffic navigator
smooth traffic navigator
Posts: 199
Joined: 08 Jul 2008 15:23
Owned TM-games: TMNF,TMN
Location: Netherlands
Contact:

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by calsmurf2904 » 26 Aug 2008 10:17

will work in on it later this day....mmm...need to setup test server because i use Xaseco now instead of Aseco XD
also where exactly do you want to see the clanname ?
Image
Current Projects :
Aseco 2.x Dedimania plugin
Aseco 2.x Clan management Plugin
Servers :
LSR Race Server
Server Specs :
TmForever Server 2.11.16 05-08-08 (D-M-Y)
Xaseco 1.03 with FufiMenu and FufiWidgets

Sopy22
cyclist
cyclist
Posts: 41
Joined: 21 Jul 2008 22:54
Owned TM-games: TMNF,TMN,TMU
Location: Cluj-Napoca (Klausenburg) Romania

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by Sopy22 » 26 Aug 2008 12:31

hmm when a player joins it says like this "XXXX [Admin][Clanmember] from ROmania WR 10233 ETC.

I want to see the clan name next to the clanmember or instead of the clanmember you can edit the code to appear the clanname

Later , good luck

sephiroth1395
pedestrian
pedestrian
Posts: 11
Joined: 26 May 2008 13:27
Owned TM-games: TMNF

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by sephiroth1395 » 29 Aug 2008 07:17

Link given in the first post doesn't seem to work... :(
Any mirroir available ?

glOOmyART
highway camper
highway camper
Posts: 4
Joined: 08 Feb 2008 16:26
Owned TM-games: TMN, TMU

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by glOOmyART » 17 May 2009 21:39

Link to the plugin does not work / is removed / wrong url /whatsover

who can provide a mirror?

virus
highway camper
highway camper
Posts: 2
Joined: 29 Aug 2009 09:54
Owned TM-games: tmuf

Re: ASECO2.x Plugin | Player join/leave message on chat

Post by virus » 29 Aug 2009 10:04

hi to all I am French and I have a problem I can not download your plugin is dead, can you put it back in a new one? thank you

Post Reply