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.

need help with a cupbot !add !remove and !whois system

Old posts that have not been replied to for several years.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Ok for starters:

Code: Select all

if {($bla != "bla") && ($bla != "bla1") && ($bla != "bla2") && ($bla == "")} {
is the same as

Code: Select all

if {$bla == ""} {
and

Code: Select all

if {[something]} {
 # bla
} elseif {![something]} {
 # bla
}
is the same as

Code: Select all

if {[something]} {
 # bla
} else {
 # bla
}
Also you can't use two consecutive elses. i.e

Code: Select all

if {[foo]} {
 # bla
} else {
 # bli
} else {
 # blo
}
is wrong, it's either if-else, if-elseif or if-elseif-else (and you can specify as much elseifs as you want).
Try to fix these out, and let's see what happens then.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

oki, ill fix it. Thanks Sir_Fz
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

oki. I did fixed the script. I didnt delete all the if {[$bla != "bla"]} because i thought if i delete it, people could type 1/2/3/4/5 instaed of 5on5 or 3on3 etc and then the script will be useless. Oh well. Heres the new script. Can you check i have done what you said correct Sir_Fz please.

Code: Select all

proc cup:start {nick host hand chan text} {
  if {[matchattr $hand |C $chan]} {
    if {[channel get $chan "cup"]} {
      putserv "PRIVMSG $chan :Error: Cup is already running."
    }
    } else {
    set cup(slots,$chan) [lindex [split $text] 1]
    set cup(type,$chan) [lindex [split $text] 0]
    set cup(prize,$chan) [join [lrange [split $text] 2 end]]
    if {($cup(type,$chan) != "5on5") && ($cup(type,$chan) != "4on4") && ($cup(type,$chan) != "3on3") && ($cup(type,$chan) != "2on2") && ($cup(type,$chan) != "1on1") && ($cup(type,$chan) == "")} {
      putserv "NOTICE $nick :Error: Please enter a correct cup type. ( 5on5 or 4on4 or 3on3 or 2on2 or 1on1 )"
      } else {
      if {($cup(slots,$chan) != "4") && ($cup(slots,$chan) != "8") && ($cup(slots,$chan) != "16") && ($cup(slots,$chan) != "32") && ($cup(slots,$chan) == "")} {
        putserv "NOTICE $nick :Error: Please enter a correct slot entry. ( 4 or 8 or 16 or 32 )"
        } else {
        if {($cup(prize,$chan) == "")} {
          putserv "NOTICE $nick Error: Please enter a prize. ( prize can be anything )"
          } else {
          channel set $chan +cup
          channel set $chan s_cup_slots $cup(slots,$chan) 
          channel set $chan s_cup_type $cup(type,$chan) 
          channel set $chan s_cup_prize $cup(prize,$chan) 
          channel set $chan s_cup_teams 0
          channel set $chan s_cup_admin $nick
          channel set $chan s_cup_HLTV None set
          channel set $chan s_cup_maps de_dust2
          putserv "PRIVMSG $chan :The $chan [channel get $chan "s_cup_type"] is now on with [channel get $chan "s_cup_slots"] slots."
          putserv "PRIVMSG $chan :Your admin is [channel get $chan "s_cup_admin"] and the map is [channel get $chan "s_cup_maps"]."
          putserv "PRIVMSG $chan :Bot by #cupcentrum join to request your bot."
          } else {
          if {![matchattr $hand |C $chan]} {
            putserv "NOTICE $nick :Error: you do not have access to this command."
          }   
        }
      }
    }   
  }
}
r0t3n @ #r0t3n @ Quakenet
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

My god, Are you still too stupid to test your own scripts?

And, Use the [censored] edit button. There is no need to see all these posts from you when it was you who made the last reply anyway.

Test your OWN scripts, FIND out if there is something wrong.
THEN if you absolutely can't fix it ask us what the problem could be and ALWAYS include the error message.

Don't simply go around asking us if every brace you add is correct. There is also no need to make so much posts all containing the same code that is just slightly altered, Try the edit button for once.
Locked