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.

vwar script i found

Support & discussion of released scripts, and announcements of new releases.
Post Reply
j
jackoooo
Voice
Posts: 3
Joined: Wed Jan 11, 2006 5:09 pm
Location: manchester

vwar script i found

Post by jackoooo »

found this script but can some one tell me what kind of shell i need to run this script i have a eggdrop bot running thats about as much as i can do just need some help or direction if poss here is the post from vwar forum ado i need sql on my shell? and mysqltcl on it aswell? for this script to run if so can you tell me who does this kind of hosting pls

OK, new version. This checks a players name on the !avail etc against the vwar site.
In order for it to work, you need to add a profilefield for the players ingame name.

Our players are listed with the clan tags in the profilefields, so there's a new variable called clantag. When a player sets available, they don't need to do !avail <matchid> |NM|fatgit, just !avail <matchid> fatgit

If you dont want the script to automatically append a tag, set the clantag variable to "" and it should be OK.

The script now does signups for any match where you know the ID number. !list now displays the Match ID number.

By default, !list and !players will list to a NOTICE to you. If you wish them to list to a channel, simply do !list channel or !notice channel

Im still using some of Obscur3's MYSQL for the listing and finding next matches.

Code: Select all


#########################################################################
#########################################################################
###########################vWarbot 1.0###################################
# Based on an original script called vWar2topic                         # 
# by Obscur3 on irc://irc.quakenet.org #d3i                             #
# Thanks to Obscur3 for allowing me to modify his code, although it     #
# basically got rewritten for my clans needs.                           #
# Original thread http://www.vwar1_de/ib/index.php?showtopic=7688        #
# #######################################################################
#                                                                       #
# vWarbot will run on either windows or linux eggdrops. It requires     #
# mysqltcl to be installed ( http://www.xdobry.de/mysqltcl/ ) - if you  #
# have problems getting mysqtcl to work on windows, extract pkgIndex    #
# and the dll's into your eggdrop/scripts dir, and edit pkgIndex.tcl    #
# to read something like :                                              #
# proc loadmysqltcl { c:/eggdrop/scripts } {                            #
# set oldcwd [pwd]                                                      #
# cd c:/eggdrop/scripts                                                 #
# load libmysqltcl[info sharedlibextension]                             #
# cd $oldcwd                                                            #
# }                                                                     #
# Obviously, change c:/eggdrop/scripts to match your scripts dir :P     #
# In addition, if the botis NOT running on the same server as vwar you  #
# MUST make sure that the database is remotely accessible by the user.  #
#                                                                       #
# Unlike vWar2topic, this bot uses notices and channel messages rather  #
# than setting a topic.                                                 #
# This bot will allow you to list the next 5 matches, and set a players #
# availability. As the bot reads and writes directly to your MYSQL      #
# database, it should always be up-to-date.                             #
#                                                                       #
#########################################################################
# make sure mysqltcl is installed
package require mysqltcl

##########################################################################
##########################Configuration###################################
##########################################################################

global v2t_TS_IP
global v2t_CLAN_IP
global v2t_PUB_IP
set v2t_DBHost "localhosu"         ;# Mysql database host
set v2t_DBUser "username"           ;# Mysql database User 
set v2t_DBPass "pass"           ;# Mysql database password
set v2t_DB     "dbname"            ;# Mysql database name
set v2t_voice   "127.0.0.1 "           ;# Voicecomm server IP 
set v2t_clan_servers "127.0.0.1"          ;# Clanserver IPs
set v2t_pass "blank"            ;# Server Password 
set db_handle [mysqlconnect -host $v2t_DBHost -user $v2t_DBUser -password $v2t_DBPass -db $v2t_DB];# Mysql connection 
set scripts "c:/eggdrop/scripts"           ;# location of the script
set ichan "#whatever"            ;# Channel the bot will recognise clan commands
set v2t_webby "http://www.yoursite.net"
set clantag "|tag|"

##########################################################################
##########################End of Config###################################
##########################################################################

##########################################################################
##########################trigger Setup###################################
##########################################################################

bind pub - "!list" v2t_upcoming
bind pub - "!players" v2t_list_avail
bind pub - "!avail" v2t_set_avail
bind pub - "!unavail" v2t_set_unavail
bind pub - "!maybe" v2t_set_maybe
bind pub - "!del" v2t_del
bind pub - "!help" v2t_help
bind pub - "!voice" v2t_voice_ip
bind pub - "!servers" v2t_clan_servers
bind pub - "!pass" v2t_pass
bind pub - "!setpass" v2t_pass_set
bind pub - "!webby" v2t_webby
bind pub - "!next" v2t_nextwar
bind pub - "!next" triggerspam
bind join - * v2t_nextwar



##########################################################################
#########################End Triggers#####################################
##########################################################################
timer 45 triggerspam

##########################################################################
#########################Start Help#######################################
##########################################################################
proc v2t_help { nick uhost hand chan args } {
global ichan
       if {$chan != $ichan} {
     putserv "NOTICE $nick : The following commands are available in this channel"
     putserv "NOTICE $nick : !help - the stuff you're reading now n00b" 
     putserv "NOTICE $nick : !servers - displays clan server IP's"
     putserv "NOTICE $nick : !list - Lists the next 5 matches as a NOTICE to you"
                   putserv "NOTICE $nick : !list channel - Lists the next 5 matches in the channel"
     putserv "NOTICE $nick : !webby - shows the clan website"
       return
   }
     putserv "NOTICE $nick : The following commands are available in this channel ONLY"
   putserv "NOTICE $nick : !list - Lists the next 5 matches as a NOTICE to you"
   putserv "NOTICE $nick : !list channel - Lists the next 5 matches in the channel"
   putserv "NOTICE $nick : !players <matchid> - Lists availity of players for the next match as a NOTICE to you. "
   putserv "NOTICE $nick : !players <matchid> Channel - Lists the availability of players for the next math. Lists in the channel"
   putserv "NOTICE $nick : !avail <matchid> <nick> - Sets the player as available - eg: !avail 1 fatgit"
   putserv "NOTICE $nick : !unavail <matchid> <nick> - Sets the player as unavailable - eg: !unavail 1 fatgit"
   putserv "NOTICE $nick : !maybe <matchid> <nick> - Sets the player as maybe available - eg: !maybe 1 fatgit"
   putserv "NOTICE $nick : !del <matchid> <nick> - Deletes a player from the match. \0034,0Only use if !avail, !unavail or !maybe are not working"
   putserv "NOTICE $nick : !help - the stuff you're reading now n00b" 
   putserv "NOTICE $nick : !voice - display the voicecom details"
   putserv "NOTICE $nick : !servers - displays clan server IP's"
   putserv "NOTICE $nick : !pass - displays the server pass (note this will only be correct if set manually after a server pass change)"
   putserv "NOTICE $nick : !setpass - set the pass for the server - this is for INFORMATION ONLY - it will NOT set it on the server"
   putserv "NOTICE $nick : !webby - shows the clan website"
   putserv "NOTICE $nick : To add/remove/modify a match, please go to http://www.no-mercy.net/admin/admin.php?action=addwar"


}

##########################################################################
########################Start Info Scripts################################
##########################################################################


##########################################################################
########################Start Info Scripts################################
##########################################################################
proc v2t_clan_servers { nick uhost hand chan args } {
global v2t_clan_servers
 putserv "PRIVMSG $chan :\002IP:\002 $v2t_clan_servers"
}

proc v2t_webby { nick uhost hand chan args } {
global v2t_webby
 putserv "PRIVMSG $chan :\002Website:\002 $v2t_webby"
}


proc v2t_voice_ip  { nick uhost hand chan args } {
global v2t_voice ichan
   if {$chan != $ichan} {
       return
   }
 putserv "PRIVMSG $chan :\002IP:\002 $v2t_voice"
}

proc v2t_pass { nick uhost handle chan args } {
   global v2t_pass
   putserv "NOTICE $nick :pass is currently $v2t_pass - this may be wrong if : Someone changed the server pass but didn't !setpass OR the bot has restarted for some reason"
}

proc v2t_pass_set { nick uhost handle chan args } {
   global v2t_pass ichan
       if {$chan != $ichan} {
       return
   }
   if {$args == "{}"} {
       set v2t_pass "blank"
   } else {
       set v2t_pass $args
   }
 putserv "NOTICE $nick :pass is currently $v2t_pass"
}


##########################################################################
#########################Delete Player####################################
##########################################################################
proc v2t_del { nick uhost hand chan text } {
   global ichan scripts blankT db_handle vwarid inputname clantag
       if {$chan != $ichan} {
       return
   }

   #set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
   #set res  [mysqlsel $db_handle $SQLST -flatlist]
   #set warid [lindex $res 1]
    set warid [lindex [split $text] 0]
    set signupname  [lindex [split $text] 1]

   set inputname ""
   #append inputname "|NM|" $signupname 
   append inputname $clantag $signupname
  # putserv "NOTICE $nick : name - $inputname"
   set SQLST3 "select COUNT(*) FROM vwar1 WHERE warid = '$warid'"
   set res3  [mysqlsel $db_handle $SQLST3 -flatlist]
   set exists [lindex $res3 0]
   
   if {$exists == 0} {
       putserv "NOTICE $nick : Sorry that is an invalid Match ID. Please do !list to see a list of the next 5 IDs"
return
   }
    
   set SQLST "select COUNT(*) FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   
   if {$exists == 0} {
   putserv "NOTICE $nick : Invalid playername. Please ensure the name matches the users ingame name without clan tags"
   return
   } else {
       set SQLST2 "select * FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
       set res2  [mysqlsel $db_handle $SQLST2 -flatlist]
       set memberid [lindex $res2 1]
      # putserv "NOTICE $nick : exists = $exists and memberid = $memberid"
   }

   set signuptime [unixtime]
   set SQLST "SELECT COUNT(*) FROM vwar1_participants WHERE memberid = '$memberid' AND warid = '$warid'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   if {$exists!="0"} {
set SQEXEC "DELETE FROM vwar1_participants WHERE memberid = '$memberid' AND warid = '$warid'"
mysqlexec $db_handle $SQEXEC
putserv "NOTICE $nick : -done- removed $text from the war"
   } elseif {$exists=="0"} {
putserv "NOTICE $nick : You are not signed up for that match."
return
   }


}

##########################################################################
#####################End Delete Player####################################
##########################################################################


##########################################################################
#########################Set avail########################################
##########################################################################

proc v2t_set_avail { nick uhost hand chan text  } {
   global ichan scripts db_handle ichan scripts blankT db_handle vwarid clantag
       if {$chan != $ichan} {
       return
   }

   #get the next wars ID
  # set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
  # set res  [mysqlsel $db_handle $SQLST -flatlist]
  # set warid [lindex $res 1]
   set warid [lindex [split $text] 0]
   set signupname  [lindex [split $text] 1]
   set inputname ""
   #append inputname "|NM|" $signupname 
   append inputname $clantag $signupname
  # putserv "NOTICE $nick : name - $inputname"
   set SQLST3 "select COUNT(*) FROM vwar1 WHERE warid = '$warid'"
   set res3  [mysqlsel $db_handle $SQLST3 -flatlist]
   set exists [lindex $res3 0]
   
   if {$exists == 0} {
       putserv "NOTICE $nick : Sorry that is an invalid Match ID. Please do !list to see a list of the next 5 IDs"
return
   } 
   set SQLST "select COUNT(*) FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   
   if {$exists == 0} {
   putserv "NOTICE $nick : Invalid playername. Please ensure the name matches the users ingame name without clan tags"
   return
   } else {
       set SQLST2 "select * FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
       set res2  [mysqlsel $db_handle $SQLST2 -flatlist]
       set memberid [lindex $res2 1]
      # putserv "NOTICE $nick : exists = $exists and memberid = $memberid"
   }

   set signuptime [unixtime]

   set SQLST "SELECT COUNT(*) FROM vwar1_participants WHERE memberid = '$memberid' AND warid = '$warid'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   if {$exists=="0"} {
set SQEXEC "INSERT INTO vwar1_participants (memberid, warid, comment, available, dateline) VALUES ('$memberid','$warid','available','1','[unixtime]')"
mysqlexec $db_handle $SQEXEC
putserv "NOTICE $nick : -done- added you to the war "
   } elseif {$exists!="0"} {
       set SQEXEC "UPDATE vwar1_participants SET available = '1' WHERE memberid = '$memberid' AND `warid` = '$warid'"
       set SQEXEC2 "UPDATE vwar1_participants SET comment = 'Available' WHERE memberid = '$memberid' AND `warid` = '$warid'"
mysqlexec $db_handle $SQEXEC
mysqlexec $db_handle $SQEXEC2
putserv "NOTICE $nick : Your availability has been updated to : available."
return
   }



}

##########################################################################
#########################End Set Avail####################################
##########################################################################

##########################################################################
#########################Set avail unavail################################
##########################################################################

proc v2t_set_unavail { nick uhost hand chan text  } {
   global ichan scripts db_handle ichan scripts blankT db_handle vwarid memberid clantag
       if {$chan != $ichan} {
       return
   }

   #get the next wars ID
   set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
  # set warid [lindex $res 1]
      set warid [lindex [split $text] 0]
   set signupname  [lindex [split $text] 1]
   set inputname ""
   #append inputname "|NM|" $signupname 
   append inputname $clantag $signupname
   set SQLST3 "select COUNT(*) FROM vwar1 WHERE warid = '$warid'"
   set res3  [mysqlsel $db_handle $SQLST3 -flatlist]
   set exists [lindex $res3 0]
   
   if {$exists == 0} {
       putserv "NOTICE $nick : Sorry that is an invalid Match ID. Please do !list to see a list of the next 5 IDs"
return
   }   
   # putserv "NOTICE $nick : name - $inputname"
    
   set SQLST "select COUNT(*) FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   
   if {$exists == 0} {
   putserv "NOTICE $nick : Invalid playername. Please ensure the name matches the users ingame name without clan tags"
   return
   } else {
       set SQLST2 "select * FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
       set res2  [mysqlsel $db_handle $SQLST2 -flatlist]
       set memberid [lindex $res2 1]
#        putserv "NOTICE $nick : exists = $exists and memberid = $memberid"
   }

   set signuptime [unixtime]

   set SQLST "SELECT COUNT(*) FROM vwar1_participants WHERE memberid = '$memberid' AND warid = '$warid'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   if {$exists=="0"} {
set SQEXEC "INSERT INTO vwar1_participants (memberid, warid, comment, available, dateline) VALUES ('$memberid','$warid','unavailable','0','[unixtime]')"
mysqlexec $db_handle $SQEXEC
putserv "NOTICE $nick : You have been set as Unavailable "
   } elseif {$exists!="0"} {
       set SQEXEC "UPDATE vwar1_participants SET available = '0' WHERE memberid = '$memberid' AND `warid` = '$warid'"
       set SQEXEC2 "UPDATE vwar1_participants SET comment = 'Unavailable' WHERE memberid = '$memberid' AND `warid` = '$warid'"
mysqlexec $db_handle $SQEXEC
mysqlexec $db_handle $SQEXEC2
putserv "NOTICE $nick : Your availability has been updated to : Unavailable."
return
   }



}

##########################################################################
#########################End Set Unavail##################################
##########################################################################


##########################################################################
#########################Set avail Maybe##################################
##########################################################################

proc v2t_set_maybe { nick uhost hand chan text  } {
   global ichan scripts db_handle ichan scripts blankT db_handle vwarid clantag
       if {$chan != $ichan} {
       return
   }

   #get the next wars ID
   set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   #set warid [lindex $res 1]
   set warid [lindex [split $text] 0]
   set signupname  [lindex [split $text] 1]
   set inputname ""
   #append inputname "|NM|" $signupname 
   append inputname $clantag $signupname
  # putserv "NOTICE $nick : name - $inputname"
      set SQLST3 "select COUNT(*) FROM vwar1 WHERE warid = '$warid'"
   set res3  [mysqlsel $db_handle $SQLST3 -flatlist]
   set exists [lindex $res3 0]
   
   if {$exists == 0} {
       putserv "NOTICE $nick : Sorry that is an invalid Match ID. Please do !list to see a list of the next 5 IDs"
return
   }
    
   set SQLST "select COUNT(*) FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   
   if {$exists == 0} {
   putserv "NOTICE $nick : Invalid playername. Please ensure the name matches the users ingame name without clan tags"
   return
   } else {
       set SQLST2 "select * FROM vwar1_memberprofilefield where fieldvalue = '$inputname'"
       set res2  [mysqlsel $db_handle $SQLST2 -flatlist]
       set memberid [lindex $res2 1]
      # putserv "NOTICE $nick : exists = $exists and memberid = $memberid"
   }

   set signuptime [unixtime]

   set SQLST "SELECT COUNT(*) FROM vwar1_participants WHERE memberid = '$memberid' AND warid = '$warid'"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set exists [lindex $res 0]
   if {$exists=="0"} {
set SQEXEC "INSERT INTO vwar1_participants (memberid, warid, comment, available, dateline) VALUES ('$memberid','$warid','maybe','2','[unixtime]')"
mysqlexec $db_handle $SQEXEC
putserv "NOTICE $nick : You have been set as Maybe "
   } elseif {$exists!="0"} {
       set SQEXEC "UPDATE vwar1_participants SET available = '2' WHERE memberid = '$memberid' AND `warid` = '$warid'"
       set SQEXEC2 "UPDATE vwar1_participants SET comment = 'Maybe' WHERE memberid = '$memberid' AND `warid` = '$warid'"
mysqlexec $db_handle $SQEXEC
mysqlexec $db_handle $SQEXEC2
putserv "NOTICE $nick : Your availability has been updated to : Maybe."
return
   }



}

##########################################################################
#########################End Set Maybe####################################
##########################################################################


##########################################################################
##########################List available##################################
##########################################################################
proc v2t_list_avail { nick uhost hand chan text} {
   global ichan scripts blankT db_handle vwarid avail() COUNT available result0
       if {$chan != $ichan} {
       return
   }
   set avail(1) ""
   set avail(2) ""
   set avail(3) ""
   set avail(4) ""
   set avail(5) ""
   set avail(6) ""
   set avail(7) ""
   set avail(8) ""
   set avail(9) ""
   set avail(10) ""
   set avail(11) ""
   set avail(12) ""
   set avail(13) ""
   set avail(14) ""
   set avail(15) ""
   set avail(16) ""
   set avail(17) ""
   set avail(18) ""
   set avail(19) ""
   set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   #set warid [lindex $res 1]
   set warid [lindex [split $text] 0]
   set chanl  [lindex [split $text] 1]
   set SQLST3 "select COUNT(*) FROM vwar1 WHERE warid = '$warid'"
   set res3  [mysqlsel $db_handle $SQLST3 -flatlist]
   set exists [lindex $res3 0]
   
   if {$exists == 0} {
       putserv "NOTICE $nick : Sorry that is an invalid Match ID. Please do !list to see a list of the next 5 IDs"
return
   }


   #set SQLST "SELECT * FROM vwar1_participants WHERE warid = '$warid' and available = '1'"
   set SQLST "SELECT * FROM vwar1_participants WHERE warid = '$warid'"
   set COUNT 1
   set query1 [ mysqlquery $db_handle $SQLST  ]
   while { [ set res [mysqlnext $query1 ] ] !="" } {
   set memberid [lindex $res 1]
   set availability [lindex $res 4]
   set suffix "\003"
   set prefix "\003"
   if {$availability == "1"} {
   set prefix "\0033"
   } elseif {$availability == "0"} {
   set prefix "\0034"
   } elseif {$availability == "2"} {
   set prefix "\0037"
   }
   set SQLST2 "SELECT * FROM vwar1_memberprofilefield where memberid = '$memberid' AND profilefieldid = '4'"
   set query2 [ mysqlquery $db_handle $SQLST2  ]
   set res2  [mysqlsel $db_handle $SQLST2 -flatlist]
   set resultname [lindex $res2 3]
   set availmembername "$prefix $resultname $suffix"
   set avail($COUNT) $availmembername
   incr COUNT
   }
   append availstring $avail(1) $avail(2) $avail(3) $avail(4) $avail(5) $avail(6) $avail(7) $avail(8) $avail(9) $avail(10) $avail(11) $avail(12) $avail(13) $avail(14) $avail(15) $avail(16) $avail(17) $avail(18) $avail(19) 

   if {$chanl == "channel"} {
   set location "$chan"
   set msgtype "PRIVMSG"
} else {
   set location "$nick"
   set msgtype "NOTICE"
}
   putserv "$msgtype $location : Availability for match number $warid - $availstring"
   putserv "$msgtype $location : \0034,0 Colour Codes : \0033Available \0034Unavailable \0037Maybe \003:: If you have not set your availability yet, please do so ASAP"


}

##########################################################################
###################### End List available#################################
##########################################################################

##########################################################################
##########################List Upcoming Events############################
##########################################################################
proc v2t_upcoming { nick uhost hand chan args } {
   global ichan scripts blankT db_handle location msgtype v2t_webby

   if {$args == "channel"} {
   set location "$chan"
   set msgtype "PRIVMSG"
} else {
   set location "$nick"
   set msgtype "NOTICE"
}
        putserv "$msgtype $location :\00311\0031,0-\00315=\00314-\0031\002=\[ \002 \0034 Upcoming Matches \003 \002 \]=\002\00314-\00315=\0031-\003"
    putserv "$msgtype $location :Next 5 upcoming matches from the \002vWar\002 Database:"

   set SQLST "SELECT distinct(vwar1.warid),FROM_UNIXTIME(vwar1.dateline,'%w'),FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 5"
   set COUNT 1
   set SQLST2 "SELECT warid FROM vwar1 WHERE vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 5"
   set query2 [ mysqlquery $db_handle $SQLST2  ]
   
   set query1 [ mysqlquery $db_handle $SQLST ]
   while { [ set res [mysqlnext $query1 ] ] !="" } {

   set res2  [mysqlnext $query2 ]
   set warsid "0"
   set warsid [lindex $res2 0]
       set daynum [lindex $res 0]
       set warid [lindex $res 1]
       set date_list [lindex $res 2]
       set wType [lindex $res 3]
       set wGType [lindex $res 4]
       set wOppName [lindex $res 11]
       set wOpp [lindex $res 12]
       set wIP [lindex $res 15]
       set weDate [lindex $date_list 0]
       set weTime [lindex $date_list 1]
       set month [lindex [split $weDate "-"] 1]
       set day [lindex [split $weDate "-"] 2]
       set Year [lindex [split $weDate "-"] 0]
       set HH [lindex [split $weTime ":"] 0]
       set MM [lindex [split $weTime ":"] 1]
       set wDay ""
       switch  "$daynum" {
           0 {set wDay "Sunday" }
           1 {set wDay "Monday"}
           2 {set wDay "Tuesday"}
           3 {set wDay "Wednesday"}
           4 {set wDay "Thursday"}
           5 {set wDay "Friday"}
           6 {set wDay "Saturday"}
       }
       
       set locations [ mysqlsel $db_handle "select locationname FROM vwar1_locations, vwar1_scores WHERE vwar1_scores.locationid = vwar1_locations.locationid AND warid = $warid" -flatlist ]
       set mapA [lindex $locations 0]
       set mapB [lindex $locations 1]
       set xwTyp ""
       
       if { $wType == "Fun War" } {
           set xwTyp "FW"
       } elseif { $wType == "ut2k3League Match" } {
           set xwTyp "League"
       } elseif { $wType == "Train Match" } {
           set xwTyp "Train"
       } elseif { $wType == "2on2 Fun" } {
           set xwTyp "2on2FW"
       } elseif { $wType == "Clanbase iBR" } {
           set xwTyp "CB"
       } elseif { $wType == "iBR Cup" } {
           set xwTyp "CUP"
       } elseif { $wType == "FragFrenzy iBR" } {
           set xwTyp "FF"
       } elseif { $wType == "Clanbase iCTF" } {
           set xwTyp "CB"
       } elseif { $wType == "iCTF Cup" } {
           set xwTyp "CUP"
       }
       
       if {$args == "channel"} {
           set location "$chan"
           set msgtype "PRIVMSG"
       } else {
           set location "$nick"
           set msgtype "NOTICE"
       }
    putserv "$msgtype $location : \002Match ID :\002$warsid |\002($COUNT)Date: \002$day.$month.$Year, $HH:$MM |\002Opponent: \002$wOppName ( $wOpp ) | \002Maps:\002$mapA $mapB | \002Typ:\002$xwTyp $wGType "

       incr COUNT
   }
       if {$args == "channel"} {
           set location "$chan"
           set msgtype "PRIVMSG"
       } else {
           set location "$nick"
           set msgtype "NOTICE"
       }
       putserv "$msgtype $location :Please ensure you visit $v2t_webby to keep up with the news, forums and events."

}


##########################################################################
####################End of event list#####################################
##########################################################################

proc v2t_nextwar { nick uhost hand chan args } {
   global ichan scripts blankT db_handle v2t_webby
   if {$chan != $ichan} {
       return
   }
   #################
   
   
   set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
   
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set daynum [lindex $res 0]
   set warid [lindex $res 1]
   set date_list [lindex $res 2]
   set wType [lindex $res 3]
   set wGType [lindex $res 4]
   set wOpp [lindex $res 12]
   set wIP [lindex $res 15]
   set weDate [lindex $date_list 0]
   set weTime [lindex $date_list 1]
   set month [lindex [split $weDate "-"] 1]
   set day [lindex [split $weDate "-"] 2]
   set Year [lindex [split $weDate "-"] 0]
   set HH [lindex [split $weTime ":"] 0]
   set MM [lindex [split $weTime ":"] 1]
   set wDay ""
   switch  "$daynum" {
       0 {set wDay "Su" }
       1 {set wDay "Mo"}
       2 {set wDay "Tu"}
       3 {set wDay "We"}
       4 {set wDay "Th"}
       5 {set wDay "Fr"}
       6 {set wDay "Sa"}
   }
   
   set locations [mysqlsel $db_handle "select locationname FROM vwar1_locations, vwar1_scores WHERE vwar1_scores.locationid = vwar1_locations.locationid AND warid = $warid" -flatlist]
   set mapA [lindex $locations 0]
   set mapB [lindex $locations 1]
   set xwTyp ""
   if { $wType == "Fun War" } {
       set xwTyp "FW"
   }
      putserv "NOTICE $nick :Next Match $wDay $day.$month.$Year, $HH:$MM $xwTyp $wGType vs $wOpp + Maps: $mapA, $mapB please set availability at v2t_webby"
}

##########################################################################


proc triggerspam { } {
        global ichan scripts blankT db_handle location msgtype SQLST

   set SQLST "SELECT FROM_UNIXTIME(vwar1.dateline,'%w'),vwar1.warid,FROM_UNIXTIME(vwar1.dateline),matchtypename,gametypename,vwar1_games.*, vwar1_opponents.oppid, vwar1_opponents.oppname, vwar1_opponents.oppnameshort,vwar1_server.* FROM vwar1,vwar1_membergames LEFT JOIN vwar1_opponents ON (vwar1.oppid = vwar1_opponents.oppid) LEFT JOIN vwar1_matchtype ON(vwar1.matchtypeid = vwar1_matchtype.matchtypeid) LEFT JOIN vwar1_gametype ON (vwar1.gametypeid = vwar1_gametype.gametypeid) LEFT JOIN vwar1_games ON (vwar1.gameid = vwar1_games.gameid) LEFT JOIN vwar1_server ON (vwar1.serverid = vwar1_server.serverid) where vwar1.dateline > (UNIX_TIMESTAMP()) AND vwar1.gameid = '3' order by vwar1.dateline ASC limit 1"
   set res  [mysqlsel $db_handle $SQLST -flatlist]
   set daynum [lindex $res 0]
   set warid [lindex $res 1]
   set date_list [lindex $res 2]
   set wType [lindex $res 3]
   set wGType [lindex $res 4]
   set wOpp [lindex $res 12]
   set wIP [lindex $res 15]
   set weDate [lindex $date_list 0]
   set weTime [lindex $date_list 1]
   set month [lindex [split $weDate "-"] 1]
   set day [lindex [split $weDate "-"] 2]
   set Year [lindex [split $weDate "-"] 0]
   set HH [lindex [split $weTime ":"] 0]
   set MM [lindex [split $weTime ":"] 1]
   set wDay ""
   switch  "$daynum" {
       0 {set wDay "Su" }
       1 {set wDay "Mo"}
       2 {set wDay "Tu"}
       3 {set wDay "We"}
       4 {set wDay "Th"}
       5 {set wDay "Fr"}
       6 {set wDay "Sa"}
   }
   
   set locations [mysqlsel $db_handle "select locationname FROM vwar1_locations, vwar1_scores WHERE vwar1_scores.locationid = vwar1_locations.locationid AND warid = $warid" -flatlist]
   set mapA [lindex $locations 0]
   set mapB [lindex $locations 1]

  putserv "NOTICE $ichan :Next Match $wDay $day.$month.$Year, $HH:$MM vs $wOpp - please !list to get match ID's and then set your availability"
}
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

If you read the top part of that script, it tells you exactly what you need.
j
jackoooo
Voice
Posts: 3
Joined: Wed Jan 11, 2006 5:09 pm
Location: manchester

Post by jackoooo »

do you no any shell providers that offer what i need ive tryed searching on google but carnt find any


and pointers to the right hosting be a great help
l
lenooxx
Voice
Posts: 27
Joined: Tue Mar 24, 2009 10:56 am
Location: Hungarian
Contact:

hi

Post by lenooxx »

This script dosnet work for me !

("package ifneeded mysqltcl 2.0" script)
invoked from within
"package require mysqltcl"
(file "scripts/vwar.tcl" line 34)
invoked from within
"source scripts/vwar.tcl"
(file "eggdrop.conf" line 271)
* CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
Post Reply