collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18365
  • stats Total Topics: 2500
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Guild Recruit  (Read 11078 times)

0 Members and 1 Guest are viewing this topic.

Offline alekseyvip

  • BeBot Rookie
  • *
  • Posts: 8
  • Karma: +0/-0
Guild Recruit
« on: April 14, 2010, 12:44:54 am »
Guys i have this module:
Code: [Select]
<?php
/*
* GuildInfo, by Kaeus
* This module helps people with guild recruitment.
*
* modifyed by Snyder for CRO guild on Crom server
*/
$GuildInfo = new GuildInfo($bot);

class 
GuildInfo extends BaseActiveModule {
private $recruitment_file 'D:/www/bebot/recruitment.php';
private $who_clicked = array();
private $spam_time 15;// minutes that spam protection is active
/*
constructor
*/
function __construct(&$bot) {
parent::__construct(&$botget_class($this));

$this->register_command('all''ginfo'"ANONYMOUS");

$this->bot->core("colors")->define_scheme("GI""highlight""yellow");
$this->bot->core("colors")->define_scheme("GI""normal""white");
$this->bot->core("colors")->define_scheme("GI""info""lightgreen");
$this->bot->core("colors")->define_scheme("GI""red""red");
$this->bot->core("colors")->define_scheme("GI""blue""blue");
/*
define classes and colors for recruitment
*/
$this->classes = array(
'sin' => 'Assasin',
'barb' => 'Barbarian',
'bs' => 'Bear Shaman',
'conq' => 'Conqueror',
'dt' => 'Dark Templar',
'demo' => 'Demonologist',
'guard' => 'Guardian',
'hox' => 'Herald of Xotli',
'necro' => 'Necromancer',
'pom' => 'Priest of Mitra',
'rang' => 'Ranger',
'tos' => 'Tempest of Set',
);
/*
you can pute more/less levels of recruitment
*/
$this->colors = array(
'none' => '#FFCC00',
'low' => '#FF0000',
'medium' => '#FF6600',
'high' => '#009900',
'ultrahigh' => '#005900',
);
// settings
$i 1;
$opt "";
// make options for settings
foreach ($this->colors as $k => $v) {$opt .= $k.";";unset($k$v);}
$opt eregi_replace(";$"""$opt);// remove last ; from options
// make settings loop
foreach ($this->classes as $short => $long) {
$this->bot->core("settings")->create("GuildInfo"$short"none"$long." requirement"$optfalse$i);
$i++;
}
unset($opt$i);
// help
$this->help['description'] = 'Helps with guild recruitment.';
$this->help['command']['ginfo'] = 'Displays guild\'s info tab.';
// officers
$this->officers = array(
// first is guild leader
'Airo',
// rest are officers
'Redangel',
'Snyder',
'Kovach',
'Biert',
'Matsocks',
'Molay',
'Xurlie',
);

}
/*

*/
function command_handler($name$msg$origin) {
// there is only one command
if (preg_match('/^ginfo/i'$msg$info)) {
// spam protection
if ($this->is_not_spam($name)) {
return $this->info($name);
}
}
else {
$this->bot->send_help($name);
}
}
   
/*
guild info stuff
*/
function info($name) {
// guild name
$txt "<font face='hyboriansmall' color='#FFFFFF'>CRO Guild</font>\n<font color=#000000>.<br></font>";
$txt .= "<font face='hyboriansmall' color='#FFFFFF'>http://www.cro-guild.com</font>\n<font color=#000000>.<br></font>";
// staff
$i 0;
foreach ($this->officers as $v) {
$online $this->find_officer($v);
$n $online[1];
$online $online[0];
// first one is guildleader
if (!$i) {$txt .= "##normal##Guild leader##end##\n";}
// rest are officers
else if ($i == 1) {$txt .= "##normal##Officers##end##\n";}
$txt .= "##GI_highlight##".$online['content']." :: <a href='chatcmd:///tell ".$n." Hey ".$n.", i would like some more info'>".$n."</a> ( ".$v." )##end##";
if ($v == $name) {$txt .= " - <font color='yellow'>posted recruitment info</font>";}
$txt .= "\n";
unset($v$online$n);
$i++;
}
// recruitment text from local file
// you can get one from your website if you really want...
$data file_exists($this->recruitment_file) ? file_get_contents($this->recruitment_file) : '';
$txt .= $data;
// loop to create requirement
foreach ($this->classes as $short => $long) {
$r $this->bot->core("settings")->get("GuildInfo"$short);// requirement for class
$txt .= "##normal##".$long.":##end## <font color='".$this->colors$r ]."'>[".$r."]</font>\n";
unset($short$long$r);
}
unset($data);
return $this->bot->core("tools")->make_blob("CRO Guild info"$txt);
}
/*
find officer
*/
public function find_officer($name) {
// query for officer, if hes not on any alts his main char will be shown ($name)
$query $this->bot->db->select("select o.nickname from #___online as o, #___alts as a where o.status_gc = '1' and ( (o.nickname = a.alt and a.main = '".$name."') or (o.nickname = a.main and a.alt = '".$name."') ) LIMIT 1");
if (!empty($query)) {
// just in case go with foreach loop, but there should be only one item in array
foreach ($query as $user) {
$name $user[0];
unset($user);
}
}
unset($query);
// online status on character $name
$online $this->bot->core("online")->get_online_state($name);
// return data array (online/offline, character name)
return array($online$name);
}
/*
spam protection agains wankers that click dozen times on link
*/
public function is_not_spam($name) {
// if name is in array, check if he clicked in last $this->spam_time minutes
if (isset($this->who_clicked$name ])) {
// name is in array, check if time char last time clicked is greater than time() - $this->spam_time
if ( $this->who_clicked$name ] > ( time() - $this->spam_time 60 ) ) {
return false;
}
}
$this->who_clicked$name ] = time();
return true;
}
}
?>
but i dont want see recruit class.
i want see GI Leader,Oficcers and want see him alts and online.
halp me but i noob in php.what need delete? :(

Offline Yite

  • BeBot Apprentice
  • ***
  • Posts: 152
  • Karma: +0/-0
    • Niflheim - Crom
Re: Guild Recruit
« Reply #1 on: April 14, 2010, 10:09:45 am »
put a /* at the start of line 128 and a */ at the end of line 132 (or just delete the lines)
Code: [Select]
/*      foreach ($this->classes as $short => $long) {
         $r = $this->bot->core("settings")->get("GuildInfo", $short);// requirement for class
         $txt .= "##normal##".$long.":##end## <font color='".$this->colors[ $r ]."'>[".$r."]</font>\n";
         unset($short, $long, $r);
      } */
-Yite [Crom]

Offline RooK80

  • BeBot Rookie
  • *
  • Posts: 2
  • Karma: +0/-0
Re: Guild Recruit
« Reply #2 on: June 22, 2010, 09:36:45 pm »
Does this script have somekinda timer? we have guildrecruitment script with /tell togbot !ginfo and it might work once and then it doesnt do anything? Help the noob please :)

Offline Redzan

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Guild Recruit
« Reply #3 on: June 30, 2010, 12:07:58 am »
Does this script have somekinda timer? we have guildrecruitment script with /tell togbot !ginfo and it might work once and then it doesnt do anything? Help the noob please :)

Right near the top is what you're looking for. You can change the value to X number of minutes. 15 is a bit long.
Code: [Select]
private $spam_time = 15;// minutes that spam protection is active[code]

Offline Spiff

  • BeBot Rookie
  • *
  • Posts: 1
  • Karma: +0/-0
Re: Guild Recruit
« Reply #4 on: July 02, 2010, 09:31:30 am »
Code: [Select]
private $recruitment_file = 'D:/www/bebot/recruitment.php';
Is this the file that contains what the bot sais?
Does anyone have an example how this file should look?

Spiff

Offline GaRoN

  • BeBot User
  • **
  • Posts: 31
  • Karma: +0/-0
Re: Guild Recruit
« Reply #5 on: July 02, 2010, 01:07:50 pm »

 

* Recent Posts
0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]


Bebot and Rasberry by bitnykk
[November 29, 2023, 11:04:14 pm ]

* Who's Online
  • Dot Guests: 313
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal