Back Reply to topic
Zullahn 
(started thread)
Blue-Ribbon Chicken 
Topics: 1
Posts: 1
Playing:  AoC
Ingame:  Zullahn
Years registered: * * * * * * * * * * * * * * * * *
Login message plugin Posted: Post 12:23 Wed - Aug 27, 2008

I'm working on a plugin script to give people who login to the game a news script (based on an extract from a mysql db).

The last part of it is no problem, but where do I call the script to make it activate when people logon the game? - it should be able to differentiate between guildmembers and "buddies". - of preferably check the names against a list.
Reply with quote


Chaly 
Offizier · Webmaster 
Topics: 404
Posts: 2107
Location: Bad Honnef
Playing:  Guildwars2 (Drakkar See)
Ingame:  Chaly Flavour
Years registered: * * * * * * * * * * * * * * * * * * * * * *
Posted: Post 06:33 Wed - Aug 27, 2008

in the buddy-dir ("plugins/buddy/welcome/index.php")

maybe you want to handle
- ppl that just switched off their afk flag => the same status as a login
- a levelup and a zonechange causes a "lookup" - as ragebot has no info whether this was a levelup (gratz plugin) or just a zonechange, he has to remove this buddy and add him again => the same status as a login

this is a mod from "plugins/buddy/guildstatus/index.php" that should do the work
Code:
<?php
global $guildmates,$guildmains,$BuddyUpdate;

/* Already loaded guildmates? If not we currently may logon and receive the status of every buddy */
if ($guildmates[0]&&$guildmates[$args["name"]])
{
   /*Do we have a state-change caused by a refresh?*/
   if ($BuddyUpdate[$args["name"]])
   {
      say("Welcomeplugin:: statuschange caused by a lookup and ignored",1);
   }
   /*Do we have a statuschange?*/
   elseif ($args["status"]!=$args["laststatus"])
   {
      /*Do we have status "logged on" and the last status wasn't "afk"*/
      if ($args["status"]==1 && $args["laststatus"]!=3)
      {
         /*start of welcome code*/
         send_private_tell( $args["name"] , " hi " );
      }
   }
} else {
   say("Welcomeplugin:: buddy isn't my guildmate",1);
}


you can also make use of the global $BuddySeen
Code:

         /*start of welcome code*/
         global $BuddySeen;
         if ( time() - $BuddySeen[ $args["name"]  ]["logon"] < 60 )
         {
            say("Welcomeplugin:: last logon was just ".( time() - $BuddySeen[ $args["name"]  ]["logon"] )." secs ago",1);
         } else {
            /* "spam sensitive" start of welcome code */
            send_private_tell( $args["name"] , " hi " );
         }
Reply with quote



_________________

Chalys Gimpnesstheory (2003) Die Theorie der expotentiellen Bullshits den Gimps bei gleichbleibendem Anteil produzieren.
Back Reply to topic