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 some help with a "buggy" script.

Help for those learning Tcl or writing their own scripts.
Post Reply
S
Shaiko
Voice
Posts: 3
Joined: Sun Oct 15, 2006 5:30 pm

Need some help with a "buggy" script.

Post by Shaiko »

Well, im trying again. i have made a buggy script.
When a person borrows the server is seems like the bot does "chattr $nick +R|"
i aint any elete scripter. so i was woundering if it is anyone here who is a good scripter that can "read" the script and see if it is possible to
make it better.

Code: Select all

bind pub - ".borrow" ws:borrow
proc ws:borrow {nick uhost handle chan text} {
 if {[info exists ::wsadmin] && [info exists ::wschan] && [string equal -nocase $chan $::wsadmin] && [string equal $text ""]} {
  if {[isop $::botnick $::wschan]} {
   if {[matchattr $handle +R]} {
    puthelp "privmsg $::wschan :Error: You have alredy borrowed the server whitin the 2 hours!"
    return 0
    } else {
    if {$server == "0"} {
     set ipmask [lindex [split [maskhost $nick![getchanhost $nick $chan]] "@"] 1]
     set userm [lindex [split [getchanhost $nick $chan] "@"] 0]
     set userhost *!*$userm@$ipmask
     adduser $nick $userhost
     chattr $nick +R|
     set ::server 1
     set ::range 100000
     set ::pwrange 1000
     set ::rcon [expr {int(rand()*$::range)}]
     set ::pass [expr {int(rand()*$::pwrange)}]
     exec ./hlds_srv1 -game cstrike +ip 195.*.*.* -port 27010 +map de_dust2 +maxplayers 12 -pingboost 3 -sv_password $::pass -rcon_password $::rcon &
     puthelp "privmsg $::wschan :\002Status\002: Just now $nick borrows BETA_SERVER!"
     puthelp "cnotice $nick $::wschan :Status: Rcon: $::rcon  Password $::pass Port: 27010 IP: 195.*.*.*"
     utimer $::waittime "chattr $nick -R|"
     utimer $::borrowtime "set ::srv1s 0"
     utimer $::borrowtime [list putquick "privmsg $::wschan :Status: BETA_SERVER Is now avalible for borrowing!"]
     utimer $::btime "exec killall -q /bin/sh ./hlds_srv1 ./hlds_27010"
     return 0
    } elseif {$::Server == "1"} {
     putquick "privmsg $chan :Server 'BETA_SERVER' Is alredy taken!"
    }
   }
  } else {
   puthelp "privmsg $chan :ERROR: need op!"
   return 0
  }
 } else {
  puthelp "privmsg $chan :ERROR: Contact an admin!"
  return 0
 }
}
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

What problem are you trying to solve? Your msg does not make clear what the problem is.
Post Reply