[Xaseco] AutoGreeter for lazy admins r1

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

Moderators: Xymph, TM-Patrol

Post Reply
reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

[Xaseco] AutoGreeter for lazy admins r1

Post by reaby » 04 Jun 2011 13:54

Hi,

heh, I got this crazy idea today of doing auto greeter for really lazy admins...

How it works?

1) when player comes to server, it finds admin on the server and picks the first one that it sees (kinda random)
2) an delay of 8 to 13 seconds is applied
3) then the greeter will show a normal chat message from the admin saying hi %player%

so not much to configure..

oh, if you sudden to be the only admin on server you will greet yourself.

Get it!
http://koti.mbnet.fi/reaby/xaseco/plugin.greeter.zip

User avatar
DjDesidera
tricycle manager
tricycle manager
Posts: 29
Joined: 19 Dec 2009 18:12
Owned TM-games: TMU
Location: Cloud 9
Contact:

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by DjDesidera » 04 Jun 2011 13:57

Small, but very clever, I run it now and so far its awesome.
I will never forget to greet anyone anymore ever :o)

BigUp to Reaby!!
TY
Image

TheBigG
smooth traffic navigator
smooth traffic navigator
Posts: 228
Joined: 16 Oct 2010 19:45
Owned TM-games: TMN! TMF
Location: Germany

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by TheBigG » 05 Jun 2011 06:27

hi reaby your plugin is great but it greets people who got kicked by ranklimit and greets yourself if nobody else is on that server

reaby
smooth traffic navigator
smooth traffic navigator
Posts: 213
Joined: 02 Jul 2009 21:24
Owned TM-games: TMUF

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by reaby » 05 Jun 2011 10:49

Yeah, it will greet each and everybody who triggers the onPlayerConnect dedicated server event. Looks like it is falsely triggered on cases like on ranklimit, might be also trigger when banned player tries to come to server. I'm not sure of this though. Anyway it's related to dedicated server, so it's not mine or xaseco's fault.

What comes to greeting yourself it can be fixed, but it's kinda funny in a way it's now.

Anyway this was just a crazy and hopefully fun idea for a new plugin and i made really fast like in 15 minutes :)

User avatar
Leigham
happy cruiser
happy cruiser
Posts: 139
Joined: 26 Mar 2011 01:04
Owned TM-games: TMUF, TMNF, TM²
Manialink(s): None

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by Leigham » 05 Jun 2011 23:15

Great plugin. Handy for people who are lazy like me :)

Made a couple of changes to it though, might be useful for other people too. Basically I changed it so you don't greet yourself and also so instead of a random admin, greetings come from MasterAdmins first, then an Admin if there aren't any MA's online, then the server.

Anyway here's the code:

Code: Select all

<?php
Aseco::registerEvent('onPlayerConnect', 'sg_onPlayerConnect');
Aseco::registerEvent('onEverySecond', 'sg_onTick');


global $sg_tick;
$sg_tick = array();

function sg_onPlayerConnect($aseco, $player) {
global $sg_tick;

$admin_array = array();
$greetee = $player;

	foreach($aseco->server->players->player_list as $admin) {
		if ($aseco->isMasterAdmin($admin) == true && $admin != $greetee) {
				$greeter = $admin->nickname;
				break;
		} else {
				array_push($admin_array, $admin);
				$greeter = false;
		}
		unset($admin);
	}
	if ($greeter == false){
		foreach($admin_array as $admin) {
			if ($aseco->isAdmin($admin) == true && $admin != $greetee) {			
				$greeter = $admin->nickname;
				break;
			} else {
					$greeter = $aseco->server->nickname;		
			}
		}
	} else { //do nothing
	}
		unset($admin);
		$sg_tick[$player->login] = array("player" => $player->nickname, "greeter" => $greeter, "delay" => (int)rand(8,13)); // edit these numbers to adjust delay
}


function sg_onTick($aseco) {
global $sg_tick;
	if (count($sg_tick) == 0 ) return;

	foreach ($sg_tick as $login => $data) {

		if ($data['delay'] >= 0) {
			$sg_tick[$login]['delay']--;
		} else {
			$message = '$ff0['.$data['greeter'].'$z$s$ff0] Hi '.$data['player'];   // edit this line when you want different greeting
			$aseco->client->query('ChatSendServerMessage', $message);
			unset($sg_tick[$login]);
		}

	}
}

?>
"Never surrender, sometimes retreat"

Image

Scottish Flat Trax servers

User avatar
sterretje22
road tourist
road tourist
Posts: 87
Joined: 29 May 2010 23:47
Owned TM-games: TMUF, TMNF, TM²
Manialink(s): fireteam
Location: Oudenburg(BE)
Contact:

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by sterretje22 » 13 Jun 2011 17:01

Thx I added the Update :)
`·.¸¸.->ѕтαя~ƒιяє<-.¸¸.·´
ImageImage
Image
`·.¸¸.->~ƒιяє~<-.¸¸.·´
Image

dukez30
sunday driver
sunday driver
Posts: 59
Joined: 23 Aug 2008 14:26
Owned TM-games: TMU

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by dukez30 » 05 Jul 2011 22:46

works good, but can it be changed to just Admins then Operators then server? :)

User avatar
Leigham
happy cruiser
happy cruiser
Posts: 139
Joined: 26 Mar 2011 01:04
Owned TM-games: TMUF, TMNF, TM²
Manialink(s): None

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by Leigham » 06 Jul 2011 19:24

Presumably. You should just be able to change line 16 from

Code: Select all

      if ($aseco->isMasterAdmin($admin) == true && $admin != $greetee) {
to

Code: Select all

      if ($aseco->isAnyAdmin($admin) == true && $admin != $greetee) {
and then change line 27 from

Code: Select all

         if ($aseco->isAdmin($admin) == true && $admin != $greetee) {
to

Code: Select all

         if ($aseco->isOperator($admin) == true && $admin != $greetee) {
Ought to work, but I haven't actually tried it. Also masteradmins will be counted as admins as well.
"Never surrender, sometimes retreat"

Image

Scottish Flat Trax servers

yamyam
happy cruiser
happy cruiser
Posts: 147
Joined: 15 Sep 2011 00:38
Owned TM-games: TM1 Vanilla,TMS,TM2C

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by yamyam » 11 Oct 2011 01:24

Why dont you just update this cool widget and add a config.xml so anybody can adjust those above mentioned settings on his own and like everyone wants it?

Request:
And if, please add some kind of auto-chatmessages so the admin can add some chat messages (i would need 3-5) in the config file which will be spamed in chat every x(config file) minutes (like news or something like that). This would be cool. :thumbsup: like automatic chat macros.
GermanINSOMNIAClan!
Multigaming Fun-Clan since 1998!
» www.I-N-S-O-M-N-I-A.de «

Visit one of our TM2-Clanservers or download the INSOMNIA TM2-Trackpack !
You may also visit us at our Mania-Exchange Clan-Profile.

User avatar
Leigham
happy cruiser
happy cruiser
Posts: 139
Joined: 26 Mar 2011 01:04
Owned TM-games: TMUF, TMNF, TM²
Manialink(s): None

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by Leigham » 11 Oct 2011 17:28

As i understand it this was only ever meant to be a cool script that people could use if they wanted, not a massive plugin.

Also the function you want can already be done by plugins like jfreu, which ships with xaseco anyway. Look in /includes/jfreu.config.php.
"Never surrender, sometimes retreat"

Image

Scottish Flat Trax servers

base
wheelbarrow operator
wheelbarrow operator
Posts: 22
Joined: 22 Apr 2010 13:33
Owned TM-games: united
Manialink(s): fun4u

Re: [Xaseco] AutoGreeter for lazy admins r1

Post by base » 07 Mar 2012 14:41

Is it possible to only get greeting from server for every body ?

Greetz Base :mrgreen:

Update : Solved it

Code: Select all

[code]<?php
Aseco::registerEvent('onPlayerConnect', 'sg_onPlayerConnect');
Aseco::registerEvent('onEverySecond', 'sg_onTick');


global $sg_tick;
$sg_tick = array();

function sg_onPlayerConnect($aseco, $player) {
global $sg_tick;

$admin_array = array();
$greetee = $player;

   foreach($aseco->server->players->player_list as $admin) {
      if ($aseco->isMasterAdmin($admin) == true && $admin != $greetee) {
               $greeter = $aseco->server->nickname;      
            break;
      } else {
            array_push($admin_array, $admin);
            $greeter = false;
      }
      unset($admin);
   }
   if ($greeter == false){
      foreach($admin_array as $admin) {
         if ($aseco->isAdmin($admin) == true && $admin != $greetee) {         
               $greeter = $aseco->server->nickname;      
            break;
         } else {
               $greeter = $aseco->server->nickname;      
         }
      }
   } else { //do nothing
   }
      unset($admin);
      $sg_tick[$player->login] = array("player" => $player->nickname, "greeter" => $greeter, "delay" => (int)rand(25,30)); // edit these numbers to adjust delay
}


function sg_onTick($aseco) {
global $sg_tick;
   if (count($sg_tick) == 0 ) return;

   foreach ($sg_tick as $login => $data) {

      if ($data['delay'] >= 0) {
         $sg_tick[$login]['delay']--;
      } else {
         $message = '$ff0['.$data['greeter'].'$z$s$fff] Welkom '.$data['player'];   // edit this line when you want different greeting
         $aseco->client->query('ChatSendServerMessage', $message);
         unset($sg_tick[$login]);
      }

   }
}

?>
[/code]

Post Reply