This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Request: Events on website mesaged by bot on irc

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
B
BigSmoke
Voice
Posts: 3
Joined: Thu Mar 22, 2007 2:45 pm
Contact:

Request: Events on website mesaged by bot on irc

Post by BigSmoke »

Hello,

We have an Online maffia game and we want if someone dies the bot says on IRC: user bla has just got killed!

We already got something but its not good but its only the idea
hope you guys can help me
this is what we have: (This is maybe incorrect)

Code: Select all

set dbhost "bla" 
set dbuser "bla" 
set dbpass "bla" 
set dbname "bla" 

set db_handle [mysqlconnect -host $dbhost -user $dbuser -password $dbpass] 
mysqluse $db_handle $dbname 


set query [SELECT * FROM `[users]` WHERE `callonirc`='1' AND `deader`='1']

foreach result $query {    #$result = mysql_fetch_object($query) ;   in PHP

putquick "PRIVMSG #capone : $result->login has just died!"
}

If someone dies the row callonirc and deader will be updated to 1 and then the bot needs to say User: blaa has just died!

Thanks in Advance.
b
br00
Voice
Posts: 9
Joined: Mon Jun 19, 2006 8:09 am

Post by br00 »

i had a similar requirement, needed bot to say in irc when a certain procedure was called on a site, here's something i found to deal with it, edited and commented so you can hopefully make it fit

Code: Select all

// where you have some sql that 'kills' the user, set $username below as that user
$username = $arr['user']; //or whatever it's called, i'm sure you'll work it out

$bot['ip'] = "xxx.xxx.xxx.xxx"; // your bots ip
$bot['port'] = "xxxx"; // listen port set in the tcl below
$bot['botpasswd'] = "pass set in tcl script below"; // password set in the tcl below

$bot['botmsg'] = "$username just died";

$fp = fsockopen($bot['ip'], $bot['port'], $errno, $errstr, 40);
if($fp)
{
    fputs($fp, $bot['botpasswd'] . " " . $bot['botmsg'] . "\n");
    sleep(10);
    fclose($fp);
}
that code needs to go in the webpage after the query 'kills' the user, then when it happens it sends a msg to the bot


now here's the tcl to get the message...

Code: Select all

# following port must be open in your shell and same as set in the php
set listenport "someporthere"
# pass must be same as set in the php
set password "somepasswordhere"

listen $listenport script botlisten

proc botlisten {idx} {
    control $idx botlisten2
}

proc botlisten2 {idx args} {
	set chan "#channeltosendto"
    set args [join $args]
    set password1 [lindex [split $args] 0]
    set message [join [lrange [split $args] 1 end]]
	if {$message != ""} {
		putquick "PRIVMSG $chan :$message"
	}
}
hopefully that shouldn't need much tweaking to get working
Last edited by br00 on Mon Sep 24, 2007 2:47 pm, edited 1 time in total.
B
BigSmoke
Voice
Posts: 3
Joined: Thu Mar 22, 2007 2:45 pm
Contact:

Post by BigSmoke »

Thank you very very very much!

it worked man I am reallly happy thanks allot! I love you ^^

but one last question, how can I color that text?

or make it <b> </b>
Post Reply