| View previous topic :: View next topic |
| Author |
Message |
BigSmoke Voice
Joined: 22 Mar 2007 Posts: 3
|
Posted: Mon Sep 24, 2007 9:12 am Post subject: Request: Events on website mesaged by bot on irc |
|
|
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: |
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. |
|
| Back to top |
|
 |
br00 Voice
Joined: 19 Jun 2006 Posts: 9
|
Posted: Mon Sep 24, 2007 10:32 am Post subject: |
|
|
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: |
// 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: |
# 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 |
|
| Back to top |
|
 |
BigSmoke Voice
Joined: 22 Mar 2007 Posts: 3
|
Posted: Mon Sep 24, 2007 1:07 pm Post subject: |
|
|
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> |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|