Guest User

Untitled

a guest
Jan 28th, 2017
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 341.48 KB | None | 0 0
  1. ctcp *:*:{ ignore -tp $nick | haltdef }
  2.  
  3. alias php.exe { return C:\Program Files (x86)\PHP\v5.3\php.exe }
  4. alias php.ini { return php.ini }
  5. alias php.file { return mysql.php }
  6. alias php.command { .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  7.  
  8. alias gdir { return gatherbot\ }
  9. alias sigmirc { run -hn C:\sigmirc\sigmirc.exe $1- }
  10. alias contact { return #zikkan }
  11. alias scripter { return #zikkan }
  12. alias blockaccess { return cokebabz }
  13. alias blockipaccess { return ?.?.?.? }
  14. alias team.updateid {
  15. var %gfile = $gfile(gteams.ini), %read = $+($1,=,*) | while ($read(%gfile,w,%read)) {
  16. var %i = $readn, %x = $read(%gfile,%i) | write -l $+ %i %gfile $replace(%x,$1,$2)
  17. }
  18. var %read = $+(leader,=,$1) | while ($read(%gfile,w,%read)) {
  19. var %i = $readn, %x = $read(%gfile,%i) | write -l $+ %i %gfile $replace(%x,$1,$2)
  20. }
  21. }
  22. alias team.deleteid {
  23. var %gfile = $gfile(gteams.ini), %read = $+(leader,=,$1) | while ($read(%gfile,w,%read)) {
  24. var %i = $readn, %x = 25, %team | while (!%team) && (%x) && ($read(%gfile,%i)) {
  25. var %f = $ifmatch | if ([*] iswm %f) { var %team = $left($right(%f,-1),-1) | remini -n %gfile %team } | dec %i | dec %x
  26. }
  27. }
  28. var %read = $+($1,=,*) | while ($read(%gfile,w,%read)) {
  29. var %i = $readn, %x = 25, %team | while (!%team) && (%x) && ($read(%gfile,%i)) {
  30. var %f = $ifmatch | if ([*] iswm %f) { var %team = $left($right(%f,-1),-1) | remini -n %gfile %team $1 } | dec %i | dec %x
  31. }
  32. }
  33. }
  34. alias team.unrequest {
  35. var %gfile = $gfile(gteams.ini), %read = $+($1,=,request) | while ($read(%gfile,w,%read)) {
  36. var %i = $readn, %x = 25, %team | while (!%team) && (%x) && ($read(%gfile,%i)) {
  37. var %f = $ifmatch | if ([*] iswm %f) { var %team = $left($right(%f,-1),-1) | remini -n %gfile %team $1 } | dec %i | dec %x
  38. }
  39. }
  40. var %read = $+($1,=,invite) | while ($read(%gfile,w,%read)) {
  41. var %i = $readn, %x = 25, %team | while (!%team) && (%x) && ($read(%gfile,%i)) {
  42. var %f = $ifmatch | if ([*] iswm %f) { var %team = $left($right(%f,-1),-1) | remini -n %gfile %team $1 } | dec %i | dec %x
  43. }
  44. }
  45. }
  46. alias team.invites {
  47. var %gfile = $gfile(gteams.ini), %i = 1, %teams
  48. while ($ini(%gfile,%i)) {
  49. var %team = $ifmatch | if ($readini(%gfile,%team,$1) == invite) { var %teams = $iif(%teams,$+(%teams,$chr(44))) %team } | inc %i
  50. }
  51. return $iif(%teams,%teams,0)
  52. }
  53. alias team.player {
  54. var %gfile = $gfile(gteams.ini), %r = $+($1,=,leader), %r2 = $+($1,=,officer), %r3 = $+($1,=,member)
  55. if ($read(%gfile,w,%r)) || ($read(%gfile,w,%r2)) || ($read(%gfile,w,%r3)) {
  56. var %i = $readn, %x = 25 | while (%x) && ($read(%gfile,%i)) {
  57. var %f = $ifmatch | if ([*] iswm %f) { return $left($right(%f,-1),-1) } | dec %i | dec %x
  58. }
  59. }
  60. return $false
  61. }
  62. alias team.rank {
  63. if ($1 isnum 10) { return Leader }
  64. if ($1 isnum 9) { return Officer }
  65. if ($1 isnum 8) { return Member }
  66. if ($1 == Leader) { return 10 }
  67. if ($1 == Officer) { return 9 }
  68. if ($1 == Member) { return 8 }
  69. return 0
  70. }
  71. alias team.playerrank {
  72. var %gfile = $gfile(gteams.ini), %r = $+($1,=,leader), %r2 = $+($1,=,officer), %r3 = $+($1,=,member)
  73. if ($read(%gfile,w,%r)) || ($read(%gfile,w,%r2)) || ($read(%gfile,w,%r3)) {
  74. var %i = $readn, %x = $read(%gfile,%i) | return $team.rank($gettok(%x,2,61))
  75. }
  76. return 0
  77. }
  78. alias team.name {
  79. var %gfile = $gfile(gteams.ini)
  80. if ($ini(%gfile,$1)) { return $ini(%gfile,$ifmatch) }
  81. return $false
  82. }
  83. alias team.ids {
  84. var %ranks = leader officer member, %gfile = $gfile(gteams.ini), %i = 1, %p
  85. if ($ini(%gfile,$1)) {
  86. while ($ini(%gfile,$1,%i)) {
  87. var %x = $ifmatch, %r = $readini(%gfile,$1,%x) | if ($istok(%ranks,%r,32)) { var %p = %p %x } | inc %i
  88. }
  89. return $iif(%p,%p,0)
  90. }
  91. return 0
  92. }
  93. alias team.names {
  94. var %ranks = leader officer member, %gfile = $gfile(gteams.ini), %i = 1, %p
  95. if ($ini(%gfile,$1)) {
  96. while ($ini(%gfile,$1,%i)) {
  97. var %x = $ifmatch, %r = $readini(%gfile,$1,%x)
  98. if ($istok(%ranks,%r,32)) { var %p = $iif(%p,$+(%p,$chr(44))) $+($anick(%x),$col(14,$chr(91)),$upleft(%r),$col(14,$chr(93))) }
  99. inc %i
  100. }
  101. }
  102. return $iif(%p,%p,0)
  103. }
  104. alias team.cnames {
  105. var %ranks = leader officer member, %gfile = $gfile(gteams.ini), %i = 1, %p
  106. if ($ini(%gfile,$1)) {
  107. while ($ini(%gfile,$1,%i)) {
  108. var %x = $ifmatch, %r = $readini(%gfile,$1,%x) | if ($istok(%ranks,%r,32)) { var %p = $iif(%p,$+(%p,$chr(44))) $anick(%x) } | inc %i
  109. }
  110. }
  111. return $iif(%p,%p,0)
  112. }
  113. alias team.players {
  114. var %ranks = leader officer member, %gfile = $gfile(gteams.ini), %i = 1, %p = 0
  115. if ($ini(%gfile,$1)) {
  116. while ($ini(%gfile,$1,%i)) {
  117. var %x = $ifmatch, %r = $readini(%gfile,$1,%x) | if ($istok(%ranks,%r,32)) { inc %p } | inc %i
  118. }
  119. }
  120. return %p
  121. }
  122. alias team.banned {
  123. if ($readini($gfile(teambans.ini),$1,tid)) { return $true }
  124. return $false
  125. }
  126. alias team.checkname {
  127. var %i = 1 | while ($mid($1,%i,1)) {
  128. var %x = $ifmatch, %chr = $asc(%x)
  129. if (%chr !isnum 97-122) && (%chr !isnum 65-90) { return $false }
  130. inc %i
  131. }
  132. return $iif(!$1,$false,$true)
  133. }
  134.  
  135. alias statsblock {
  136. ;;SPECIAL;;
  137. if (#signfrag.* iswm $mainchan) { if (!$gatherstatus(accept)) && ($gatherstatus(signup)) { return $ifmatch } }
  138. if ($gatherstatus(pick)) { return $ifmatch }
  139. if (%statsblock) { return $ifmatch }
  140. if (%statscmd > 6) { set -z %statsblock $iif(%statscmd > 7,8,5) | unset %statscmd | return %statsblock }
  141. inc -z %statscmd 3.5 | return 0
  142. }
  143. alias ct { return $+($chr(35),$1-) }
  144. alias ignorecmds { var %cmd = $cmd_ingame($1) | if (!%ignore) || ($istok(reload bots bot add sign rem remove out del delete adminsign reject stop accept acceptcl reject rejectcl,%cmd,32)) { return $false } | return $true }
  145. alias checkconn {
  146. if ($me ison $ownerchan) {
  147. ;msg $ownerchan .
  148. }
  149. elseif ($me ison $privchan) {
  150. ;msg $privchan .
  151. }
  152. elseif ($me ison $mainchan) {
  153. ;msg $mainchan .
  154. }
  155. .timercheckconn -o 1 300 checkconn
  156. }
  157. alias obslogo {
  158. if ($mainchan == #signfrag.cs) { return 04,1::0 }
  159. return 04::
  160. }
  161. alias howtogetaccess {
  162. return Use .buystatus to see how you can get access
  163. }
  164. alias getaccess {
  165. if (!$gatherinfo(access)) { return $calc($ctime + 31536000) }
  166. var %steamid = $1, %gfile = $gfile(access.ini)
  167. return $iif($readini(%gfile,%steamid,access),$ifmatch,$false)
  168. }
  169. alias haveaccess {
  170. if (!$gatherinfo(access)) { return $true }
  171. var %steamid = $1, %gfile = $gfile(access.ini), %access = $readini(%gfile,%steamid,access), %ctime = $ctime, %auth = $gauth(%steamid)
  172. if (%access > %ctime) || ($admin($+($chr(35),%auth)) >= 10) { return $true }
  173. return $false
  174. }
  175. alias giveaccess {
  176. var %steamid = $1, %gfile = $gfile(access.ini), %access = $readini(%gfile,%steamid,access), %ctime = $ctime, %days = $iif($2 isnum,$2,30)
  177. if (%access < %ctime) || (!%access) { var %access = %ctime }
  178. var %give = $calc(3600 * 24 * %days), %access = $calc(%access + %give)
  179. writeini -n %gfile %steamid access %access
  180. }
  181. alias takeaccess {
  182. var %steamid = $1, %gfile = $gfile(access.ini), %access = $readini(%gfile,%steamid,access), %ctime = $ctime, %days = $iif($2 isnum,$2,0)
  183. if (%access < %ctime) || (!%access) { return }
  184. var %take = $calc(3600 * 24 * %days), %access = $calc(%access - %take)
  185. if (%access < %ctime) || (!%days) { var %access = %ctime }
  186. writeini -n %gfile %steamid access %access
  187. }
  188.  
  189. alias gfile {
  190. var %dir = $iif(*?\ iswm $gdir,$gdir), %file = $replace($lower($1),cstats,clutchstats), %dfile = $+(%dir,%file)
  191. if (%dir) {
  192. if (!$isdir(%dir)) { .mkdir %dir }
  193. if (!$isfile(%dfile)) && ($isfile(%file)) { .rename %file %dfile }
  194. return $iif(*?\?*.?* iswm %dfile,%dfile,$+(%dir,error.ini))
  195. }
  196. return $iif(*?.?* iswm %file,%file,error.ini)
  197. }
  198. alias unlim {
  199. if ($1 == pool) { if ($readini($gfile(gatherinfo.ini),modes,unlimpool) == ON) || (($2) && ($readini($gfile(gatherstatus.ini),$2,unlimpool))) { return $true } }
  200. if ($1 == noon) { if ($time <= 12) && ($readini($gfile(gatherinfo.ini),modes,unlimnoon) == ON) { return $true } }
  201. if ($readini($gfile(gatherinfo.ini),modes,unlimpool) == ON) || (($time <= 12) && ($readini($gfile(gatherinfo.ini),modes,unlimnoon) == ON)) { return $true }
  202. return $false
  203. }
  204. alias gatherinfo {
  205. if ($1 == game) { return $iif($readini($gfile(gatherinfo.ini),modes,gametype),$ifmatch,CS:GO) }
  206. if ($1 == access) { return $iif($readini($gfile(gatherinfo.ini),modes,access) == ON,$true,$false) }
  207. if ($1 == unlimpool) { return $iif($readini($gfile(gatherinfo.ini),modes,unlimpool) == ON,$true,$false) }
  208. if ($1 == unlimnoon) { return $iif($readini($gfile(gatherinfo.ini),modes,unlimnoon) == ON,$true,$false) }
  209. if ($1 == amx) { return $iif($readini($gfile(gatherinfo.ini),modes,amx) == ON,$true,$false) }
  210. if ($1 == stats) { return $iif($readini($gfile(gatherinfo.ini),modes,stats) == OFF,$false,$true) }
  211. if ($1 == overtime) { return $iif($readini($gfile(gatherinfo.ini),modes,overtime),$ifmatch,$false) }
  212. if ($1 == regions) { return $iif($readini($gfile(gatherinfo.ini),modes,regions),$ifmatch,$false) }
  213. if ($1 == adminreg) { return $iif($readini($gfile(gatherinfo.ini),modes,adminreg) == ON,$true,$false) }
  214. if ($1 == admingames) { return $iif($readini($gfile(gatherinfo.ini),modes,admingames) == ON,$true,$false) }
  215. if ($1 == topic) { return $iif($readini($gfile(gatherinfo.ini),modes,topic),$ifmatch,$false) }
  216. if ($1 == onlypro) { return $false }
  217. if ($1 == mysql) || ($1 == sql) { return $false }
  218. if ($1 == php.exe) { return $iif($readini($gfile(gatherinfo.ini),modes,php.exe) == ON,$true,$false) }
  219. if ($1 == mysql.exe) || ($1 == sql.exe) { return $iif($readini($gfile(gatherinfo.ini),modes,mysql.exe) == ON,$true,$false) }
  220. if ($1 == schat) { if ($ini($gfile(gatherinfo.ini),schat,0) >= 1) { return $true } | return $false }
  221. if ($1 == leavebans) { return $iif($readini($gfile(gatherinfo.ini),modes,leavebans) == OFF,$false,$true) }
  222. if ($1 == gotv) { return $iif($readini($gfile(gatherinfo.ini),modes,gotv) == ON,$true,$false) }
  223. if ($1 == cooldown) { return $iif($readini($gfile(gatherinfo.ini),modes,cooldown) == ON,$true,$false) }
  224. if ($1 == teams) { return $iif($readini($gfile(gatherinfo.ini),modes,teams) == ON,$true,$false) }
  225. if ($1 == maxstack) { return $iif($readini($gfile(gatherinfo.ini),modes,maxstack),$ifmatch,1) }
  226. if ($1 == timetojoin) { return $iif($readini($gfile(gatherinfo.ini),modes,timetojoin),$ifmatch,10) }
  227. if ($1 == timetoadv) { return $iif($readini($gfile(gatherinfo.ini),modes,timetoadv),$ifmatch,30) }
  228. if ($1 == timetoabortcl) { return $iif($readini($gfile(gatherinfo.ini),modes,timetoabortcl),$ifmatch,30) }
  229. if ($1 == timetoabortsg) { return $iif($readini($gfile(gatherinfo.ini),modes,timetoabortsg),$ifmatch,10) }
  230. if ($1 == timetoaccept) { return $iif($readini($gfile(gatherinfo.ini),modes,timetoacceptplayer),$ifmatch,1) }
  231. if ($1 == timetoacceptall) { return $iif($readini($gfile(gatherinfo.ini),modes,timetoacceptall),$ifmatch,2) }
  232. if ($1 == kickban) { return $iif($readini($gfile(gatherinfo.ini),modes,kickban),$ifmatch,0) }
  233. if ($1 == lameban) { return $iif($readini($gfile(gatherinfo.ini),modes,lameban),$ifmatch,0) }
  234. if (leaveban_* iswm $1) { return $iif($readini($gfile(gatherinfo.ini),modes,$1),$ifmatch,0) }
  235. if (color_* iswm $1) { return $iif($readini($gfile(gatherinfo.ini),modes,$1),$ifmatch,0) }
  236. if (disablecmd_* iswm $1) { return $iif($readini($gfile(gatherinfo.ini),disablecmd,$gettok($1,2,95)),$ifmatch,$false) }
  237. if ($1 == ftp) { var %x = $lower($2)
  238. var %host = $readini($gfile(gatherinfo.ini),ftp,host), %user = $readini($gfile(gatherinfo.ini),ftp,user), %pass = $readini($gfile(gatherinfo.ini),ftp,pass), %dir = $readini($gfile(gatherinfo.ini),ftp,dir), %url = $readini($gfile(gatherinfo.ini),ftp,url)
  239. if (%host) && (%user) && (%pass) && (%dir) && (%url) {
  240. if ($istok(host user pass dir url,%x,32)) { return % [ $+ [ %x ] ] }
  241. return %host %user %pass %dir %url
  242. }
  243. return $false
  244. }
  245. if ($ini($gfile(gatherservers.ini),$1)) { var %ip = $iif($1 isnum,$ini($gfile(gatherservers.ini),$1),$1)
  246. if ($2 != $null) { var %x = $iif($readini($gfile(gatherservers.ini),%ip,$2),$ifmatch,$ip) | if (*myip* iswm %x) { return $ip } | return %x }
  247. else {
  248. if ($readini($gfile(gatherservers.ini),%ip,error)) { return Error }
  249. if ($readini($gfile(gatherstatus.ini),info,ip) == %ip) { if ($ini($gfile(players.ini),%ip,0) < $readini($gfile(gatherstatus.ini),%ip,slots)) { if ($gatherstatus(accept)) { return Accept } | return Signup } | else { return Sending_Info } }
  250. if (($sock($+($srcon.prefix,%ip))) && ($readini($gfile(gatherstatus.ini),%ip,map))) || (($readini($gfile(gatherstatus.ini),%ip,gatheradmin)) && ($readini($gfile(gatherstatus.ini),%ip,start_time))) { if (%gatherpause. [ $+ [ %ip ] ]) { return Paused } | if (%gatherhold. [ $+ [ %ip ] ]) { return Round_End } | return $iif($readini($gfile(gatherservers.ini),%ip,status),$ifmatch,Connected) }
  251. if ($readini($gfile(gatherservers.ini),%ip,offline)) { return Offline }
  252. if ($readini($gfile(gatherservers.ini),%ip,cooldown) > $ctime) { return Cooldown }
  253. return Free
  254. }
  255. }
  256. return 0
  257. }
  258. alias gatherstatus {
  259. var %ip = $iif($readini($gfile(gatherstatus.ini),info,ip),$ifmatch,0) | if ($1 == ip) { return %ip }
  260. elseif ($1 == signup) || ($1 == sign) {
  261. if (%ip != 0) && (!$readini($gfile(gatherstatus.ini),%ip,accept)) {
  262. if ($ini($gfile(players.ini),%ip,0) < $readini($gfile(gatherstatus.ini),%ip,slots)) { return %ip }
  263. if (($readini($gfile(gatherstatus.ini),%ip,type) == Challenge) && (!$readini($gfile(gatherstatus.ini),%ip,clstatus)) && (($unlim(pool,%ip)) || ($unlim(noon)))) { return %ip }
  264. }
  265. return $false
  266. }
  267. elseif ($1 == signout) || ($1 == out) {
  268. if (%ip != 0) && (!$readini($gfile(gatherstatus.ini),%ip,accept)) {
  269. if ($ini($gfile(players.ini),%ip,0) < $readini($gfile(gatherstatus.ini),%ip,slots)) { return %ip }
  270. if ($readini($gfile(gatherstatus.ini),%ip,type) == Challenge) && (!$readini($gfile(gatherstatus.ini),%ip,clstatus)) { return %ip }
  271. }
  272. return $false
  273. }
  274. elseif ($1 == pick) { if (%ip != 0) && ($readini($gfile(gatherstatus.ini),%ip,type) == Challenge) && ($readini($gfile(gatherstatus.ini),%ip,clstatus) == Picking) || ((!$unlim(pool,%ip)) && (!$unlim(noon)) && ($ini($gfile(players.ini),%ip,0) == $readini($gfile(gatherstatus.ini),%ip,slots))) { return %ip } | return $false }
  275. elseif ($1 == accept) {
  276. if (%challenge) { var %x = $ifmatch, %accept = $gettok(%x,2,32) | return %accept }
  277. if (%ip != 0) && ($readini($gfile(gatherstatus.ini),%ip,accept)) { return $ifmatch } | return $false
  278. }
  279. elseif ($1 == teamgame) { if (%ip != 0) && ($readini($gfile(gatherstatus.ini),%ip,type) == TeamGame) { return %ip } | return $false }
  280. elseif ($1 == chan) { return $iif($readini($gfile(gatherstatus.ini),chan,$2),$ifmatch,0) }
  281. elseif ($2 == slots) { return $iif($readini($gfile(gatherstatus.ini),$1,slots),$ifmatch,0) }
  282. elseif ($2 == type) { return $iif($readini($gfile(gatherstatus.ini),$1,type),$ifmatch,0) }
  283. elseif ($2 == admin) || ($1 == gatheradmin) { return $iif($readini($gfile(gatherstatus.ini),$1,gatheradmin),$ifmatch,0) }
  284. elseif ($2 == cl) || ($1 == challenger) { return $iif($readini($gfile(gatherstatus.ini),$1,challenger),$ifmatch,0) }
  285. elseif ($2 == cl2) || ($1 == challenged) { return $iif($readini($gfile(gatherstatus.ini),$1,challenged),$ifmatch,0) }
  286. elseif ($2 == map) { return $iif($readini($gfile(gatherstatus.ini),$1,map),$ifmatch,0) }
  287. elseif ($2 == accept) { return $iif($readini($gfile(gatherstatus.ini),$1,accept),$ifmatch,0) }
  288. elseif ($2 == added) { return $ini($gfile(players.ini),$1,0) }
  289. elseif ($2 == region) { return $iif($readini($gfile(gatherservers.ini),$1,region),$ifmatch,n/a) }
  290. elseif ($1 == start) {
  291. var %gfile = $gfile(gatherservers.ini)
  292. if ($2) && ($gatherinfo(regions)) {
  293. var %regions = $ifmatch, %i = 1, %priorities, %nopriority | while (%i <= $ini(%gfile,0)) {
  294. var %ip = $ini(%gfile,%i), %region = $readini(%gfile,%ip,region), %priority = $readini(%gfile,%ip,priority)
  295. if ($serverstatus(%ip,clean) == Free) && ((%region == $2) || (%region iswm $2)) {
  296. if (%priority isnum) { var %priorities = $addtok(%priorities,%priority,32), %priority. [ $+ [ %priority ] ] %priority. [ $+ [ %priority ] ] %ip }
  297. else { var %nopriority = %nopriority %ip }
  298. }
  299. inc %i
  300. }
  301. if (%priorities) {
  302. var %priorities = $sorttok(%priorities,32), %nr = $gettok(%priorities,1,32), %numtok = $numtok(%priority. [ $+ [ %nr ] ],32), %rand = $rand(1,%numtok)
  303. return $gettok(%priority. [ $+ [ %nr ] ],%rand,32)
  304. }
  305. elseif (%nopriority) { var %numtok = $numtok(%nopriority,32), %rand = $rand(1,%numtok) | return $gettok(%nopriority,%rand,32) }
  306. return $false
  307. }
  308. else {
  309. if (old == new) {
  310. var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { var %ip = $ini($gfile(gatherservers.ini),%i) | if ($serverstatus(%ip,clean) == Free) { return %ip } | inc %i } | return $false
  311. }
  312. var %i = 1, %priorities, %nopriority | while (%i <= $ini(%gfile,0)) {
  313. var %ip = $ini(%gfile,%i), %priority = $readini(%gfile,%ip,priority)
  314. if ($serverstatus(%ip,clean) == Free) {
  315. if (%priority isnum) { var %priorities = $addtok(%priorities,%priority,32), %priority. [ $+ [ %priority ] ] %priority. [ $+ [ %priority ] ] %ip }
  316. else { var %nopriority = %nopriority %ip }
  317. }
  318. inc %i
  319. }
  320. if (%priorities) {
  321. var %priorities = $sorttok(%priorities,32), %nr = $gettok(%priorities,1,32), %numtok = $numtok(%priority. [ $+ [ %nr ] ],32), %rand = $rand(1,%numtok)
  322. return $gettok(%priority. [ $+ [ %nr ] ],%rand,32)
  323. }
  324. elseif (%nopriority) { var %numtok = $numtok(%nopriority,32), %rand = $rand(1,%numtok) | return $gettok(%nopriority,%rand,32) }
  325. return $false
  326. }
  327. }
  328. elseif ($1 == sub) { var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { if ($serverstatus(%i,sub)) { return $ini($gfile(gatherservers.ini),%i) } | inc %i } | return $false }
  329. elseif ($1 == servers) {
  330. var %i = 1, %servers = $null | while (%i <= $ini($gfile(gatherservers.ini),0)) { var %status = $serverstatus($ini($gfile(gatherservers.ini),%i)), %servers = $iif(%servers,$ifmatch $logo) $+($chr(35),%i,$chr(58)) $iif($serverstatus(%i,clean) == Free && $gatherinfo(regions), $+(%status,$col(14,$chr(40)),$readini($gfile(gatherservers.ini),$ini($gfile(gatherservers.ini),%i),region),$col(14,$chr(41))), %status) | inc %i }
  331. return $iif(%servers,$ifmatch,There is no server added)
  332. }
  333. elseif ($1 == topic) {
  334. var %i = 1, %n = 2, %ga = $iif($readini($gfile(gatherstatus.ini),%ip,gatheradmin),$ifmatch,0), %gauth = $gauth(%ga), %p = $null, %type = $readini($gfile(gatherstatus.ini),%ip,type), %region = $readini($gfile(gatherstatus.ini),%ip,region)
  335. if (%challenge) {
  336. var %x = $ifmatch, %cl = $gettok(%x,1,32), %accept = $gettok(%x,2,32), %ip = $gettok(%x,3,32), %map = $gettok(%x,4,32), %region = $readini($gfile(gatherstatus.ini),%ip,region)
  337. var %x = $timer(challenge).reps, %d = $timer(challenge).delay, %s = $timer(challenge).secs, %t = $iif(%x > 1,$calc((%x -1) * %d + %s),%s)
  338. return $anick(%cl) has challenged $iif(%accept == All,You?,$anick(%accept) $+ ) for a 1v1 $iif($gatherinfo(regions),$split Region: $+(,%region,)) $split Map: $iif(%map,$ifmatch,0) $+  $logo $iif(%accept == All,Anyone can use .accept ,Use .accept or .reject) $col(14,$chr(40)) $+ $duration(%t) $+ $col(14,$chr(41)) $logo
  339. }
  340. if (%type == Challenge) {
  341. var %cl = $readini($gfile(gatherstatus.ini),%ip,challenger), %cla = $gauth(%cl), %cl2 = $readini($gfile(gatherstatus.ini),%ip,challenged), %cl2a = $gauth(%cl2), %accept = $readini($gfile(gatherstatus.ini),%ip,accept), %n = 3, %p
  342. if (%accept) {
  343. var %accept = $ifmatch, %x = $timer(challenge).reps, %d = $timer(challenge).delay, %s = $timer(challenge).secs, %t = $iif(%x > 1,$calc((%x -1) * %d + %s),%s)
  344. return $anick(%cla) has challenged $iif(%accept == All,You?,$anick(%accept) $+ ) $iif($gatherinfo(regions),$split Region: $+(,%region,)) $split Map: $iif($readini($gfile(gatherstatus.ini),%ip,map),$ifmatch,0) $+  $logo $iif(%accept == All,Anyone can use .accept ,Use .accept or .reject) $col(14,$chr(40)) $+ $duration(%t) $+ $col(14,$chr(41)) $logo
  345. }
  346. var %players = $ini($gfile(players.ini),%ip,0), %slots = $iif($readini($gfile(gatherstatus.ini),%ip,slots),$ifmatch,10), %p = $+($anick(%cl),$chr(44)) $anick(%cl2)
  347. while (%i <= $ini($gfile(players.ini),%ip,0)) { var %x = $ini($gfile(players.ini),%ip,%i) | if (%x != %cl) && (%x != %cl2) { var %p = $iif(%p,$+(%p,$chr(44))) $anick(%x) | inc %n } | inc %i }
  348. return $iif($gatherinfo(regions), Region: $+(,%region,) $split) Map: $iif($readini($gfile(gatherstatus.ini),%ip,map),$ifmatch,0) $logo Players: %p $iif(($unlim(pool)) || (($unlim(noon)) && ($time < 12)),$+($chr(40),$iif(%players >= %slots,$col(09,%players),$col(04,%players)),$chr(41)),$+($chr(40),%players,/,%slots,$chr(41)))
  349. }
  350. else {
  351. var %p = $anick(%ga) | while (%i <= $ini($gfile(players.ini),%ip,0)) { var %x = $ini($gfile(players.ini),%ip,%i) | if (%x != %ga) { var %p = $iif(%p,$+(%p,$chr(44))) $anick(%x) | inc %n } | inc %i }
  352. return $iif($gatherinfo(regions), Region: $+(,%region,) $split) Map: $iif($readini($gfile(gatherstatus.ini),%ip,map),$ifmatch,0) $logo Players: %p $split ( $+ $ini($gfile(players.ini),%ip,0) $+ / $+ $iif($readini($gfile(gatherstatus.ini),%ip,slots),$ifmatch,10) $+ )
  353. }
  354. }
  355. elseif ($ini($gfile(gatherservers.ini),$1)) { var %ip = $iif($1 isnum,$ini($gfile(gatherservers.ini),$1),$1)
  356. if ($2 != $null) {
  357. if ($2 == status) && ($gettok(%challenge,3,32) == %ip) { return Accept }
  358. return $iif($readini($gfile(gatherstatus.ini),%ip,$2),$ifmatch,0)
  359. }
  360. else {
  361. if ($readini($gfile(gatherservers.ini),%ip,error)) { return Error }
  362. if ($gettok(%challenge,3,32) == %ip) { return Accept }
  363. if ($readini($gfile(gatherstatus.ini),info,ip) == %ip) {
  364. if ($ini($gfile(players.ini),%ip,0) < $readini($gfile(gatherstatus.ini),%ip,slots)) {
  365. if ($readini($gfile(gatherstatus.ini),%ip,accept)) { return Accept } | return Signup
  366. }
  367. elseif (($unlim(pool,%ip)) || ($unlim(noon))) && (!$readini($gfile(gatherstatus.ini),%ip,clstatus)) { return Signup }
  368. elseif ($readini($gfile(gatherstatus.ini),%ip,picker)) && ($readini($gfile(gatherstatus.ini),%ip,clstatus) != Closed) { return $iif($readini($gfile(gatherstatus.ini),%ip,clstatus),$ifmatch,Picking) }
  369. else { return Sending_Info }
  370. }
  371. if (($sock($+($srcon.prefix,%ip))) && ($readini($gfile(gatherstatus.ini),%ip,map))) || (($readini($gfile(gatherstatus.ini),%ip,gatheradmin)) && ($readini($gfile(gatherstatus.ini),%ip,start_time))) {
  372. if ($readini($gfile(gatherstatus.ini),%ip,error)) { return Started } | if (%gatherpause. [ $+ [ %ip ] ]) { return Paused } | if (%gatherhold. [ $+ [ %ip ] ]) { return Round_End } | return $iif($readini($gfile(gatherservers.ini),%ip,status),$ifmatch,Connected)
  373. }
  374. if ($readini($gfile(gatherservers.ini),%ip,offline)) { return Offline }
  375. if ($readini($gfile(gatherservers.ini),%ip,cooldown) > $ctime) { return Cooldown }
  376. return Free
  377. }
  378. }
  379. return Error
  380. }
  381. alias serverstatus {
  382. if ($ini($gfile(gatherservers.ini),$1)) {
  383. var %ip = $iif($1 isnum,$ini($gfile(gatherservers.ini),$1),$1), %status = $gatherstatus(%ip), %error
  384. if ($2 == clean) { return $iif(%status,$ifmatch,Error) }
  385. if ($2 == ingame) {
  386. if ($readini($gfile(gatherstatus.ini),%ip,gatheradmin)) && ($readini($gfile(gatherstatus.ini),%ip,start_time)) && ($readini($gfile(gatherservers.ini),%ip,status) != Ended) {
  387. if ($readini($gfile(gatherstatus.ini),%ip,error)) { return Started }
  388. if (%gatherpause. [ $+ [ %ip ] ]) { return Paused } | if (%gatherhold. [ $+ [ $1 ] ]) { return Round_End } | return $iif($readini($gfile(gatherservers.ini),%ip,status),$ifmatch,Connecting)
  389. }
  390. return $false
  391. }
  392. if ($2 == sub) {
  393. if (($readini($gfile(gatherstatus.ini),%ip,t_subs)) || ($readini($gfile(gatherstatus.ini),%ip,ct_subs))) {
  394. if (%status != Error) && (%status != Offline) && (%status != Signup) && (%status != Free) && (%status != Ended) { return %ip }
  395. }
  396. if ($timer(submsg. [ $+ [ %ip ] ])) { .timersubmsg. [ $+ [ %ip ] ] off } | return $false
  397. }
  398. if ($readini($gfile(gatherservers.ini),%ip,error)) { var %x = $ifmatch | return $col(04,Error) $+ $col(14,$chr(40)) $+ %x $+ $col(14,$chr(41)) }
  399. if ($gettok(%challenge,3,32) == %ip) { var %x = $ifmatch, %cl = $gettok(%x,1,32), %accept = $gettok(%x,2,32)
  400. return $col(07,Accept) $+ $col(14,$chr(40)) $+ $anick(%cl) $+ '1vs1' $+ $iif(%accept == All,You?,$anick(%accept)) $+ $col(14,$chr(41))
  401. }
  402. if ($readini($gfile(gatherstatus.ini),info,ip) == %ip) { var %type = $gatherstatus(%ip,type), %players = $ini($gfile(players.ini),%ip,0), %slots = $gatherstatus(%ip,slots)
  403. if ($ini($gfile(players.ini),%ip,0) < $readini($gfile(gatherstatus.ini),%ip,slots)) {
  404. if ($gatherstatus(accept)) { var %accept = $ifmatch, %cl = $readini($gfile(gatherstatus.ini),%ip,challenger) | return $col(07,Accept) $+ $col(14,$chr(40)) $+ $anick(%cl) $+ 'vs' $+ $iif(%accept == All,You?,$anick(%accept)) $+ $col(14,$chr(41)) }
  405. if ($gatherstatus(%ip,type) == BRush) { var %x = $col(07,BRush-Signup) } | else { var %x = $col(07,Signup) }
  406. }
  407. elseif (($unlim(pool,%ip)) || ($unlim(noon))) && (!$readini($gfile(gatherstatus.ini),%ip,clstatus)) { var %x = $col(09,Signup) }
  408. elseif ($readini($gfile(gatherstatus.ini),%ip,picker)) && ($readini($gfile(gatherstatus.ini),%ip,clstatus) != Closed) { var %x = $col(09,$iif($readini($gfile(gatherstatus.ini),%ip,clstatus),$ifmatch,Picking)) } | else { var %x = $col(09,Sending_Info) }
  409. return %x $+ $col(14,$chr(40)) $+ $+($col(14,$readini($gfile(gatherstatus.ini),%ip,map)),$col(14,$chr(91)),$iif((%type == Challenge) && (($unlim(pool)) || (($unlim(noon)) && ($time < 12))),$+($iif(%players >= %slots,$col(09,%players),$col(04,%players))),$+(%players,/,%slots)),$col(14,$chr(93))) $+ $col(14,$chr(41))
  410. }
  411. if (($sock($+($srcon.prefix,%ip))) && ($readini($gfile(gatherstatus.ini),%ip,map))) || (($readini($gfile(gatherstatus.ini),%ip,gatheradmin)) && ($readini($gfile(gatherstatus.ini),%ip,start_time))) {
  412. if ($readini($gfile(gatherstatus.ini),%ip,error)) { var %x = $col(04,Started), %error = $true } | elseif (%gatherpause. [ $+ [ %ip ] ]) { var %x = $col(04,Paused) }
  413. elseif (%gatherhold. [ $+ [ $1 ] ]) { var %x = $col(04,Round_End) } | else { var %x = $col(04,$iif($readini($gfile(gatherservers.ini),%ip,status),$ifmatch,Connected)) }
  414. if (%error) {
  415. var %ctime = $duration($calc($ctime - $ctime($readini($gfile(gatherstatus.ini),%ip,start_time))))
  416. return $+(%x,$col(14,$chr(40)),$col(14,$readini($gfile(gatherstatus.ini),%ip,map)),$col(14,$chr(91)),%ctime,$col(14,$chr(93)),$col(14,$chr(41)))
  417. }
  418. else {
  419. return $+(%x,$col(14,$chr(40)),$col(14,$readini($gfile(gatherstatus.ini),%ip,map)),$col(14,$chr(91)),,$col(11,$score(%ip,ct)),,$col(14,-),,$col(04,$score(%ip,t)),,$col(14,$chr(93)),$col(14,$chr(41)))
  420. }
  421. return %x $+ $col(14,$chr(40)) $+ $col(14,$readini($gfile(gatherstatus.ini),%ip,map)) $+ $iif(!%error,$+($col(14,$chr(91)),,$col(11,$score(%ip,ct)),,$col(14,-),,$col(04,$score(%ip,t)),,$col(14,$chr(93)))) $+ $col(14,$chr(41))
  422. }
  423. if ($readini($gfile(gatherservers.ini),%ip,offline)) { var %x = $ifmatch | return $col(04,Offline) $+ $iif(%x != n/a,$col(14,$chr(40)) $+ %x $+ $col(14,$chr(41))) }
  424. if ($readini($gfile(gatherservers.ini),%ip,cooldown) > $ctime) {
  425. var %x = $readini($gfile(gatherservers.ini),%ip,cooldown), %t = $calc(%x - $ctime)
  426. return $col(04,Cooldown) $+ $col(14,$chr(40)) $+ $duration(%t) $+ $col(14,$chr(41))
  427. }
  428. if ($readini($gfile(gatherservers.ini),%ip,name)) { var %x = $ifmatch | return $col(09,Free) $+ $iif(%x != n/a,$col(14,$chr(40)) $+ %x $+ $col(14,$chr(41))) }
  429. return $col(09,Free)
  430. }
  431. return $iif($2 != clean,$iif($2 == sub,$false,$+($col(04,Error),$col(14,$chr(40)),Missing IP,$col(14,$chr(41)))),Error)
  432. }
  433. alias settopic {
  434. if (!$gatherinfo(topic)) || ($me !isop $mainchan) { return }
  435. var %topic = $c_text($me,$gatherinfo(topic))
  436. if ($gatherstatus(signup)) {
  437. var %ip = $ifmatch
  438. if ($gatherstatus(%ip,type) == Challenge) {
  439. var %cl = $gauth($readini($gfile(gatherstatus.ini),%ip,challenger)), %cl2 = $gauth($readini($gfile(gatherstatus.ini),%ip,challenged))
  440. var %topic = $col(start) $+ %topic $split Signup is open at the moment, $+(,%cl,) and $+(,%cl2,) are the leaders
  441. }
  442. else { var %topic = $col(start) $+ %topic $split Signup is open at the moment }
  443. if ($chan($mainchan).topic != %topic) { topic $mainchan %topic }
  444. return
  445. }
  446. var %i = 1, %progress = 0 | while ($serverid(get,%i)) { var %ip = $ifmatch | if ($serverinuse(%ip)) { inc %progress } | inc %i }
  447. if (%progress > 0) { var %topic = $col(start) $+ %topic $split Games in progress: $+(,%progress,) }
  448. if ($chan($mainchan).topic != %topic) { topic $mainchan %topic }
  449. }
  450. alias userdata { if ($gsteamid($1)) { var %steamid = $ifmatch, %gfile = $gfile(userdata.ini) | return $iif($readini(%gfile,%steamid,$2),$ifmatch,n/a) } | return n/a }
  451. alias gatherstats { var %gfile = $gfile(gatherstats.ini), %x = $iif($readini(%gfile,$1,$2),$ifmatch,$iif($2 == points,1000,0)) | return $iif($2 == points,$round(%x,2),%x) }
  452. alias clutchstats { var %gfile = $gfile(clutchstats.ini) | return $iif($readini(%gfile,$1,$2),$ifmatch,0) }
  453. alias cstats { var %gfile = $gfile(clutchstats.ini) | return $iif($readini(%gfile,$1,$2),$ifmatch,0) }
  454. alias hitstats { var %gfile = $gfile(hitstats.ini) | return $iif($readini(%gfile,$1,$2),$ifmatch,0) }
  455. alias wepstats { var %gfile = $gfile(wepstats.ini) | return $iif($readini(%gfile,$1,$2),$ifmatch,0) }
  456. alias teamstats { var %gfile = $gfile(teamstats.ini), %x = $iif($readini(%gfile,$1,$2),$ifmatch,$iif($2 == points,1000,0)) | return $iif($2 == points,$round(%x,2),%x) }
  457.  
  458. #################################### ON KICK/PART/QUIT/NICK part ##########################################
  459.  
  460. alias onjoin { set -u5 %startflood 1 | flood 250 10 3 10 | write -c $gfile(authed.dat) | whatcmd who $iif($1,$1,$iif($chan,$chan,$mainchan)) n%na | .timeronjoin off }
  461. alias onstart { setmynick | .timer 1 0.5 myip | .timer 1 2 refresh }
  462. alias refresh {
  463. if ($1 != 0) && ($ini($gfile(gatherservers.ini),$1)) { var %ip = $iif($1 isnum,$ini($gfile(gatherservers.ini),$1),$1), %status = $gatherstatus(%ip) | if ($serverstatus(%ip,ingame)) && (%status != Ended) { remini -n $gfile(gatherstatus.ini) %ip error | challenge %ip | return %ip } | return $false }
  464. var %i = 1, %x = 0 | while ($ini($gfile(gatherservers.ini),%i)) { var %ip = $ifmatch, %status = $gatherstatus(%ip) | if ($serverstatus(%ip,ingame)) && (%status != Ended) { remini -n $gfile(gatherstatus.ini) %ip error | .timerrecheck. [ $+ [ $1 ] ] 1 %x rechecksocket %ip | inc %x 0.5 } | inc %i }
  465. }
  466. on *:INVITE:#:{
  467. if ($nick != $Qbot) && ($Qhidden !iswm $address($me,2)) { return }
  468. if ($istok($mainchan $privchan $ownerchan,$chan,32)) { whatcmd raw join $chan }
  469. }
  470. on *:DISCONNECT:{ ;.timerconnect -o 1 60 server irc.quakenet.org:6667 | .timerc.* off }
  471. on *:START:{ onstart }
  472. on *:CONNECT:{
  473. if ($timer(connect)) { .timerconnect off }
  474. if ($window(@glist)) { clear @glist }
  475. if ($me ison $mainchan) { .timeronjoin 1 10 onjoin }
  476. write -c $gfile(authed.dat) | unset %tmp.* | set -u30 %tmp.antiflood 1 | .timer 1 0 rload | .timer 1 1 refresh | .timer 1 2 checktimers | .timerc.1 1 5 .authing
  477. }
  478. on *:NICK:{
  479. if ($nick == $me) && ($network == Aitvaras || $network == GRNet) {
  480. if ($newnick == $mynick) { authing } | else { if (!$timer(mynick)) { .timermynick 1 60 setmynick } }
  481. }
  482. if ($read($gfile(authed.dat),s,$nick)) { var %ifmatch = $ifmatch | write -l $+ $readn $gfile(authed.dat) $newnick %ifmatch }
  483. if ($nick ison $mainchan) { logchan ? Nick: $nick is now known as $newnick }
  484. }
  485. on *:JOIN:$($mainchan):{
  486. if ($nick == $me) && ($Qhidden !iswm $address($me,2)) && ($network != Aitvaras && $network != GRNet) { join #0,0 | return }
  487. if (!%startflood) {
  488. if ($nick != $me) && ($nick != $Qbot) && ($nick != S) { var %addr = $address($nick,2), %auth = $gettok($gettok(%addr,2,64),1,46)
  489. if ($Qaddr iswm %addr) { reguser $nick $iif(%auth,$ifmatch,0) } | elseif (!%joinflood) { set -u1 %joinflood 1 | whatcmd who $nick n%na }
  490. }
  491. elseif ($nick == $me) { onjoin $chan }
  492. }
  493. elseif ($nick == $me) { onjoin $chan }
  494. logchan ? Join: $nick ( $+ $address($nick,1) $+ )
  495. }
  496. on ^*:JOIN:$($privchan):{
  497. if ($nick == $me) && ($Qhidden !iswm $address($me,2)) && ($network != Aitvaras && $network != GRNet) { join #0,0 | return }
  498. if ($chan != $mainchan) && ($me isop $chan) && ($nick != $me) && ($nick != $Qbot) && ($nick != S) {
  499. var %addr = $address($nick,2), %auth = $gettok($gettok(%addr,2,64),1,46)
  500. if ($gauth($nick)) { var %auth = $ifmatch
  501. if ($admin($+($chr(35),%auth)) >= 7) { .timer 1 1 $iif($script(pushmode.mrc),pushmode -l,putmode) $chan +o $nick }
  502. ;else { ban -ku30 $chan $nick 1 $logo You are not allowed to join this channel $split Reason: You're not an admin! $logo }
  503. }
  504. elseif ($Qaddr iswm %addr) && (%auth) {
  505. if ($admin($+($chr(35),%auth)) >= 7) { reguser $nick %auth | .timer 1 1 $iif($script(pushmode.mrc),pushmode -l,putmode) $chan +o $nick }
  506. ;else { ban -ku30 $chan $nick 1 $logo You are not allowed to join this channel $split Reason: You're not an admin! $logo }
  507. }
  508. ;else { ban -ku30 $chan $nick 1 $logo You are not allowed to join this channel $split Reason: You're not authed! $logo }
  509. }
  510. }
  511. on *:KICK:$($mainchan):{ remfromgather $knick
  512. if ($knick != $me) && ($read($gfile(authed.dat),s,$knick)) { var %s = $gettok($ifmatch,2,32) | write -ds $+ $knick $gfile(authed.dat) | if (%s) { writeini -n $gfile(userdata.ini) %s lastnick $knick } }
  513. }
  514. on *:PART:$($mainchan):{ remfromgather $nick
  515. if ($nick != $me) && ($read($gfile(authed.dat),s,$nick)) { var %s = $gettok($ifmatch,2,32) | write -ds $+ $nick $gfile(authed.dat) | if (%s) { writeini -n $gfile(userdata.ini) %s lastnick $nick } }
  516. }
  517. on *:QUIT:{
  518. if ($1 != Registered) { remfromgather $nick
  519. if ($nick != $me) && ($read($gfile(authed.dat),s,$nick)) { var %s = $gettok($ifmatch,2,32) | write -ds $+ $nick $gfile(authed.dat) | if (%s) { writeini -n $gfile(userdata.ini) %s lastnick $nick } }
  520. }
  521. }
  522. alias findnewadmin {
  523. var %ip = $1, %ga = $gatherstatus(%ip,gatheradmin), %i = 1 | while (%i <= $ini($gfile(players.ini),%ip,0)) {
  524. var %newadmin = $ini($gfile(players.ini),%ip,%i), %auth = $gauth(%newadmin) | if (%ga != %newadmin) && ($admin($+($chr(35),%auth)) >= 8) { return %newadmin 8 } | inc %i
  525. }
  526. return $iif($ini($gfile(players.ini),%ip,1),$ifmatch,:gatherbot:)
  527. }
  528. alias remfromgather {
  529. if ($gatherstatus(signout)) && ($gsteamid($1)) { var %steamid = $ifmatch, %ip = $gatherstatus(ip)
  530. if ($readini($gfile(players.ini),%ip,%steamid)) { var %type = $gatherstatus(%ip,type), %ga = $gatherstatus(%ip,gatheradmin), %added = $gatherstatus(%ip,added)
  531. if (%type == Challenge) && ((%steamid == $gatherstatus(%ip,challenger)) || (%steamid == $gatherstatus(%ip,challenged))) {
  532. resetall %ip | whatcmd settopic | .timeradded 1 0 whatcmd $meorsay $iif($me ison $2,$2,$mainchan) $logo $anick($1) $iif($iif($me ison $2,$3-,$2-),$ifmatch,left the channel) $+ , the gather is therefore stopped $logo | .timerendsignup off
  533. }
  534. elseif (%added > 1) {
  535. if (%added < $gatherstatus(%ip,slots)) || ((%type == Challenge) && (!$gatherstatus(%ip,clstatus))) { remini -n $gfile(players.ini) %ip %steamid | endsigntimer %type
  536. if ($readini($gfile(gatherstatus.ini),%ip,picker)) { remini -n $gfile(gatherstatus.ini) %ip picker }
  537. if ($istack(%ip,%steamid)) { var %stack = $ifmatch | remini -n $gfile(stacks.ini) %ip %stack }
  538. if (%ga == %steamid) {
  539. var %new = $findnewadmin(%ip), %newga = $gettok(%new,1,32), %level = $gettok(%new,2,32) | writeini -n $gfile(gatherstatus.ini) %ip gatheradmin %newga
  540. if (%level < 8) && (%type != Challenge) { writeini -n $gfile(gatherstatus.ini) %ip type Public | var %type = Public }
  541. elseif (%level >= 8) && (%type == Public) { writeini -n $gfile(gatherstatus.ini) %ip type Admin | var %type = Admin }
  542. }
  543. }
  544. }
  545. else { resetall %ip | whatcmd settopic | .timeradded 1 0 whatcmd $meorsay $iif($me ison $2,$2,$mainchan) $logo $anick($1) $iif($iif($me ison $2,$3-,$2-),$ifmatch,left the channel) $+ , the gather is therefore stopped $logo | .timerendsignup off }
  546. }
  547. }
  548. }
  549.  
  550. ;#################################### Alias to get nick/auth/steamid/admin level ##########################################;
  551.  
  552. alias isonchans {
  553. if ($1 ison $chan) || ($1 ison $mainchan) || ($1 ison $privchan) || ($1 ison $ownerchan) || ($comchan($1,0)) { return $true }
  554. return $false
  555. }
  556. alias cleanit { return $strip($remove($1-,$chr(35),$chr(63),$chr(42))) }
  557. alias cleanit2 { return $strip($remove($1-,$chr(63),$chr(42))) }
  558. alias ginfo {
  559. if ($gauth($1)) { var %a = $ifmatch, %n = $colnick($+($chr(35),%a)), %s = $gsteamid($+($chr(35),%a)) | return %n %a %s }
  560. return 0
  561. }
  562. alias colnick {
  563. var %who = $cleanit($1), %nick, %auth
  564. if (!%who) { return 0 }
  565. if ($1 == :me:) || ($1 == :gatherbot:) || ($1 == $me) { return $me }
  566. if ($left($1,1) == $chr(35)) {
  567. if ($read($gfile(authed.dat),w,* %who *)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  568. if ($read($gfile(gatherusers.dat),w,%who *)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  569. return $+($chr(35),%who)
  570. }
  571. if (STEAM_*:*:* iswm %who) {
  572. if ($read($gfile(authed.dat),w,* %who)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  573. if ($read($gfile(gatherusers.dat),w,* %who)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  574. return %who
  575. }
  576. if ($read($gfile(authed.dat),w,%who *)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  577. if ($isonchans(%who)) { return %who }
  578. if ($read($gfile(authed.dat),w,* %who)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  579. if ($read($gfile(authed.dat),w,* %who *)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  580. if ($read($gfile(gatherusers.dat),w,%who *)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  581. if ($read($gfile(gatherusers.dat),w,* %who)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  582. return 0
  583. :next
  584. if (%auth) {
  585. if (!%nick) { var %n = $readini($gfile(userdata.ini),%id,lastnick), %nick = $iif(%n,%n,$+($chr(35),%auth)) }
  586. if ($admin($+($chr(35),%auth))) { var %level = $ifmatch | return $col($admincol(%level),%nick) }
  587. return %nick
  588. }
  589. return %who
  590. }
  591. alias anick {
  592. var %who = $cleanit($1), %nick, %auth
  593. if (!%who) { return 0 }
  594. if ($1 == :me:) || ($1 == :gatherbot:) || ($1 == $me) { return $me }
  595. if ($left($1,1) == $chr(35)) {
  596. if ($read($gfile(authed.dat),w,* %who *)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  597. if ($read($gfile(gatherusers.dat),w,%who *)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  598. return $+($chr(35),%who)
  599. }
  600. if (STEAM_*:*:* iswm %who) {
  601. if ($read($gfile(authed.dat),w,* %who)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  602. if ($read($gfile(gatherusers.dat),w,* %who)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  603. return %who
  604. }
  605. if ($read($gfile(authed.dat),w,%who *)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  606. if ($isonchans(%who)) { return %who }
  607. if ($read($gfile(authed.dat),w,* %who)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  608. if ($read($gfile(authed.dat),w,* %who *)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32), %id = $gettok($ifmatch,3,32) | goto next }
  609. if ($read($gfile(gatherusers.dat),w,%who *)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  610. if ($read($gfile(gatherusers.dat),w,* %who)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  611. return 0
  612. :next
  613. if (%auth) {
  614. if (!%nick) { var %n = $readini($gfile(userdata.ini),%id,lastnick), %nick = $iif(%n,$iif(%n != %auth,$+(%n,$col(05,$chr(91)),%auth,$col(05,$chr(93))),%n),$+($chr(35),%auth)) }
  615. if ($adminonly($+($chr(35),%auth))) { var %level = $ifmatch | return $col($admincol(%level),%nick) }
  616. return %nick
  617. }
  618. return %who
  619. }
  620. alias gnick {
  621. var %who = $cleanit($1)
  622. if (!%who) { return 0 }
  623. if ($1 == :me:) || ($1 == :gatherbot:) || ($1 == $me) { return $me }
  624. if ($left($1,1) == $chr(35)) {
  625. if ($read($gfile(authed.dat),w,* %who *)) { return $gettok($ifmatch,1,32) }
  626. if ($read($gfile(gatherusers.dat),w,%who *)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  627. return $+($chr(35),%who)
  628. }
  629. if (STEAM_*:*:* iswm %who) {
  630. if ($read($gfile(authed.dat),w,* %who)) { return $gettok($ifmatch,1,32) }
  631. if ($read($gfile(gatherusers.dat),w,* %who)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  632. return %who
  633. }
  634. if ($read($gfile(authed.dat),w,%who *)) { return $gettok($ifmatch,1,32) }
  635. if ($isonchans(%who)) { return %who }
  636. if ($read($gfile(authed.dat),w,* %who)) { return $gettok($ifmatch,1,32) }
  637. if ($read($gfile(authed.dat),w,* %who *)) { return $gettok($ifmatch,1,32) }
  638. if ($read($gfile(gatherusers.dat),w,%who *)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  639. if ($read($gfile(gatherusers.dat),w,* %who)) { var %auth = $gettok($ifmatch,1,32), %id = $gettok($ifmatch,2,32) | goto next }
  640. return 0
  641. :next
  642. return $iif($readini($gfile(userdata.ini),%id,lastnick),$ifmatch,$iif(%auth,$+($chr(35),%auth),0))
  643. }
  644. alias gauth {
  645. var %who = $cleanit($1)
  646. if (!%who) { return 0 }
  647. if ($1 == :me:) || ($1 == :gatherbot:) || ($1 == $me) { return $me }
  648. if ($left($1,1) == $chr(35)) {
  649. if ($read($gfile(gatherusers.dat),w,%who *)) { return $gettok($ifmatch,1,32) }
  650. if ($read($gfile(authed.dat),w,* %who *)) { return $gettok($ifmatch,2,32) }
  651. return 0
  652. }
  653. if (STEAM_*:*:* iswm %who) {
  654. if ($read($gfile(gatherusers.dat),w,* %who)) { return $gettok($ifmatch,1,32) }
  655. if ($read($gfile(authed.dat),w,* %who)) { return $gettok($ifmatch,2,32) }
  656. return 0
  657. }
  658. if ($read($gfile(authed.dat),s,%who)) { return $gettok($ifmatch,1,32) }
  659. if ($isonchans(%who)) { return 0 }
  660. if ($read($gfile(authed.dat),w,* %who)) { return $gettok($ifmatch,2,32) }
  661. if ($read($gfile(authed.dat),w,* %who *)) { return $gettok($ifmatch,2,32) }
  662. if ($read($gfile(gatherusers.dat),w,%who *)) { return $gettok($ifmatch,1,32) }
  663. if ($read($gfile(gatherusers.dat),w,* %who)) { return $gettok($ifmatch,1,32) }
  664. return 0
  665. }
  666. alias gsteamid {
  667. var %who = $cleanit($1), %wnick = $cleanit2($1)
  668. if (!%who) { return 0 }
  669. if ($1 == :me:) || ($1 == :gatherbot:) || ($1 == $me) { return $me }
  670. if ($left($1,1) == $chr(35)) {
  671. if ($read($gfile(gatherusers.dat),w,%who *)) { return $gettok($ifmatch,2,32) }
  672. if ($read($gfile(authed.dat),w,* %who *)) { return $gettok($ifmatch,3,32) }
  673. return 0
  674. }
  675. if (STEAM_*:*:* iswm %who) {
  676. if ($read($gfile(gatherusers.dat),w,* %who)) { return $gettok($ifmatch,2,32) }
  677. if ($read($gfile(authed.dat),w,* %who)) { return $gettok($ifmatch,3,32) }
  678. return 0
  679. }
  680. if ($read($gfile(authed.dat),s,%who)) { return $gettok($ifmatch,2,32) }
  681. if ($isonchans(%who)) { return 0 }
  682. if ($read($gfile(authed.dat),w,* %who)) { return $gettok($ifmatch,3,32) }
  683. if ($read($gfile(authed.dat),w,* %who *)) { return $gettok($ifmatch,3,32) }
  684. if ($read($gfile(gatherusers.dat),w,%who *)) { return $gettok($ifmatch,2,32) }
  685. if ($read($gfile(gatherusers.dat),w,* %who)) { return $gettok($ifmatch,2,32) }
  686. return 0
  687. }
  688. alias admin {
  689. if ($gauth($1)) { var %auth = $ifmatch, %i = 10
  690. if ($istok($headadmins,%auth,32)) { return 10 }
  691. while ($adminid(%i)) { var %type = $ifmatch | if ($readini($gfile(gatheradmins.ini),%type,%auth)) { return %i } | dec %i }
  692. return $iif($readini($gfile(gatheradmins.ini),Owner,%auth),10,0)
  693. }
  694. return 0
  695. }
  696. alias adminonly {
  697. if ($gauth($1)) { var %auth = $ifmatch, %i = 10
  698. while ($adminid(%i)) { var %type = $ifmatch | if ($readini($gfile(gatheradmins.ini),%type,%auth)) { return %i } | dec %i }
  699. return $iif($readini($gfile(gatheradmins.ini),Owner,%auth),10,0)
  700. }
  701. return 0
  702. }
  703. alias gadmin {
  704. var %ip = $1, %id = $2, %ga = $gatherstatus(%ip,gatheradmin), %cl1 = $gatherstatus(%ip,challenger), %cl2 = $gatherstatus(%ip,challenged), %auth = $gauth(%id), %gauth = $gauth(%ga), %admin = $admin($+($chr(35),%auth))
  705. if ($istok(%ga %cl1 %cl2,%id,32)) || ((%admin >= 8) && (%admin >= $admin($+($chr(35),%gauth)))) { return $true } | return $false
  706. }
  707. alias sadmin {
  708. var %ip = $1, %id = $2, %ga = $gatherstatus(%ip,gatheradmin), %auth = $gauth(%id), %admin = $admin($+($chr(35),%auth))
  709. if (%admin >= 8) && (($istok(%ga,%id,32)) || (%admin >= $admin($+($chr(35),%gauth)))) { return $true } | return $false
  710. }
  711.  
  712. ;#################################### Alias to mixteams ##########################################;
  713.  
  714. alias mute { var %chan = $iif($me ison $1,$1,$mainchan) | if ($me isop %chan) && (m !isincs $chan(%chan).mode) { mode %chan +m } }
  715. alias unmute { var %chan = $iif($me ison $1,$1,$mainchan) | if ($me isop %chan) && (m isincs $chan(%chan).mode) { mode %chan -m } }
  716. alias noticechan { if ($me ison $1) { if (N !isincs $chan($1).mode) { whatcmd notice $1 $2- } | else { whatcmd $meorsay $1 $2- } } }
  717. alias istack {
  718. var %i = 1 | while ($ini($gfile(stacks.ini),$1,%i)) { var %x = $ifmatch, %p = $readini($gfile(stacks.ini),$1,%x) | if ($istok(%p,$2,32)) { return %x } | inc %i }
  719. return $false
  720. }
  721. alias checkrematch {
  722. var %i = 1, %gfile = $gfile(rematch.ini) | while ($ini(%gfile,%i)) {
  723. var %mid = $ifmatch, %id = $remove(%mid,id_), %slots = $calc($left($readini($gfile(gatherids.ini),%id,type),1) *2), %time = $calc($ctime - $ctime($readini($gfile(gatherids.ini),%id,Ended)))
  724. if ($ini(%gfile,%mid,0) == %slots) { return %id }
  725. if (%time >= 7200) { remini -n %gfile %mid } | else { inc %i }
  726. }
  727. return $false
  728. }
  729. alias rematch {
  730. if ($1 !isnum) || (%ignore) { return }
  731. var %id = $1, %mid = $+(id_,%id), %ip = $gatherstatus(start), %gfile = $gfile(rematch.ini), %slots = $calc($left($readini($gfile(gatherids.ini),%id,type),1) *2)
  732. if (!$ini(%gfile,%mid,0)) || ($ini(%gfile,%mid,0) != %slots) {
  733. var %time = $calc($ctime - $ctime($readini($gfile(gatherids.ini),%id,Ended)))
  734. if (%time < 7200) { .timerre. [ $+ [ %id ] ] 1 $calc(7200 - %time + 1) rematch %id }
  735. else {
  736. if ($ini(%gfile,%mid,0) >= 1) { whatcmd $meorsay $mainchan $logo Rematch on Gather ID $+($chr(35),%id) did not get full in time! $logo }
  737. remini -n %gfile %mid | .timerre. [ $+ [ %id ] ] off
  738. }
  739. return
  740. }
  741. if (!%ip) { whatcmd $meorsay $mainchan $logo Rematch on Gather ID $+($chr(35),%id) will auto. start when a server is available $logo | return }
  742. myip | resetall %ip | writeini -n $gfile(gatherstatus.ini) info ip %ip
  743. writeini -n $gfile(gatherstatus.ini) %ip gatheradmin $ini(%gfile,%mid,1) | writeini -n $gfile(gatherstatus.ini) %ip slots %slots | writeini -n $gfile(gatherstatus.ini) %ip type Rematch
  744. var %i = 1, %team.ct = $readini($gfile(gatherids.ini),%id,CT), %team.t = $readini($gfile(gatherids.ini),%id,TERRORIST), %team = $rand(1,2), %t_p = 0, %ct_p = 0, %t, %ct, %maps
  745. while ($ini(%gfile,%mid,%i)) {
  746. var %sid = $ifmatch, %auth = $gauth(%sid), %x = $readini(%gfile,%mid,%sid), %vote. [ $+ [ %x ] ] $calc(%vote. [ $+ [ %x ] ] +1)
  747. if ($istok(%team.ct,%sid,32)) || ($istok(%team.ct,%auth,32)) { var %now = $iif(%team == 1,counter.ini,terrorist.ini) } | else { var %now = $iif(%team == 2,counter.ini,terrorist.ini) }
  748. writeini -n $gfile(players.ini) %ip %sid %sid | writeini -n $gfile(%now) %ip %sid %sid
  749. if (%now == counter.ini) { var %p = $getpoints(%sid), %ct_p = $calc(%ct_p + %p), %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%sid) }
  750. else { var %p = $getpoints(%sid), %t_p = $calc(%t_p + %p), %t = $iif(%t,$+(%t,$chr(44))) $anick(%sid) }
  751. if (!$istok(%maps,%x,32)) { var %maps = %maps %x }
  752. inc %i
  753. }
  754. var %ct_pts = $round(%ct_p,0), %t_pts = $round(%t_p,0), %total = $calc(%ct_pts + %t_pts), %procent = $calc(100 / %total), %ct_win = $round($calc(%procent * %ct_pts),0), %t_win = $round($calc(%procent * %t_pts),0)
  755. var %i = 1, %x = $numtok(%maps,32), %max = 0, %map = de_inferno | while (%x) { var %m = $gettok(%maps,%x,32) | dec %x
  756. if (%vote. [ $+ [ %m ] ] >= %max) && (%vote. [ $+ [ %m ] ]) { var %max = $ifmatch, %map = %m }
  757. }
  758. if ($me isop $mainchan) && (m !isincs $chan($mainchan).mode) { whatcmd mode $mainchan +m }
  759. whatcmd $meorsay $mainchan $logo Rematch started $split Sending info now (ID: $posgid(%ip) $+ ) $split Map: %map $+  $logo | .rconstart %ip startup
  760. ;;SPECIAL;;
  761. writeini -n $gfile(gatherstatus.ini) %ip map %map | writeini -n $gfile(gatherstatus.ini) %ip start_time $date $time | writeini -n $gfile(gatherservers.ini) %ip cs_pw $cs_pw | if ($vtset(%ip)) { create.vt %ip }
  762. whatcmd $meorsay $mainchan $logo $col(04,Terrorist) $+ : $iif(%t,$ifmatch,0) $split Win: $col(07,$iif(%t_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo | whatcmd $meorsay $mainchan $logo $col(11,CounterTerrorist) $+ : $iif(%ct,$ifmatch,0) $split Win: $col(07,$iif(%ct_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo
  763. var %voice = $readini($gfile(gatherservers.ini),%ip,voice), %vtip = $readini($gfile(gatherservers.ini),%ip,vt_ip), %voiceip = $readini($gfile(gatherservers.ini),%ip,voice_ip)
  764. if ((%voice == Ventrilo) && (%vtip) && (%vtip != n/a)) || ((%voice) && (%voice != n/a) && (%voiceip) && (%voiceip != n/a)) {
  765. var %i = 1 | while (%i <= $ini($gfile(players.ini),%ip,0)) { msgnick %ip $ini($gfile(players.ini),%ip,%i) | inc %i }
  766. ;;SPECIAL;;
  767. whatcmd $meorsay $mainchan $logo You have $iif($timetojoin.nr isnum,$duration($timetojoin.nr),$timetojoin.nr time) to join the server $split Server $+($chr(35),,$serverid(%ip),) $logo $iif($readini($gfile(gatherservers.ini),%ip,text),$ifmatch $logo)
  768. }
  769. else {
  770. whatcmd $meorsay $mainchan $logo Console: connect %ip $+ ;password $readini($gfile(gatherservers.ini),%ip,cs_pw) $logo $iif($readini($gfile(gatherservers.ini),%ip,text),$ifmatch $logo)
  771. ;;SPECIAL;;
  772. whatcmd $meorsay $mainchan $logo You have $iif($timetojoin.nr isnum,$duration($timetojoin.nr),$timetojoin.nr time) to join the server $split Server $+($chr(35),,$serverid(%ip),) $logo
  773. }
  774. whatcmd timetojoin %ip | whatcmd removeip %ip | if ($gatheradvtjek) { whatcmd $meorsay $mainchan $logo $readini($gfile(gatherinfo.ini),n,adv,$gatheradv) $logo } | remini -n %gfile %mid
  775. if ($gatherstatus(start)) && ($checkrematch) { var %id = $ifmatch | whatcmd rematch %id } | else { whatcmd unmute $mainchan }
  776. }
  777. alias msgteams {
  778. ;;SPECIAL;;
  779. writeini -n $gfile(gatherstatus.ini) $1 start_time $date $time | writeini -n $gfile(gatherservers.ini) $1 cs_pw $cs_pw | if ($vtset($1)) { create.vt $1 }
  780. var %i = 1, %t = $null, %t_p = 0 | while (%i <= $ini($gfile(terrorist.ini),$1,0)) { var %s = $ini($gfile(terrorist.ini),$1,%i), %p = $getpoints(%s), %t_p = $calc(%t_p + %p), %t = $iif(%t,$+(%t,$chr(44))) $anick(%s) | inc %i }
  781. var %i = 1, %ct = $null, %ct_p = 0 | while (%i <= $ini($gfile(counter.ini),$1,0)) { var %s = $ini($gfile(counter.ini),$1,%i), %p = $getpoints(%s), %ct_p = $calc(%ct_p + %p), %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%s) | inc %i }
  782. var %ct_pts = $round(%ct_p,0), %t_pts = $round(%t_p,0), %total = $calc(%ct_pts + %t_pts), %procent = $calc(100 / %total), %ct_win = $round($calc(%procent * %ct_pts),0), %t_win = $round($calc(%procent * %t_pts),0)
  783. whatcmd $meorsay $mainchan $logo $col(04,Terrorist) $+ : $iif(%t,$ifmatch,0) $split Win: $col(07,$iif(%t_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo | whatcmd $meorsay $mainchan $logo $col(11,CounterTerrorist) $+ : $iif(%ct,$ifmatch,0) $split Win: $col(07,$iif(%ct_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo
  784. var %voice = $readini($gfile(gatherservers.ini),$1,voice), %vtip = $readini($gfile(gatherservers.ini),$1,vt_ip), %voiceip = $readini($gfile(gatherservers.ini),$1,voice_ip) | temppw $1
  785. if ((%voice == Ventrilo) && (%vtip) && (%vtip != n/a)) || ((%voice) && (%voice != n/a) && (%voiceip) && (%voiceip != n/a)) {
  786. var %i = 1 | while (%i <= $ini($gfile(players.ini),$1,0)) { msgnick $1 $ini($gfile(players.ini),$1,%i) | inc %i }
  787. ;;SPECIAL;;
  788. whatcmd $meorsay $mainchan $logo You have $iif($timetojoin.nr isnum,$duration($timetojoin.nr),$timetojoin.nr time) to join the server $split Server $+($chr(35),,$serverid($1),) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  789. }
  790. else {
  791. if ($tempplayers($1)) {
  792. var %i = 1 | while ($ini($gfile(players.ini),$1,%i)) { var %x = $ifmatch | if (STEAM_T:E:MP* iswm %x) { msgnick $1 %x } | inc %i }
  793. }
  794. whatcmd $meorsay $mainchan $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  795. whatcmd $meorsay $mainchan $logo You have $iif($timetojoin.nr isnum,$duration($timetojoin.nr),$timetojoin.nr time) to join the server $split Server $+($chr(35),,$serverid($1),) $logo
  796. }
  797. whatcmd timetojoin $1 | whatcmd removeip $1 | if ($gatheradvtjek) { whatcmd $meorsay $mainchan $logo $readini($gfile(gatherinfo.ini),adv,$gatheradv) $logo }
  798. if ($readini($gfile(gatherservers.ini),$1,gotv)) { var %gotv = $ifmatch | whatcmd $meorsay $mainchan $logo GOTV: %gotv $logo }
  799. whatcmd settopic
  800. if ($gatherstatus(start)) && ($checkrematch) { var %id = $ifmatch | whatcmd rematch %id } | else { whatcmd unmute $mainchan }
  801. }
  802. alias mixteams { window -c @players
  803. ;;SPECIAL;;
  804. writeini -n $gfile(gatherstatus.ini) $1 start_time $date $time | writeini -n $gfile(gatherservers.ini) $1 cs_pw $cs_pw | if ($vtset($1)) { create.vt $1 }
  805. window -eh1 @players | var %i = 1, %team = $r(1,2) | while (%i <= $ini($gfile(players.ini),$1,0)) {
  806. var %x = $ini($gfile(players.ini),$1,%i), %p = $getpoints(%x), %exp = $ex_nr($round(%p,2))
  807. if (!$istack($1,%x)) { aline @players %x %exp }
  808. inc %i
  809. }
  810. var %i = 1, %t_p = 0, %ct_p = 0, %t_pl = 0, %ct_pl = 0, %players = $ini($gfile(players.ini),$1,0), %slots = $iif($readini($gfile(gatherstatus.ini),$1,slots),$ifmatch,%players), %teams = $round($calc(%slots /2),0), %t, %ct
  811. while ($ini($gfile(stacks.ini),$1,%i)) { var %x = $ifmatch, %p = $readini($gfile(stacks.ini),$1,%x), %n = $numtok(%p,32)
  812. if (%i == 1) {
  813. if (%team == 1) {
  814. var %a = 1 | while ($gettok(%p,%a,32)) { var %b = $ifmatch, %pp = $round($getpoints(%b),2)
  815. var %t = $iif(%t,$+(%t,$chr(44))) $anick(%b), %t_p = $calc(%t_p + %pp) | writeini -n $gfile(terrorist.ini) $1 %b %b | inc %t_pl | inc %a
  816. }
  817. }
  818. else {
  819. var %a = 1 | while ($gettok(%p,%a,32)) { var %b = $ifmatch, %pp = $round($getpoints(%b),2)
  820. var %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%b), %ct_p = $calc(%ct_p + %pp) | writeini -n $gfile(counter.ini) $1 %b %b | inc %ct_pl | inc %a
  821. }
  822. }
  823. }
  824. elseif (%team == 1) {
  825. if ($calc(%n + %ct_pl) <= %teams) {
  826. var %a = 1 | while ($gettok(%p,%a,32)) { var %b = $ifmatch, %pp = $round($getpoints(%b),2)
  827. var %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%b), %ct_p = $calc(%ct_p + %pp) | writeini -n $gfile(counter.ini) $1 %b %b | inc %ct_pl | inc %a
  828. }
  829. }
  830. else {
  831. var %a = 1 | while ($gettok(%p,%a,32)) { var %b = $ifmatch, %pp = $round($getpoints(%b),2)
  832. var %t = $iif(%t,$+(%t,$chr(44))) $anick(%b), %t_p = $calc(%t_p + %pp) | writeini -n $gfile(terrorist.ini) $1 %b %b | inc %t_pl | inc %a
  833. }
  834. }
  835. }
  836. elseif ($calc(%n + %t_pl) <= %teams) {
  837. var %a = 1 | while ($gettok(%p,%a,32)) { var %b = $ifmatch, %pp = $round($getpoints(%b),2)
  838. var %t = $iif(%t,$+(%t,$chr(44))) $anick(%b), %t_p = $calc(%t_p + %pp) | writeini -n $gfile(terrorist.ini) $1 %b %b | inc %t_pl | inc %a
  839. }
  840. }
  841. else {
  842. var %a = 1 | while ($gettok(%p,%a,32)) { var %b = $ifmatch, %pp = $round($getpoints(%b),2)
  843. var %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%b), %ct_p = $calc(%ct_p + %pp) | writeini -n $gfile(counter.ini) $1 %b %b | inc %ct_pl | inc %a
  844. }
  845. }
  846. inc %i
  847. }
  848. filter -twce 2 32 @players @players | var %i = 1 | while ($line(@players,%i)) {
  849. var %x = $ifmatch, %steamid = $gettok(%x,1,32), %auth = $gauth(%steamid), %p = $round($gettok(%x,2,32),2)
  850. if (%i == 1) && (!%ct) && (!%t) {
  851. if (%team == 1) { var %t = $iif(%t,$+(%t,$chr(44))) $anick(%auth), %t_p = $calc(%t_p + %p) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid | inc %t_pl }
  852. else { var %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%auth), %ct_p = $calc(%ct_p + %p) | writeini -n $gfile(counter.ini) $1 %steamid %steamid | inc %ct_pl }
  853. }
  854. elseif (%t_p >= %ct_p) {
  855. if (%ct_pl < %teams) { var %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%auth), %ct_p = $calc(%ct_p + %p) | writeini -n $gfile(counter.ini) $1 %steamid %steamid | inc %ct_pl }
  856. else { var %t = $iif(%t,$+(%t,$chr(44))) $anick(%auth), %t_p = $calc(%t_p + %p) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid | inc %t_pl }
  857. }
  858. elseif (%t_pl < %teams) { var %t = $iif(%t,$+(%t,$chr(44))) $anick(%auth), %t_p = $calc(%t_p + %p) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid | inc %t_pl }
  859. else { var %ct = $iif(%ct,$+(%ct,$chr(44))) $anick(%auth), %ct_p = $calc(%ct_p + %p) | writeini -n $gfile(counter.ini) $1 %steamid %steamid | inc %ct_pl } | inc %i
  860. }
  861. window -c @players | var %ct_pts = $round(%ct_p,0), %t_pts = $round(%t_p,0), %total = $calc(%ct_pts + %t_pts), %procent = $calc(100 / %total), %ct_win = $round($calc(%procent * %ct_pts),0), %t_win = $round($calc(%procent * %t_pts),0)
  862. whatcmd $meorsay $mainchan $logo $col(04,Terrorist) $+ : $iif(%t,$ifmatch,0) $split Win: $col(07,$iif(%t_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo | whatcmd $meorsay $mainchan $logo $col(11,CounterTerrorist) $+ : $iif(%ct,$ifmatch,0) $split Win: $col(07,$iif(%ct_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo
  863. var %voice = $readini($gfile(gatherservers.ini),$1,voice), %vtip = $readini($gfile(gatherservers.ini),$1,vt_ip), %voiceip = $readini($gfile(gatherservers.ini),$1,voice_ip) | temppw $1
  864. if ((%voice == Ventrilo) && (%vtip) && (%vtip != n/a)) || ((%voice) && (%voice != n/a) && (%voiceip) && (%voiceip != n/a)) {
  865. var %i = 1 | while (%i <= $ini($gfile(players.ini),$1,0)) { msgnick $1 $ini($gfile(players.ini),$1,%i) | inc %i }
  866. ;;SPECIAL;;
  867. whatcmd $meorsay $mainchan $logo You have $iif($timetojoin.nr isnum,$duration($timetojoin.nr),$timetojoin.nr time) to join the server $split Server $+($chr(35),,$serverid($1),) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  868. }
  869. else {
  870. if ($tempplayers($1)) {
  871. var %i = 1 | while ($ini($gfile(players.ini),$1,%i)) { var %x = $ifmatch | if (STEAM_T:E:MP* iswm %x) { msgnick $1 %x } | inc %i }
  872. }
  873. whatcmd $meorsay $mainchan $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  874. ;;SPECIAL;;
  875. whatcmd $meorsay $mainchan $logo You have $iif($timetojoin.nr isnum,$duration($timetojoin.nr),$timetojoin.nr time) to join the server $split Server $+($chr(35),,$serverid($1),) $logo
  876. }
  877. whatcmd timetojoin $1 | whatcmd removeip $1 | if ($gatheradvtjek) { whatcmd $meorsay $mainchan $logo $readini($gfile(gatherinfo.ini),adv,$gatheradv) $logo }
  878. if ($readini($gfile(gatherservers.ini),$1,gotv)) { var %gotv = $ifmatch | whatcmd $meorsay $mainchan $logo GOTV: %gotv $logo }
  879. whatcmd settopic
  880. if ($gatherstatus(start)) && ($checkrematch) { var %id = $ifmatch | whatcmd rematch %id } | else { whatcmd unmute $mainchan }
  881. }
  882. alias newteams {
  883. remini -n $gfile(counter.ini) $1 | remini -n $gfile(terrorist.ini) $1 | window -eh1 @newteams
  884. var %i = 1, %players = $ini($gfile(players.ini),$1,0), %slots = $iif($readini($gfile(gatherstatus.ini),$1,slots),$ifmatch,%players) | while (%i <= %players) {
  885. var %x = $ini($gfile(players.ini),$1,%i), %p = $getpoints(%x) | aline @newteams %x $ex_nr(%p) | inc %i
  886. }
  887. var %i = 1, %team = $rand(1,2), %split = $round($calc(%slots / 2),0), %newt = $null, %newct = $null, %ct_p = 0, %t_p = 0 | while (%i <= $ini($gfile(newteams.ini),$1,0)) {
  888. var %x = $ini($gfile(newteams.ini),$1,%i), %g = 1, %lan = $ini($gfile(newteams.ini),%x,0), %ct = $ini($gfile(counter.ini),$1,0), %t = $ini($gfile(terrorist.ini),$1,0) | while (%g <= %lan) {
  889. var %steamid = $ini($gfile(newteams.ini),%x,%g), %p = $round($getpoints(%steamid),2), %ctnow = $ini($gfile(counter.ini),$1,0), %tnow = $ini($gfile(terrorist.ini),$1,0)
  890. if (%team == 1) {
  891. if ($calc(%lan + %t) <= %split) { var %t_p = $calc(%t_p + %p), %newt = %newt $anick($gauth(%steamid)) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid }
  892. elseif ($calc(%lan + %ct) <= %split) { var %team = 2, %ct_p = $calc(%ct_p + %p), %newct = %newct $anick($gauth(%steamid)) | writeini -n $gfile(counter.ini) $1 %steamid %steamid }
  893. elseif (%tnow < %split) { var %t_p = $calc(%t_p + %p), %newt = %newt $anick($gauth(%steamid)) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid }
  894. else { var %team = 2, %ct_p = $calc(%ct_p + %p), %newct = %newct $anick($gauth(%steamid)) | writeini -n $gfile(counter.ini) $1 %steamid %steamid }
  895. }
  896. elseif ($calc(%lan + %ct) <= %split) { var %ct_p = $calc(%ct_p + %p), %newct = %newct $anick($gauth(%steamid)) | writeini -n $gfile(counter.ini) $1 %steamid %steamid }
  897. elseif ($calc(%lan + %t) <= %split) { var %team = 1, %t_p = $calc(%t_p + %p), %newt = %newt $anick($gauth(%steamid)) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid }
  898. elseif (%ctnow < %split) { var %ct_p = $calc(%ct_p + %p), %newct = %newct $anick($gauth(%steamid)) | writeini -n $gfile(counter.ini) $1 %steamid %steamid }
  899. else { var %team = 1, %t_p = $calc(%t_p + %p), %newt = %newt $anick($gauth(%steamid)) | writeini -n $gfile(terrorist.ini) $1 %steamid %steamid } | inc %g
  900. }
  901. inc %i
  902. }
  903. filter -twce 2 32 @newteams @newteams | var %i = 1, %teams = $calc(%slots /2) | while (%i <= $line(@newteams,0)) {
  904. var %ct = $ini($gfile(counter.ini),$1,0), %t = $ini($gfile(terrorist.ini),$1,0), %x = $line(@newteams,%i), %sid = $gettok(%x,1,32), %p = $round($gettok(%x,2,32),2)
  905. if (!$readini($gfile(counter.ini),$1,%sid)) && (!$readini($gfile(terrorist.ini),$1,%sid)) {
  906. if (%t_p >= %ct_p) {
  907. if (%ct < %teams) { var %newct = %newct $anick($gauth(%sid)), %ct_p = $calc(%ct_p + %p) | writeini -n $gfile(counter.ini) $1 %sid %sid }
  908. else { var %newt = %newt $anick($gauth(%sid)), %t_p = $calc(%t_p + %p) | writeini -n $gfile(terrorist.ini) $1 %sid %sid }
  909. }
  910. else {
  911. if (%t < %teams) { var %newt = %newt $anick($gauth(%sid)), %t_p = $calc(%t_p + %p) | writeini -n $gfile(terrorist.ini) $1 %sid %sid }
  912. else { var %newct = %newct $anick($gauth(%sid)), %ct_p = $calc(%ct_p + %p) | writeini -n $gfile(counter.ini) $1 %sid %sid }
  913. }
  914. }
  915. inc %i
  916. }
  917. window -c @newteams | resetnewteams $1 | .timer 1 1 queryteams $1 newteams
  918. var %ct_pts = $round(%ct_p,0), %t_pts = $round(%t_p,0), %total = $calc(%ct_pts + %t_pts), %procent = $calc(100 / %total), %ct_win = $round($calc(%procent * %ct_pts),0), %t_win = $round($calc(%procent * %t_pts),0)
  919. whatcmd $meorsay $mainchan $logo There was found people at LAN on server $serverid($1) $logo | whatcmd $meorsay $mainchan $logo $col(04,Terrorist) $+ : $iif(%newt,$ifmatch,0) $split Win: $col(07,$iif(%t_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo
  920. whatcmd $meorsay $mainchan $logo $col(11,CounterTerrorist) $+ : $iif(%newct,$ifmatch,0) $split Win: $col(07,$iif(%ct_win,$ifmatch,0)) $+ $col(14,$chr(37)) $logo | whatcmd $meorsay $mainchan $logo Use .send to recieve info to ur team! $logo
  921. }
  922. alias timetojoin { var %i = 1, %tid = $calc($ctime + $timetojoin.nr), %gfile = $gfile(players.ini) | while (%i <= $ini(%gfile,$1,0)) { var %x = $ini(%gfile,$1,%i) | writeini -n %gfile $1 %x $iif($timetojoin.nr isnum,%tid,$timetojoin.nr) | inc %i } | .timer 1 0 gathertimeout $1 }
  923. alias timetojoin.nr {
  924. if ($gatherinfo(timetojoin)) { var %nr = $ifmatch | return $calc(60 * %nr) }
  925. ;;SPECIAL;;
  926. if (#GJI == $mainchan) { return Unlimited }
  927. if (#CSGO.Swe == $mainchan) || (#fragportal == $mainchan) { return 300 }
  928. if (#signfrag.* iswm $mainchan) { return 420 }
  929. return 600
  930. }
  931. alias cs_pw {
  932. if ($readini($gfile(gatherinfo.ini),global,password)) { return $ifmatch }
  933. ;;SPECIAL;;
  934. if (#signfrag.* iswm $mainchan) { return ghu }
  935. if (#gamebase.csgo == $mainchan) { return gb }
  936. if (#invite.norge == $mainchan) { return gather }
  937. if (#go.zoctai == $mainchan) { return zoctai }
  938. if (#gatherzone == $mainchan) { return gzone }
  939. if (#pro.zoctai == $mainchan) { return zoctai }
  940. if (#denova.play == $mainchan) { return gth }
  941. if (#gather.fb == $mainchan) { return fbgather }
  942. if (#csgo.ee == $mainchan) { return eesti }
  943. if (#esau == $mainchan) { return stream }
  944. if (#fragportal == $mainchan) { return fp }
  945. if (#zegather == $mainchan) { return game }
  946. if (#godorhuman == $mainchan) { return godorhuman }
  947. if (#kosegather == $mainchan) { return snus }
  948. if (#rasta.gather == $mainchan) { return ukg }
  949. if (#gg.invite == $mainchan) { return wrestling }
  950. if (#go.gathers == $mainchan) { return lefedora }
  951. return war
  952. }
  953. ;#################################### Aliases ##########################################;
  954.  
  955. alias winrardir { return "C:\Programmer\WinRAR\WinRAR.exe" }
  956. alias hltvdir { return C:\HLServer\HLTV\cstrike\ }
  957.  
  958. alias isinpool { var %i = 1 | while (%i <= $ini($gfile(players.ini),$1,0)) { var %x = $ini($gfile(players.ini),$1,%i), %n = $gnick(%x) | if ($2 isin %n) { return %x } | inc %i } }
  959. alias claoe {
  960. if ($gatherstatus(accept)) {
  961. var %accept = $ifmatch, %ip = $gatherstatus(ip), %cl = $gatherstatus(%ip,challenger), %map = $gatherstatus(%ip,map), %region = $gatherstatus(%ip,region), %x = $timer(challenge).reps, %d = $timer(challenge).delay, %s = $timer(challenge).secs, %t = $iif(%x > 1,$calc((%x -1) * %d + %s),%s) | set -z %tmp.claoe 600 | inc -z %glist 10
  962. mode $1 -N | notice $1 $logo $anick(%cl) has challenged $iif(%accept = All,You?,$anick(%accept) $+ ) $split $iif($gatherinfo(regions),Region: $+(,%region,) $split) Map: %map $+  $logo $iif(%accept == All,Anyone can use .accept ,Use .accept or !reject) $col(14,$chr(40)) $+ $duration(%t) $+ $col(14,$chr(41)) $logo | mode $1 +N
  963. }
  964. }
  965. alias aoe {
  966. if ($me isop $1) { var %mode = 0
  967. if (!$gatherstatus(accept)) && ($gatherstatus(Signup)) { var %mode = 1, %ip = $ifmatch, %map = $gatherstatus(%ip,map), %region = $gatherstatus(%ip,region), %slots = $gatherstatus(%ip,slots), %signs = $gatherstatus(%ip,added), %admin = $gatherstatus(%ip,admin), %players = %signs, %type = $gatherstatus(%ip,type)
  968. set -z %tmp.aoe 120 | mode $1 -N | notice $1 $logo Gather signup $split Admin: $anick($gauth(%admin)) $split $iif($gatherinfo(regions),Region: $+(,%region,) $split) Map: %map $split Signed: $iif((%type == Challenge) && (($unlim(pool)) || (($unlim(noon)) && ($time < 12))),$+($iif(%players >= %slots,$col(09,%players),$col(04,%players))),$+(%players,/,%slots)) $logo | inc -z %glist 6
  969. }
  970. if ($gatherstatus(sub)) {
  971. if (!%mode) { mode $1 -N } | var %i = 1, %mode = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { var %ip = $ini($gfile(gatherservers.ini),%i)
  972. if ($serverstatus(%ip,sub)) {
  973. var %ct = $iif($readini($gfile(gatherstatus.ini),%ip,ct_subs),$ifmatch,0), %t = $iif($readini($gfile(gatherstatus.ini),%ip,t_subs),$ifmatch,0), %subs = $calc(%ct + %t)
  974. if (%subs) { var %s.ct = $score(%ip,ct), %s.t = $score(%ip,t), %map = $gatherstatus(%ip,map), %region = $gatherstatus(%ip,region) | inc -z %glist 6 | set -z %tmp.aoe 150
  975. notice $1 $logo Substitute(s): %subs $+  $split $iif($gatherinfo(regions),Region: $+(,%region,) $split) Map: %map $split $col(11,CT) $+ : %s.ct $col(04,T) $+ : %s.t $split Use: .addsub %i - to sign as an substitute $logo
  976. }
  977. }
  978. inc %i
  979. }
  980. }
  981. if (%mode) { mode $1 +N } | else { set -z %tmp.aoe 10 | $meorsay $1 $logo There is no signup at the moment, start one with .sg [map] or .cl [map] $logo }
  982. }
  983. }
  984. alias setmynick { if ($me != $mynick) { whatcmd nick $mynick | if (!$timer(mynick)) { .timermynick 1 60 setmynick } } | elseif ($timer(mynick)) { .timermynick off } }
  985. raw 433:*:{ var %znick = $+($mynick,%mynick) | if ($2 == $mynick) || ($2 == %znick) { if ($mynick !isin $me) { set -u120 %mynick $iif(%mynick,$calc(%mynick +1),2) | .timersetmynick 1 10 whatcmd nick $+($mynick,%mynick) } | .timermynick 1 300 setmynick } }
  986. alias Qbot {
  987. if ($network == GameSurge) { return ChanServ }
  988. if ($network == Aitvaras) { return ChanServ }
  989. if ($network == GRNet) { return ChanServ }
  990. return Q
  991. }
  992. alias Qaddr {
  993. if ($network == GameSurge) { return *!*@*.user.gamesurge }
  994. if ($network == Aitvaras) { ;return *!*@* }
  995. if ($network == GRNet) { ;return *!*@* }
  996. return *!*@*.users.quakenet.org
  997. }
  998. alias Qhidden {
  999. if ($network == GameSurge) { return *!*@*.user.gamesurge }
  1000. if ($network == Aitvaras) { return *!*@* }
  1001. if ($network == GRNet) { return *!*@* }
  1002. return *!*@*.users.quakenet.org
  1003. }
  1004. alias Qauth {
  1005. if ($network == GameSurge) { return .authserv AUTH }
  1006. if ($network == Aitvaras) { return .msg NickServ IDENTIFY }
  1007. if ($network == GRNet) { return .msg NickServ IDENTIFY }
  1008. return .msg Q@CServe.quakenet.org AUTH
  1009. }
  1010.  
  1011. alias mainpriv { return $mainchan $privchan $ownerchan }
  1012. alias authme { authing }
  1013. alias authbot { authing }
  1014. alias authing {
  1015. if ($readini($gfile(gatherinfo.ini),auth,user)) && ($readini($gfile(gatherinfo.ini),auth,pass)) {
  1016. if ($network == Aitvaras) { mode $me +xB } | else { mode $me +x }
  1017. if ($network == GRNet) {
  1018. [ $Qauth ] $readini($gfile(gatherinfo.ini),auth,pass)
  1019. }
  1020. else {
  1021. [ $Qauth ] $readini($gfile(gatherinfo.ini),auth,user) $readini($gfile(gatherinfo.ini),auth,pass)
  1022. }
  1023. }
  1024. .timer 1 5 gatherchans | .timer 1 10 setmynick
  1025. }
  1026. on *:NOTICE:*:*:{
  1027. if ($nick == $Qbot) {
  1028. if (*only available to authed users* iswm $1-) {
  1029. if ($timer(gatherchans)) { .timergatherchans off } | if ($timer(gatherchans2)) { .timergatherchans2 off }
  1030. if ($timer(mynick)) { .timermynick off } | if ($timer(setmynick)) { .timersetmynick off }
  1031. .timerauthing 1 300 authing
  1032. }
  1033. elseif (*Too many users AUTH'd to this account* iswm $1-) {
  1034. if ($timer(gatherchans)) { .timergatherchans off } | if ($timer(gatherchans2)) { .timergatherchans2 off }
  1035. if ($timer(mynick)) { .timermynick off } | if ($timer(setmynick)) { .timersetmynick off }
  1036. gatherchans | .timer 1 300 authing
  1037. }
  1038. }
  1039. }
  1040. alias gatherchans {
  1041. if ($Qhidden !iswm $address($me,2)) && ($network != Aitvaras && $network != GRNet) { .timergatherchans 1 2 gatherchans2 | return }
  1042. if ($me !ison $mainchan) { whatcmd join $mainchan | .timergatherchans 1 20 gatherchans2 }
  1043. if ($me !ison $privchan) { whatcmd join $privchan | .timergatherchans 1 20 gatherchans2 }
  1044. if ($me !ison $ownerchan) { whatcmd join $ownerchan pw | .timergatherchans 1 20 gatherchans2 }
  1045. }
  1046. alias gatherchans2 {
  1047. if ($readini($gfile(gatherinfo.ini),auth,user)) && ($readini($gfile(gatherinfo.ini),auth,pass)) {
  1048. if ($me !ison $mainchan) { .timerqinvite 1 0 whatcmd msg $Qbot invite | .timergatherchans 1 60 gatherchans }
  1049. if ($me !ison $privchan) { .timerqinvite 1 0 whatcmd msg $Qbot invite | .timergatherchans 1 60 gatherchans }
  1050. if ($me !ison $ownerchan) { .timerqinvite 1 0 whatcmd msg $Qbot invite | .timergatherchans 1 60 gatherchans }
  1051. }
  1052. else { .timergatherchans 1 30 gatherchans }
  1053. }
  1054.  
  1055. alias noticetype {
  1056. var %nick = $1, %chan = $iif($2,$ifmatch,$mainchan) | if ($me !isreg %chan) && (%nick ison %chan) && ($network == QuakeNet) { return cnotice %nick %chan } | return notice %nick
  1057. }
  1058. alias msgtype {
  1059. var %nick = $1, %chan = $iif($2,$ifmatch,$mainchan) | if ($me !isreg %chan) && (%nick ison %chan) && ($network == QuakeNet) { return cprivmsg %nick %chan } | return msg %nick
  1060. }
  1061. alias msgnick {
  1062. if (*STEAM_*:*:* iswm $2) {
  1063. var %steamid = $2, %auth = $gauth(%steamid), %nick = $gnick(%auth), %admin = 0, %t = $col(04,Terrorist), %ct = $col(11,CounterTerrorist), %vtip = $iif($readini($gfile(gatherservers.ini),$1,vt_ip),$ifmatch,n/a), %voiceip = $iif($readini($gfile(gatherservers.ini),$1,voice_ip),$ifmatch,n/a)
  1064. if ($read($gfile(authed.dat),w,* %auth *)) || ($read($gfile(authed.dat),w,* %steamid)) { var %msgtype = $msgtype(%nick), %voice = $readini($gfile(gatherservers.ini),$1,voice), %id = $serverid($1), %game = $gatherinfo(game), %room = %game Gather $+($chr(35),%id)
  1065. if ($admin($+($chr(35),%auth)) >= 8) { var %admin = %auth } | if (!$sameteam($score($1,total))) { var %ct = $col(04,Terrorist) - only INGAME, %t = $col(11,CounterTerrorist) - only INGAME }
  1066. if (STEAM_T:E:MP* iswm $2) {
  1067. if (!$readini($gfile(tempreg.ini),$1,$2)) { writeini -n $gfile(tempreg.ini) $1 $2 $rand(1123,9889) }
  1068. whatcmd %msgtype $logo Remember to authenticate with the bot ingame - as soon as you join the server! $split Console: say .reg $readini($gfile(tempreg.ini),$1,$2) $logo
  1069. }
  1070. if (%voice == Ventrilo) && (%vtip) && (%vtip != n/a) {
  1071. if ($readini($gfile(counter.ini),$1,%steamid)) {
  1072. whatcmd %msgtype $logo Team %ct $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo Ventrilo: $replace(%vtip,$chr(58),$chr(32)) $split Pw: $iif($readini($gfile(gatherservers.ini),$1,vt_pw),$ifmatch,n/a) $iif($vtset($1),$split Room: %room $split CT Room Pw: $col(11,$iif($readini($gfile(gatherservers.ini),$1,vt_ct),$ifmatch,n/a)) $iif(%admin >= 8,$split T Room Pw: $col(04,$iif($readini($gfile(gatherservers.ini),$1,vt_t),$ifmatch,n/a),))) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  1073. }
  1074. elseif ($readini($gfile(terrorist.ini),$1,%steamid)) {
  1075. whatcmd %msgtype $logo Team %t $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo Ventrilo: $replace(%vtip,$chr(58),$chr(32)) $split Pw: $iif($readini($gfile(gatherservers.ini),$1,vt_pw),$ifmatch,n/a) $iif($vtset($1),$split Room: %room $split T Room Pw: $col(04,$iif($readini($gfile(gatherservers.ini),$1,vt_t),$ifmatch,n/a)) $iif(%admin >= 8,$split CT Room Pw: $col(11,$iif($readini($gfile(gatherservers.ini),$1,vt_ct),$ifmatch,n/a),))) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  1076. }
  1077. elseif ($readini($gfile(players.ini),$1,%steamid)) || (%admin != 0) {
  1078. whatcmd %msgtype $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo Ventrilo: $replace(%vtip,$chr(58),$chr(32)) $split Pw: $iif($readini($gfile(gatherservers.ini),$1,vt_pw),$ifmatch,n/a) $iif($vtset($1),$split Room: %room $split CT Room Pw: $col(11,$iif($readini($gfile(gatherservers.ini),$1,vt_ct),$ifmatch,n/a)) $split T Room Pw: $col(04,$iif($readini($gfile(gatherservers.ini),$1,vt_t),$ifmatch,n/a))) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  1079. }
  1080. }
  1081. elseif (%voice) && (%voice != n/a) && (%voiceip) && (%voiceip != n/a) {
  1082. if ($readini($gfile(counter.ini),$1,%steamid)) {
  1083. whatcmd %msgtype $logo Team %ct $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo %voice $+ : $readini($gfile(gatherservers.ini),$1,voice_ip) $split Pw: $iif($readini($gfile(gatherservers.ini),$1,voice_pw),$ifmatch,n/a) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  1084. }
  1085. elseif ($readini($gfile(terrorist.ini),$1,%steamid)) {
  1086. whatcmd %msgtype $logo Team %t $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo %voice $+ : $readini($gfile(gatherservers.ini),$1,voice_ip) $split Pw: $iif($readini($gfile(gatherservers.ini),$1,voice_pw),$ifmatch,n/a) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  1087. }
  1088. elseif ($readini($gfile(players.ini),$1,%steamid)) || (%admin != 0) {
  1089. whatcmd %msgtype $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo %voice $+ : $readini($gfile(gatherservers.ini),$1,voice_ip) $split Pw: $iif($readini($gfile(gatherservers.ini),$1,voice_pw),$ifmatch,n/a) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo)
  1090. }
  1091. }
  1092. elseif ($readini($gfile(counter.ini),$1,%steamid)) { whatcmd %msgtype $logo Team %ct $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo) }
  1093. elseif ($readini($gfile(terrorist.ini),$1,%steamid)) { whatcmd %msgtype $logo Team %t $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo) }
  1094. elseif ($readini($gfile(players.ini),$1,%steamid)) || (%admin != 0) { whatcmd %msgtype $logo Console: connect $1 $+ ;password $readini($gfile(gatherservers.ini),$1,cs_pw) $logo $iif($readini($gfile(gatherservers.ini),$1,text),$ifmatch $logo) }
  1095. }
  1096. }
  1097. }
  1098. alias logit {
  1099. var %txt = $+($replace($1,$chr(58),$chr(45)),.log), %id = $+($chr(35),$serverid($1))
  1100. .timer -o 1 0 write %txt $+($chr(91),$date,$chr(93),$chr(91),$time,$chr(93),$chr(91),%id,$chr(93)) $iif($2-,$ifmatch,---------------)
  1101. }
  1102. alias logtop {
  1103. var %txt = $+($replace($1,$chr(58),$chr(45)),.log), %id = $+($chr(35),$serverid($1))
  1104. .timer -o 1 0 write -il1 %txt $+($chr(91),$date,$chr(93),$chr(91),$time,$chr(93),$chr(91),%id,$chr(93)) $iif($2-,$ifmatch,---------------)
  1105. }
  1106. alias resetlog { var %txt = $+($replace($1,$chr(58),$chr(45)),.log) | if ($isfile(%txt)) { .remove %txt } }
  1107. alias savelog {
  1108. var %dir = gatherlogs\, %id = $replace($1,$chr(58),$chr(45)), %log = $iif($2,$ifmatch,%id), %txt = $+(%id,.log), %newtxt = $+(%dir,%log,.log), %i = 2
  1109. if (!$isdir(%dir)) { mkdir %dir }
  1110. if ($isfile(%txt)) {
  1111. while ($isfile(%newtxt)) { var %newtxt = $+(%dir,%log,_,%i,.log) | inc %i }
  1112. logtop $1 | logtop $1 Saved on $day $+ , $date - $time | logtop $1 | .rename %txt %newtxt | .timer 1 10 upcslog %log
  1113. }
  1114. }
  1115. alias logit2 {
  1116. var %txt = $+(rcon_,$replace($1,$chr(58),$chr(45)),.log), %id = $+($chr(35),$serverid($1))
  1117. .timer -o 1 0 write %txt $+($chr(91),$date,$chr(93),$chr(91),$time,$chr(93),$chr(91),%id,$chr(93)) $iif($2-,$ifmatch,---------------)
  1118. }
  1119. alias logtop2 {
  1120. var %txt = $+(rcon_,$replace($1,$chr(58),$chr(45)),.log), %id = $+($chr(35),$serverid($1))
  1121. .timer -o 1 0 write -il1 %txt $+($chr(91),$date,$chr(93),$chr(91),$time,$chr(93),$chr(91),%id,$chr(93)) $iif($2-,$ifmatch,---------------)
  1122. }
  1123. alias resetlog2 { var %txt = $+(rcon_,$replace($1,$chr(58),$chr(45)),.log) | if ($isfile(%txt)) { .remove %txt } }
  1124. alias savelog2 {
  1125. var %dir = gatherlogs\, %id = $replace($1,$chr(58),$chr(45)), %log = $iif($2,$ifmatch,%id), %txt = $+(rcon_,%id,.log), %newtxt = $+(%dir,%log,.log), %i = 2
  1126. if (!$isdir(%dir)) { mkdir %dir }
  1127. if ($isfile(%txt)) {
  1128. while ($isfile(%newtxt)) { var %newtxt = $+(%dir,%log,_,%i,.log) | inc %i }
  1129. logtop2 $1 | logtop2 $1 Saved on $day $+ , $date - $time | logtop2 $1 | .rename %txt %newtxt
  1130. }
  1131. }
  1132. alias tempauth {
  1133. var %auth = tempauth, %num = 1, %tempauth = $+(%auth,%num)
  1134. while ($read($gfile(authed.dat),w,* %tempauth *)) || ($read($gfile(gatherusers.dat),s,%tempauth)) { inc %num | var %tempauth = $+(%auth,%num) }
  1135. return %tempauth
  1136. }
  1137. alias tempsteamid {
  1138. var %steamid = STEAM_T:E:MP, %num = $rand(1123,9889) %tempsteamid = $+(%steamid,%num)
  1139. while ($read($gfile(authed.dat),w,* %tempsteamid)) || ($read($gfile(gatherusers.dat),w,* %tempsteamid)) { var %num = $rand(1123,9889), %tempsteamid = $+(%steamid,%num) }
  1140. return %tempsteamid
  1141. }
  1142. alias temppw {
  1143. var %ipp = $1, %i = 1
  1144. if ($2) {
  1145. while ($ini($gfile(tempreg.ini),%ipp,%i)) { var %x = $ifmatch
  1146. if ($2 == $readini($gfile(tempreg.ini),%ipp,%x)) { return %x }
  1147. inc %i
  1148. }
  1149. return $false
  1150. }
  1151. if ($tempplayers(%ipp)) {
  1152. while ($ini($gfile(players.ini),%ipp,%i)) { var %x = $ifmatch
  1153. if (STEAM_T:E:MP* iswm %x) && (!$readini($gfile(tempreg.ini),%ipp,%x)) { writeini -n $gfile(tempreg.ini) %ipp %x $rand(1123,9889) }
  1154. inc %i
  1155. }
  1156. }
  1157. }
  1158. alias tempplayers {
  1159. var %ipp = $1, %i = 1, %players = $gfile(players.ini) | while ($ini(%players,%ipp,%i)) {
  1160. var %x = $ifmatch | if (STEAM_T:E:MP* iswm %x) { return $true } | inc %i
  1161. }
  1162. return $false
  1163. }
  1164. alias tempcheck {
  1165. var %ipp = $1 | set -u10 %tempcheck. [ $+ [ %ipp ] ] 1 | rconsend %ipp status
  1166. }
  1167. alias getpoints {
  1168. var %id = $1, %played = $readini($gfile(gatherstats.ini),%id,Played), %points = $readini($gfile(gatherstats.ini),%id,Points), %xpoints = $readini($gfile(gatherstats.ini),%id,xPoints)
  1169. if (%played >= 5) && (%points) { return %points } | elseif (%xpoints) { return %xpoints } | else { return $iif(%points,$ifmatch,1000) }
  1170. }
  1171. alias rankstatus {
  1172. if ($1 !isnum) { return $col(04,Unknown) }
  1173. if ($1 < 500) { return $col(04,Quit CS) }
  1174. if ($1 < 600) { return $col(04,Bot) }
  1175. if ($1 < 700) { return $col(04,Terrible) }
  1176. if ($1 < 800) { return $col(07,Newbie) }
  1177. if ($1 < 900) { return $col(07,Bad) }
  1178. if ($1 < 1000) { return $col(07,Normal) }
  1179. if ($1 < 1100) { return $col(03,Beginner) }
  1180. if ($1 < 1300) { return $col(03,Good) }
  1181. if ($1 < 1400) { return $col(08,Really good) }
  1182. if ($1 < 1500) { return $col(10,Tryharder) }
  1183. if ($1 < 1600) { return $col(04,Hacker) }
  1184. if ($1 < 1700) { return $col(13,Godlike) }
  1185. if ($1 < 1800) { return $col(04,Incredible) }
  1186. if ($1 < 2000) { return $col(08,No life) }
  1187. return $col(12,Pro)
  1188. }
  1189. alias setplus { if ($1 > 0) { return $+(+,$1) } | return $1 }
  1190. alias setbob { return $+($col(14,$chr(40)),$1,/,$2,$col(14,$chr(41))) }
  1191. alias setbob2 { return $+($col(14,$chr(40)),$1-,$col(14,$chr(41))) }
  1192. alias setpct { return $+($col(07,$round($1,2)),$col(14,$chr(37))) }
  1193. alias setpct2 { return $setbob2($setpct($1)) }
  1194. alias setdays { if ($1 > 1000) { return $round($calc($1 /24),2) dage } | return $round($1,2) timer }
  1195. alias removeip { if ($readini($gfile(gatherstatus.ini),info,ip) == $1) { remini -n $gfile(gatherstatus.ini) info } }
  1196. alias chanmode { var %m = $left($2,1), %mo = $right($2,-1) | if ($me isop $1) && (((%m == -) && (%mo isincs $chan($1).mode)) || ((%m == +) && (%mo !isincs $chan($1).mode))) { mode $1 $+(%m,%mo) } }
  1197. alias admincol { if ($gatherinfo(color_ $+ $adminid($1))) { return $ifmatch } | if ($1 isnum 10) { return 11 } | if ($1 isnum 9) { return 10 } | if ($1 isnum 8) { return 09 } | if ($1 isnum 5-7) { return 07 } | return }
  1198. alias adminid { if ($1 isnum 10) { return Headadmin } | if ($1 isnum 9) { return Gatheradmin } | if ($1 isnum 8) { return Tryadmin } | if ($1 isnum 7) { return VIP } | if ($1 isnum 6) { return $iif(#gold == $mainchan,Donator,Sponsor) } | return 0 }
  1199. alias admintype { if ($1 == Headadmin) { return 10 } | if ($1 == Gatheradmin) { return 9 } | if ($1 == Tryadmin) { return 8 } | if ($1 == VIP) { return 7 } | if ($1 == $iif(#gold == $mainchan,Donator,Sponsor)) { return 6 } | return 0 }
  1200. alias upleft { return $+($upper($left($1,1)),$lower($right($1,-1))) }
  1201. ;;SPECIAL;;
  1202. alias cmd_tr {
  1203. var %tr = $left($1,1), %cmd = $right($lower($gettok($1,1,32)),-1), %tr2 = $gettok($1,1,32), %cmd2 = $c_cmd($lower($gettok($1,2,32)))
  1204. if ($istok(. $iif(#signfrag.* !iswm $mainchan,! - ?),%tr,32)) {
  1205. if (%tmp.antiflood. [ $+ [ %cmd ] ] >= 5) && (!$istok(add sign,%cmd,32)) { inc -z %tmp.antiflood. [ $+ [ %cmd ] ] 3 | return 0 } | inc -z %tmp.antiflood. [ $+ [ %cmd ] ] 2 | return $iif(%cmd,%cmd,0)
  1206. }
  1207. elseif (%tr2 == $me) || (%tr2 == $gatherinfo(game)) { var %cmd = %cmd2
  1208. if (%tmp.antiflood. [ $+ [ %cmd ] ] >= 5) && (!$istok(add sign,%cmd,32)) { inc -z %tmp.antiflood. [ $+ [ %cmd ] ] 3 | return 0 } | inc -z %tmp.antiflood. [ $+ [ %cmd ] ] 2 | return $iif(%cmd,%cmd,0)
  1209. }
  1210. return 0
  1211. }
  1212. alias c_cmd { return $remove($1,.,!,?,-) }
  1213. alias c_text { return $replace($2-,:me:,$me,:gatherbot:,$me,:N:,$1,:NICK:,$1,:L:,$+(,$logo),:LOGO:,$+(,$logo),:S:,$split,:SPLIT:,$split,:K:,,:U:,,:B:,,:O:,,:END:,$col(end)) }
  1214. alias r_text { return $replace($1-,$me,:me:,$logo,:LOGO:,$split,:SPLIT:,,:K:,,:U:,,:B:,,:O:) }
  1215. ;;SPECIAL;;
  1216. alias cmd_ingame { var %tr = $left($1,1), %cmd = $right($1,-1) | if ($istok(. $iif(#signfrag.* !iswm $mainchan,! - ?),%tr,32)) { return $iif(%cmd,%cmd,0) } | return 0 }
  1217. alias ex_nr {
  1218. var %l = $left($1,1), %num = $iif(%l == $chr(45),$right($1,-1),$1), %i = $len($gettok(%num,1,46)), %x = $len($gettok(%num,2,46)), %i = $calc(10 - %i), %x = $calc(2 - %x)
  1219. return $+($iif(%l == $chr(45),$chr(45)),$str(0,%i),$gettok(%num,1,46),$chr(46),$gettok(%num,2,46),$str(0,%x))
  1220. }
  1221. alias bantime {
  1222. if ($gatherinfo(leaveban_ $+ $1)) { var %nr = $ifmatch | return $calc(%nr * 60 * 60 + $ctime) }
  1223. var %x = $calc($1 - 1) | while (%x >= 5) { if ($gatherinfo(leaveban_ $+ %x)) { var %nr = $ifmatch | return $calc(%nr * 60 * 60 + $ctime) } | dec %x }
  1224. ;;SPECIAL;;
  1225. if ($1 isnum 1) {
  1226. if (#signfrag.* iswm $mainchan) { return $calc(1800 + $ctime) }
  1227. if (#fragportal == $mainchan) { return $calc(3600 + $ctime) }
  1228. return $calc(18000 + $ctime)
  1229. }
  1230. if ($1 isnum 2) {
  1231. if (#signfrag.* iswm $mainchan) { return $calc(10800 + $ctime) }
  1232. if (#fragportal == $mainchan) { return $calc(7200 + $ctime) }
  1233. return $calc(36000 + $ctime)
  1234. }
  1235. if ($1 isnum 3) {
  1236. if (#signfrag.* iswm $mainchan) { return $calc(21600 + $ctime) }
  1237. if (#fragportal == $mainchan) { return $calc(18000 + $ctime) }
  1238. return $calc(86400 + $ctime)
  1239. }
  1240. if ($1 isnum 4) {
  1241. if (#signfrag.* iswm $mainchan) { return $calc(86400 + $ctime) }
  1242. if (#fragportal == $mainchan) { return $calc(36000 + $ctime) }
  1243. return $calc(172800 + $ctime)
  1244. }
  1245. if ($1 >= 5) {
  1246. if (#signfrag.* iswm $mainchan) { return $calc(172800 + $ctime) }
  1247. if (#fragportal == $mainchan) { return $calc(86400 + $ctime) }
  1248. return $calc(259200 + $ctime)
  1249. }
  1250. if ($gatherinfo(leaveban_1)) { var %nr = $ifmatch | return $calc(%nr * 60 * 60 + $ctime) }
  1251. if (#signfrag.* iswm $mainchan) { return $calc(1800 + $ctime) }
  1252. if (#fragportal == $mainchan) { return $calc(3600 + $ctime) }
  1253. return $calc(18000 + $ctime)
  1254. }
  1255. alias bancheck {
  1256. if ($2 == leaver) || ($2 == leave) { var %t = $iif($readini($gfile(gatherstats.ini),$3,Leavebans),$ifmatch,1), %g = Leave Ban ( $+ %t $+ ), %t = $bantime(%t) }
  1257. elseif ($2 == lamer) || ($2 == lame) { var %g = Lame Ban, %t = $iif($gatherinfo(lameban),$calc($ifmatch * 60 * 60 + $ctime),$calc(259200 + $ctime)) }
  1258. elseif ($2 == perm) || ($2 == permanent) || ($2 == permenent) { var %g = Admin Ban, %t = Permanent } | elseif ($2 == cheater) || ($2 == cheat) { var %g = Cheater, %t = Permanent }
  1259. elseif ($2 == egen) || ($2 == adminban) || ($2 == admin) && ($3 isnum) { var %g = Admin Ban, %t = $calc($calc((60 * 60) * $3) + $ctime) }
  1260. else { return $false } | if ($1 == check) { return $true } | elseif ($1 == grund) || ($1 == type) { return %g } | elseif ($1 == tid) || ($1 == time) { return %t }
  1261. }
  1262. alias gatheradvtjek { if ($readini($gfile(gatherinfo.ini),adv,line1)) { return $true } | return $false }
  1263. alias gatheradv {
  1264. var %x = $iif($readini($gfile(gatherinfo.ini),previous,adv),$ifmatch,1)
  1265. if (!$readini($gfile(gatherinfo.ini),previous,adv)) || (%x >= $ini($gfile(gatherinfo.ini),adv,0)) { writeini -n $gfile(gatherinfo.ini) previous adv 1 | return line1 }
  1266. var %x = $calc(%x +1) | writeini -n $gfile(gatherinfo.ini) previous adv %x | return $+(line,%x)
  1267. }
  1268. alias gatherbans {
  1269. var %i = 1, %x = $ini($gfile(gatherbans.ini),0), %m, %unban
  1270. while (%i <= %x) { var %b = $ini($gfile(gatherbans.ini),%i), %t = $readini($gfile(gatherbans.ini),%b,tid)
  1271. if (%t isnum) && (%t <= $ctime) {
  1272. remini -n $gfile(gatherbans.ini) %b | var %nick = $anick(%b), %unban = 1
  1273. if ($me ison $mainchan) { whatcmd $meorsay $mainchan $logo Gather ban on $iif(%nick,%nick,%b) has expired and can now play/start gathers on $mainchan again $logo }
  1274. elseif ($me ison $privchan) { whatcmd $meorsay $privchan $logo Gather ban on $iif(%nick,%nick,%b) has expired and can now play/start gathers on $mainchan again $logo }
  1275. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) unbans %b %b | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  1276. }
  1277. elseif (%t isnum) && ((%t < %m) || (!%m)) { var %m = %t, %w = %b }
  1278. inc %i
  1279. }
  1280. var %i = 1, %x = $ini($gfile(teambans.ini),0)
  1281. while (%i <= %x) { var %b = $ini($gfile(teambans.ini),%i), %t = $readini($gfile(teambans.ini),%b,tid)
  1282. if (%t isnum) && (%t <= $ctime) {
  1283. remini -n $gfile(teambans.ini) %b
  1284. if ($me ison $mainchan) { whatcmd $meorsay $mainchan $logo Gather ban on team %b has expired and can now play/start gathers on $mainchan again $logo }
  1285. elseif ($me ison $privchan) { whatcmd $meorsay $privchan $logo Gather ban on team %b has expired and can now play/start gathers on $mainchan again $logo }
  1286. }
  1287. elseif (%t isnum) && ((%t < %m) || (!%m)) { var %m = %t, %w = %b }
  1288. inc %i
  1289. }
  1290. if (%m) && ($calc(%m - $ctime) < 500) { .timergatherbans -o 1 $calc(%m - $ctime +1) gatherbans } | else { .timergatherbans -o 0 300 gatherbans }
  1291. if ($gatherinfo(mysql.exe)) && (%unban) { writeini -n $gfile(upload.ini) bans steamid all | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  1292. }
  1293. alias gatherdemotes {
  1294. var %i = 1, %gfile = $gfile(gatherinfo.ini), %m, %promote
  1295. while ($ini(%gfile,noleader,%i)) {
  1296. var %s = $ifmatch, %n = $readini(%gfile,noleader,%s), %by = $gettok(%n,1,32), %date = $gettok(%n,2-,32), %time = $calc(3600 * 24 * 7), %ctime = $calc($ctime - $ctime(%date)), %left = $calc(%time - %ctime)
  1297. if (%time <= %ctime) {
  1298. remini -n %gfile noleader %s | var %promote = $iif(%promote,$+(%promote,$chr(44))) $iif($anick(%s),$ifmatch,%s)
  1299. }
  1300. elseif (%left > 0) && ((%left < %m) || (!%m)) { var %m = %left }
  1301. inc %i
  1302. }
  1303. if (%promote) {
  1304. if ($me ison $mainchan) { whatcmd $meorsay $mainchan $logo $iif($numtok(%promote,32) > 1,Demotes,Demote) on %promote has expired and can now be challenged/challenge others on $mainchan again $logo }
  1305. elseif ($me ison $privchan) { whatcmd $meorsay $privchan $logo $iif($numtok(%promote,32) > 1,Demotes,Demote) on %promote has expired and can now be challenged/challenge others on $mainchan again $logo }
  1306. }
  1307. if (%m) && (%m < 500) { .timergatherdemotes -o 1 $calc(%m +1) gatherdemotes } | else { .timergatherdemotes -o 0 300 gatherdemotes }
  1308. }
  1309. alias gatherkickban {
  1310. if ($readini($gfile(counter.ini),$1,$2)) { remini -n $gfile(counter.ini) $1 $2 | var %team = ct } | if ($readini($gfile(terrorist.ini),$1,$2)) { remini -n $gfile(terrorist.ini) $1 $2 | var %team = t }
  1311. if ($readini($gfile(players.ini),$1,$2)) { remini -n $gfile(players.ini) $1 $2 | if (!$sameteam($score($1,total))) { fastsub $1 $iif(%team == ct,t,ct) 1 } | else { fastsub $1 %team 1 } }
  1312. if (!$readini($gfile(gatherbans.ini),$2,tid)) {
  1313. writeini -n $gfile(gatherbans.ini) $2 admin :gatherbot: | writeini -n $gfile(gatherbans.ini) $2 tid $iif($gatherinfo(kickban),$calc($ifmatch * 60 * 60 + $ctime),$calc(86400 + $ctime)) | writeini -n $gfile(gatherbans.ini) $2 type Kicked Ban
  1314. writeini -n $gfile(gatherbans.ini) $2 grund You have been kicked ingame by an admin [Admin: $gauth($3) $+ $chr(93) | writeini -n $gfile(gatherbans.ini) $2 date $ctime
  1315. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans $2 $2 | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  1316. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) bans steamid $2 | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  1317. whatcmd $meorsay $mainchan $logo $anick($gauth($2)) got a kick ban, since he got kicked from server $serverid($1) $split Admin: $anick($gauth($3)) $logo
  1318. .timer 1 0 gatherbans
  1319. }
  1320. }
  1321. alias gathertimeout {
  1322. if (!$sock($+($srcon.prefix, $1))) || ($istok(Free Offline Error Ended,$gatherstatus($1),32)) { return }
  1323. var %gplayers = $gfile(players.ini), %gatherbans = $gfile(gatherbans.ini), %joined = $gfile(joined.ini), %gatherstatus = $gfile(gatherstatus.ini), %counter = $gfile(counter.ini), %terrorist = $gfile(terrorist.ini)
  1324. var %i = 1, %min = 0, %ct = 0, %t = 0, %ct.s = $score($1,ct), %t.s = $score($1,t), %status = $serverstatus($1,clean), %admin = $readini(%gatherstatus,$1,gatheradmin), %ban = 0
  1325. while (%i <= $ini(%gplayers,$1,0)) {
  1326. var %x = $ini(%gplayers,$1,%i), %tid = $readini(%gplayers,$1,%x)
  1327. if (!$readini(%joined,$1,%x)) && (%tid <= $ctime) { remini -n $gfile(players.ini) $1 %x | writeini -n $gfile(leavers.ini) $1 %x %x
  1328. if ($readini(%counter,$1,%x)) { remini -n %counter $1 %x | inc %ct } | if ($readini(%terrorist,$1,%x)) { remini -n %terrorist $1 %x | inc %t }
  1329. var %gamestats = $gamestatsini($1), %gpoints = $iif($readini(%gamestats,%x,Points),$ifmatch,0) | writeini -n %gamestats $1 Points %gpoints
  1330. if ($gatherinfo(leavebans)) && (!$readini(%gatherbans,%x,tid)) { var %gatherstats = $gfile(gatherstats.ini), %ban = 1
  1331. writeini -n %gatherstats %x Bans $calc($readini($gfile(gatherstats.ini),%x,bans) +1) | writeini -n %gatherstats %x Leavebans $calc($readini(%gatherstats,%x,leavebans) +1)
  1332. writeini -n %gatherbans %x admin :gatherbot: | writeini -n %gatherbans %x tid $bancheck(tid,leaver,%x) | writeini -n %gatherbans %x type $bancheck(grund,leaver,%x)
  1333. writeini -n %gatherbans %x grund Was not ingame before the time limit expired [Admin: $iif($gauth(%admin),$ifmatch,:gatherbot:) $+ $chr(93) | writeini -n $gfile(gatherbans.ini) %x date $ctime
  1334. rconsend $1 say $gnick($gauth(%x)) got a leaver ban
  1335. whatcmd $meorsay $mainchan $logo $anick($gauth(%x)) got a leaver ban, since he was not ingame on server $serverid($1) $split Gatheradmin: $anick($gauth(%admin)) $logo
  1336. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans %x %x | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  1337. }
  1338. }
  1339. else { inc %i | if (!$readini(%joined,$1,%x)) && (%tid isnum) && ((%tid < %min) || (!%min)) { var %min = %tid } }
  1340. }
  1341. if ($gatherinfo(mysql.exe)) && (%ban) { writeini -n $gfile(upload.ini) bans steamid all | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  1342. if (%min) { .timertimeout. [ $+ [ $1 ] ] 1 $calc(%min - $ctime +1) gathertimeout $1 }
  1343. if (%ct) || (%t) {
  1344. gatherbans
  1345. if (%t) { writeini -n %gatherstatus $1 t_subs $calc($readini(%gatherstatus,$1,t_subs) + %t) }
  1346. if (%ct) { writeini -n %gatherstatus $1 ct_subs $calc($readini(%gatherstatus,$1,ct_subs) + %ct) }
  1347. var %subs = $calc(%ct + %t) | rconsend $1 say Now searching for %subs sub(s) | submsg $1
  1348. }
  1349. if (!$readini(%gplayers,$1,%admin)) {
  1350. var %i = 1 | while (%i <= $ini(%gplayers,$1,0)) { var %newadmin = $ini(%gplayers,$1,%i), %newauth = $gauth(%newadmin)
  1351. if ($admin($+($chr(35),%newauth)) >= 8) { writeini -n %gatherstatus $1 gatheradmin %newadmin | rconsend $1 say New admin: $gnick($gauth(%newadmin)) | var %newadmin = found, %i = $ini(%gplayers,$1,0) } | inc %i
  1352. }
  1353. if (%newadmin != found) { var %newadmin = $ini(%gplayers,$1,1)
  1354. if (%newadmin) { writeini -n %gatherstatus $1 gatheradmin %newadmin | rconsend $1 say New admin: $gnick($gauth(%newadmin)) }
  1355. }
  1356. }
  1357. }
  1358. alias ipbanned {
  1359. if (!$1) { return $false }
  1360. if ($readini($gfile(gatherbans.ini),$1,admin)) { return $1 }
  1361. var %i = 1, %gatherbans = $gfile(gatherbans.ini) | while (%i <= $ini(%gatherbans,0)) { var %id = $ini(%gatherbans,%i), %ip = $readini($gfile(userdata.ini),%id,ipaddress) | if ($1 == %ip) { return %id } | inc %i }
  1362. return $false
  1363. }
  1364. alias gatherleaver { var %ctimer = $+($1,.,$2)
  1365. if ($timer(%ctimer).reps) {
  1366. var %x = $ifmatch, %d = $timer(%ctimer).delay, %s = $timer(%ctimer).secs, %t = $iif(%x > 1,$calc((%x -1) * %d + %s),%s)
  1367. whatcmd $meorsay $mainchan $logo Searching after a replace for $anick($2) on Server $+($chr(35),$serverid($1)) $logo Use .replace $+(<,$chr(35),$gauth($2),/,$2,>) within $duration(%t) $logo
  1368. }
  1369. elseif ($3) {
  1370. var %sub = $iif($3 == ct,ct_subs,t_subs) | writeini -n $gfile(gatherstatus.ini) $1 %sub $calc($readini($gfile(gatherstatus.ini),$1,%sub) + 1)
  1371. writeini -n $gfile(gatherstats.ini) $2 Bans $calc($readini($gfile(gatherstats.ini),$2,bans) +1) | writeini -n $gfile(gatherstats.ini) $2 Leavebans $calc($readini($gfile(gatherstats.ini),$2,leavebans) +1)
  1372. writeini -n $gfile(gatherbans.ini) $2 admin :gatherbot: | writeini -n $gfile(gatherbans.ini) $2 tid $bancheck(tid,leaver,$2) | writeini -n $gfile(gatherbans.ini) $2 type $bancheck(grund,leaver,$2)
  1373. writeini -n $gfile(gatherbans.ini) $2 grund No replace was found within 2 minutes | writeini -n $gfile(gatherbans.ini) $2 date $ctime
  1374. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans $2 $2 | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  1375. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) bans steamid $2 | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  1376. whatcmd $meorsay $mainchan $logo $anick($2) got a leaver ban, since no replace was found within 2 minutes $logo
  1377. gatherbans | submsg $1
  1378. }
  1379. }
  1380. alias gatherleavers {
  1381. var %i = 1, %admin = $readini($gfile(gatherstatus.ini),$1,gatheradmin), %ban = 0
  1382. while (%i <= $ini($gfile(players.ini),$1,0)) {
  1383. var %z = $ini($gfile(players.ini),$1,%i)
  1384. if (!$readini($gfile(joined.ini),$1,%z)) {
  1385. remini -n $gfile(players.ini) $1 %z
  1386. if ($readini($gfile(counter.ini),$1,%z)) { remini -n $gfile(counter.ini) $1 %z }
  1387. if ($readini($gfile(terrorist.ini),$1,%z)) { remini -n $gfile(terrorist.ini) $1 %z }
  1388. if ($gatherinfo(leavebans)) && (!$readini($gfile(gatherbans.ini),%z,tid)) {
  1389. var %ban = 1
  1390. writeini -n $gfile(gatherstats.ini) %z Bans $calc($readini($gfile(gatherstats.ini),%z,bans) +1) | writeini -n $gfile(gatherstats.ini) %z Leavebans $calc($readini($gfile(gatherstats.ini),%z,leavebans) +1)
  1391. writeini -n $gfile(gatherbans.ini) %z admin :gatherbot: | writeini -n $gfile(gatherbans.ini) %z tid $bancheck(tid,leaver,%z) | writeini -n $gfile(gatherbans.ini) %z type $bancheck(grund,leaver,%z)
  1392. writeini -n $gfile(gatherbans.ini) %z grund Was not ingame while checking for leavers [Admin: $iif($gauth(%admin),$ifmatch,:gatherbot:) $+ $chr(93)
  1393. writeini -n $gfile(gatherbans.ini) %z date $ctime | writeini -n $gfile(leavers.ini) $1 %z %z
  1394. whatcmd $meorsay $mainchan $logo $anick($gauth(%z)) got a leaver ban, since he was not ingame while .needsub on server $serverid($1) $iif(%admin,$split Gatheradmin: $anick($gauth(%admin)),) $logo
  1395. .timeryes 1 0 gatherbans
  1396. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans %z %z | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  1397. }
  1398. }
  1399. else { inc %i }
  1400. }
  1401. if ($gatherinfo(mysql.exe)) && (%ban) { writeini -n $gfile(upload.ini) bans steamid all | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  1402. if (!$readini($gfile(players.ini),$1,%admin)) {
  1403. var %i = 1 | while (%i <= $ini($gfile(players.ini),$1,0)) { var %newadmin = $ini($gfile(players.ini),$1,%i), %newauth = $gauth(%newadmin)
  1404. if ($admin($+($chr(35),%newauth)) >= 8) { writeini -n $gfile(gatherstatus.ini) $1 gatheradmin %newadmin | rconsend $1 say New admin: $gnick($gauth(%newadmin)) | var %newadmin = found, %i = $ini($gfile(players.ini),$1,0) } | inc %i
  1405. }
  1406. if (%newadmin != found) { var %newadmin = $ini($gfile(players.ini),$1,1)
  1407. if (%newadmin) { writeini -n $gfile(gatherstatus.ini) $1 gatheradmin %newadmin | writeini -n $gfile(gatherstatus.ini) $1 type Public | rconsend $1 say New admin: $gnick($gauth(%newadmin)) }
  1408. }
  1409. }
  1410. }
  1411. alias tjeksteamid {
  1412. var %id = $upper($strip($1)), %tjek = $gettok(%id,1,95)
  1413. if (%tjek != STEAM) { var %id = $+(STEAM_,%id) }
  1414. if ($gatherinfo(game) == CS:GO) { var %id = $replace(%id,STEAM_0,STEAM_1) }
  1415. var %tjek = $gettok(%id,2-,95), %check = $gettok(%tjek,1,58), %check2 = $gettok(%tjek,2,58), %check3 = $gettok(%tjek,3,58)
  1416. if (%check !isnum) || (%check2 !isnum) || (%check3 !isnum) { return $false }
  1417. if (!$regex(%id,\STEAM_[0-1]{1}:[0-1]{1}:[0-9][0-9][0-9]+)) { return $false }
  1418. if ($gatherinfo(game) == CS:GO) && (!$regex(%id,\STEAM_[1]{1}:[0-1]{1}:[0-9][0-9][0-9]+)) { return $false }
  1419. return %id
  1420. }
  1421. alias findsid { var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { var %ip = $ini($gfile(gatherservers.ini),%i)) | if ($readini($gfile(players.ini),%ip,$1)) { if ($serverstatus(%ip,ingame)) { return %ip } } | inc %i } | return $false }
  1422. alias findteam { var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { var %ip = $ini($gfile(gatherservers.ini),%i)) | if ($readini($gfile(players.ini),%ip,$1)) { if ($serverstatus(%ip,ingame)) { return $iif($readini($gfile(counter.ini),%ip,$1),CT,TERRORIST) } } | inc %i } | return $false }
  1423. alias findlastnick {
  1424. var %i = 1, %readn = 1, %ids
  1425. while ($read($gfile(userdata.ini),w,$+(lastnick=,$1),%readn)) {
  1426. var %readn = $calc($readn +1), %x = $calc(%readn -2), %id
  1427. while (!%id) { var %line = $read($gfile(userdata.ini),%x) | dec %x
  1428. if (*STEAM_*:*:* iswm %line) { var %id = $remove(%line,$chr(91),$chr(93)), %ids = %ids %id }
  1429. }
  1430. if ($numtok(%ids,32) > 30) { return %ids }
  1431. }
  1432. return $iif(%ids,%ids,0)
  1433. }
  1434. alias findlastnick {
  1435. if ($read($gfile(userdata.ini),w,$+(lastnick=,$1))) {
  1436. var %i = $calc($readn -1), %id | while (!%id) { var %line = $read($gfile(userdata.ini),%i) | dec %i
  1437. if (*STEAM_*:*:* iswm %line) { var %id = $remove(%line,$chr(91),$chr(93)) | return %id }
  1438. }
  1439. return %id
  1440. }
  1441. return 0
  1442. }
  1443. alias findingame {
  1444. var %i = 1, %readn = 1, %ids
  1445. while ($read($gfile(userdata.ini),w,$+(ingamenick=,$1),%readn)) {
  1446. var %readn = $calc($readn +1), %x = $calc(%readn -2), %id
  1447. while (!%id) { var %line = $read($gfile(userdata.ini),%x) | dec %x
  1448. if (*STEAM_*:*:* iswm %line) { var %id = $remove(%line,$chr(91),$chr(93)), %ids = %ids %id }
  1449. }
  1450. if ($numtok(%ids,32) > 30) { return %ids }
  1451. }
  1452. return $iif(%ids,%ids,0)
  1453. }
  1454. alias findingame {
  1455. if ($read($gfile(userdata.ini),w,$+(ingamenick=,$1-))) {
  1456. var %i = $calc($readn -1), %id | while (!%id) { var %line = $read($gfile(userdata.ini),%i) | dec %i
  1457. if (*STEAM_*:*:* iswm %line) { var %id = $remove(%line,$chr(91),$chr(93)) | return %id }
  1458. }
  1459. return %id
  1460. }
  1461. return 0
  1462. }
  1463. alias findip {
  1464. if ($read($gfile(userdata.ini),w,$+(ipaddress=,$1-))) {
  1465. var %i = $calc($readn -1), %id | while (!%id) { var %line = $read($gfile(userdata.ini),%i) | dec %i
  1466. if (*STEAM_*:*:* iswm %line) { var %id = $remove(%line,$chr(91),$chr(93)) | return %id }
  1467. }
  1468. return %id
  1469. }
  1470. return 0
  1471. }
  1472. alias findmap {
  1473. if ($1) && ($1 !isnum) {
  1474. if ($readini($gfile(gatherinfo.ini),maps,$1)) || ($ini($gfile(gatherinfo.ini),maps,$1)) { return $lower($1) }
  1475. var %i = 1 | while (%i <= $ini($gfile(gatherinfo.ini),maps,0)) { var %x = $ini($gfile(gatherinfo.ini),maps,%i) | if ($+(*_,$1) iswm %x) || ($+(*_,$1,_*) iswm %x) { return %x } | inc %i }
  1476. }
  1477. return 0
  1478. }
  1479. alias serverid {
  1480. if ($1 == check) { if ($2 isnum) && ($ini($gfile(gatherservers.ini),$2)) { return $true } | return $false }
  1481. elseif ($1 == get) { if ($2 isnum) && ($ini($gfile(gatherservers.ini),$2)) { return $ini($gfile(gatherservers.ini),$2) } | return 0 }
  1482. var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { if ($ini($gfile(gatherservers.ini),%i) == $1) { return %i } | inc %i } | return 0
  1483. }
  1484. alias serveridd {
  1485. var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { if ($ini($gfile(gatherservers.ini),%i) == $1) { return $+($chr(35),%i) } | inc %i } | return $1
  1486. }
  1487. alias massop { if ($me isop $1) { var %i = 2, %x = $nick($1,0) | while (%i <= %x) { var %nick = $nick($1,%i) | if (%nick != $Qbot) && (%nick != S) && (%nick != $me) && ($nick !isop $1) { $iif($script(pushmode.mrc),pushmode -l,putmode) $1 +o %nick } | inc %i } } }
  1488. alias massdeop { if ($me isop $1) { var %i = 2, %x = $nick($1,0) | while (%i <= %x) { var %nick = $nick($1,%i) | if (%nick != $Qbot) && (%nick != S) && (%nick != $me) && ($nick isop $1) { $iif($script(pushmode.mrc),pushmode -l,putmode) $1 -o %nick } | inc %i } } }
  1489. alias putmode {
  1490. var %m2 = $null, %chan = $1, %mo = $left($2,1), %de = $gettok($gettok($right($2,-1),1,45),1,43), %nicks = $gettok($3-,1- $len(%de),32), %i = 1, %x = next, %time = 800 | while (%x == next) {
  1491. if ($timer(putmode [ $+ [ %i ] ]).com) {
  1492. var %timer = $ifmatch, %c = $gettok(%timer,2,32), %m = $left($gettok(%timer,3,32),1), %d = $right($gettok(%timer,3,32),-1), %n = $gettok(%timer,4-,32), %y = 1, %yy = %nicks
  1493. while (%y <= $numtok(%yy,32)) { var %yn = $gettok(%yy,%y,32) | if ($istok(%n,%yn,32)) { var %nicks = $remtok(%nicks,%yn,32), %de = $right(%de,-1) } | inc %y }
  1494. if (!%nicks) || (!%de) { var %x = end } | elseif (%chan == %c) && (%mo == %m) && ($calc($len(%de) + $len(%d)) <= 5) { .timerputmode [ $+ [ %i ] ] -m 1 %time whatcmd mode %c $+(%m,%d,%de) %n %nicks | var %x = found }
  1495. }
  1496. else { .timerputmode [ $+ [ %i ] ] -m 1 %time whatcmd mode $1- | var %x = found } | if (%time < 2000) { inc %time 800 } | else { inc %time 1200 } | inc %i
  1497. }
  1498. }
  1499. alias newsteamid {
  1500. var %i = 1 | while (%i <= $ini($gfile(gatherservers.ini),0)) { var %ipp = $ini($gfile(gatherservers.ini),%i), %gamestats = $gamestatsini(%ipp)
  1501. if ($readini($gfile(gatherstatus.ini),%ipp,gatheradmin) == $1) { writeini -n $gfile(gatherstatus.ini) %ipp gatheradmin $2 }
  1502. if ($readini($gfile(gatherstatus.ini),%ipp,challenger) == $1) { writeini -n $gfile(gatherstatus.ini) %ipp challenger $2 }
  1503. if ($readini($gfile(gatherstatus.ini),%ipp,challenged) == $1) { writeini -n $gfile(gatherstatus.ini) %ipp challenged $2 }
  1504. if ($readini($gfile(players.ini),%ipp,$1)) { remini -n $gfile(players.ini) %ipp $1 | writeini -n $gfile(players.ini) %ipp $2 $2 }
  1505. if ($readini($gfile(counter.ini),%ipp,$1)) { var %s = $ifmatch | remini -n $gfile(counter.ini) %ipp $1 | writeini -n $gfile(counter.ini) %ipp $2 %s }
  1506. if ($readini($gfile(terrorist.ini),%ipp,$1)) { var %s = $ifmatch | remini -n $gfile(terrorist.ini) %ipp $1 | writeini -n $gfile(terrorist.ini) %ipp $2 %s }
  1507. if ($readini($gfile(joined.ini),%ipp,$1)) { var %s = $ifmatch | remini -n $gfile(joined.ini) %ipp $1 | writeini -n $gfile(joined.ini) %ipp $2 %s }
  1508. if ($ini(%gamestats,$1)) { var %x = 1 | while (%x <= $ini(%gamestats,$1,0)) { var %s = $ini(%gamestats,$1,%x), %r = $readini(%gamestats,$1,%s) | writeini -n %gamestats $2 %s %r | inc %x } | remini -n %gamestats $1 }
  1509. inc %i
  1510. }
  1511. if ($read(ingamenicks.dat,s,$1)) { var %ingame = $gettok($ifmatch,2-,32) | write -ds $+ $1 ingamenicks.dat | write ingamenicks.dat $2 %ingame }
  1512. if ($read($gfile(gatherusers.dat),w,* $1)) { var %auth = $gettok($ifmatch,1,32) | write -ds $+ %auth $gfile(gatherusers.dat) | write $gfile(gatherusers.dat) %auth $2 }
  1513. if ($read($gfile(authed.dat),w,* $1)) { var %nick = $gettok($ifmatch,1,32), %auth = $gettok($ifmatch,2,32) | write -ds $+ %nick $gfile(authed.dat) | write $gfile(authed.dat) %nick %auth $2 }
  1514. if ($ini($gfile(userdata.ini),$1)) { var %x = 1 | while (%x <= $ini($gfile(userdata.ini),$1,0)) { var %s = $ini($gfile(userdata.ini),$1,%x), %r = $readini($gfile(userdata.ini),$1,%s) | writeini -n $gfile(userdata.ini) $2 %s %r | inc %x } | remini -n $gfile(userdata.ini) $1 }
  1515. if ($ini($gfile(wepstats.ini),$1)) { var %x = 1 | while (%x <= $ini($gfile(wepstats.ini),$1,0)) { var %s = $ini($gfile(wepstats.ini),$1,%x), %r = $readini($gfile(wepstats.ini),$1,%s) | writeini -n $gfile(wepstats.ini) $2 %s %r | inc %x } | remini -n $gfile(wepstats.ini) $1 }
  1516. if ($ini($gfile(hitstats.ini),$1)) { var %x = 1 | while (%x <= $ini($gfile(hitstats.ini),$1,0)) { var %s = $ini($gfile(hitstats.ini),$1,%x), %r = $readini($gfile(hitstats.ini),$1,%s) | writeini -n $gfile(hitstats.ini) $2 %s %r | inc %x } | remini -n $gfile(hitstats.ini) $1 }
  1517. if ($ini($gfile(gatherstats.ini),$1)) { var %x = 1 | while (%x <= $ini($gfile(gatherstats.ini),$1,0)) { var %s = $ini($gfile(gatherstats.ini),$1,%x), %r = $readini($gfile(gatherstats.ini),$1,%s) | writeini -n $gfile(gatherstats.ini) $2 %s %r | inc %x } | remini -n $gfile(gatherstats.ini) $1 }
  1518. if ($ini($gfile(clutchstats.ini),$1)) { var %x = 1 | while (%x <= $ini($gfile(clutchstats.ini),$1,0)) { var %s = $ini($gfile(clutchstats.ini),$1,%x), %r = $readini($gfile(clutchstats.ini),$1,%s) | writeini -n $gfile(clutchstats.ini) $2 %s %r | inc %x } | remini -n $gfile(clutchstats.ini) $1 }
  1519. if ($ini($gfile(gatherbans.ini),$1)) { var %x = 1 | while (%x <= $ini($gfile(gatherbans.ini),$1,0)) { var %s = $ini($gfile(gatherbans.ini),$1,%x), %r = $readini($gfile(gatherbans.ini),$1,%s) | writeini -n $gfile(gatherbans.ini) $2 %s %r | inc %x } | remini -n $gfile(gatherbans.ini) $1 }
  1520. return $true
  1521. }
  1522. alias votemap {
  1523. if (($gatherstatus(signup)) || ($gatherstatus(pick))) { var %ip = $gatherstatus(ip), %id = $serverid(%ip), %votemap = $+(votemap_,%id), %map = $gatherstatus(%ip,map)
  1524. if ($ini($gfile(voting.ini),%votemap)) {
  1525. if ($timer(votemap).reps >= 1) {
  1526. whatcmd $meorsay $iif($me ison $1,$1,$mainchan) $logo Votemap in progress $logo Use: .vote <map> - to vote for a map $split Example: .vote %map $+  $logo
  1527. }
  1528. else {
  1529. if ($ini($gfile(voting.ini),mapresult,0)) { remini -n $gfile(voting.ini) mapresult }
  1530. var %i = 1 | while (%i <= $ini($gfile(voting.ini),%votemap,0)) {
  1531. var %x = $ini($gfile(voting.ini),%votemap,%i), %r = $readini($gfile(voting.ini),%votemap,%x) | writeini -n $gfile(voting.ini) mapresult %r $calc($readini($gfile(voting.ini),mapresult,%r) +1) | inc %i
  1532. }
  1533. var %i = 1, %last = 0, %lastnr = 0, %votes = 0, %maps | while (%i <= $ini($gfile(voting.ini),mapresult,0)) {
  1534. var %x = $ini($gfile(voting.ini),mapresult,%i), %r = $readini($gfile(voting.ini),mapresult,%x), %votes = $calc(%votes + %r), %maps = $iif(%maps,$ifmatch $split) $+(%x,:) %r
  1535. if (%r > %lastnr) { var %last = %x, %lastnr = %r } | elseif (%r == %lastnr) { var %last = 0 } | inc %i
  1536. }
  1537. if ($ini($gfile(voting.ini),%votemap)) { remini -n $gfile(voting.ini) %votemap }
  1538. if ($ini($gfile(voting.ini),mapresult,0)) { remini -n $gfile(voting.ini) mapresult }
  1539. if (%maps) {
  1540. if (%last) { var %total = $calc(100 / %votes), %pct = $round($calc(%total * %lastnr),2)
  1541. if (%last != %map) {
  1542. writeini -n $gfile(gatherstatus.ini) %ip map %last
  1543. whatcmd $meorsay $iif($me ison $1,$1,$mainchan) $logo Votemap is over $logo %maps $logo Changing map from %map to %last $+  $+ $col(14,$chr(40),07) $+ %pct $+ $col(14,$+($chr(37),$chr(41))) with most votes $logo
  1544. }
  1545. else {
  1546. whatcmd $meorsay $iif($me ison $1,$1,$mainchan) $logo Votemap is over $logo %maps $logo Since there is most votes on the current map, it stays %last $+  $+ $col(14,$chr(40),07) $+ %pct $+ $col(14,$+($chr(37),$chr(41))) with most votes $logo
  1547. }
  1548. }
  1549. else { whatcmd $meorsay $iif($me ison $1,$1,$mainchan) $logo Votemap is over $logo %maps $logo Since there is no map with most votes, map stays on  %map $+  $logo }
  1550. }
  1551. else { whatcmd $meorsay $iif($me ison $1,$1,$mainchan) $logo Votemap is over $logo Since there has been no votes, map stays on %map $+  $logo }
  1552. }
  1553. }
  1554. elseif ($timer(votemap)) { .timervotemap off }
  1555. }
  1556. else {
  1557. if ($timer(votemap)) { .timervotemap off }
  1558. var %i = 1 | while ($serverid(get,%i)) { var %ip = $ifmatch, %votemap = $+(votemap_,%i) | if ($ini($gfile(voting.ini),%votemap)) { remini -n $gfile(voting.ini) %votemap } | inc %i }
  1559. }
  1560. }
  1561.  
  1562. ;#################################### Alias to search for subsitutes ##########################################;
  1563.  
  1564. alias needsub {
  1565. var %i = 1, %x = $ini($gfile(players.ini),$1,0), %ct = 0, %t = 0 | while (%i <= %x) {
  1566. var %z = $ini($gfile(players.ini),$1,%i) | if (!$readini($gfile(joined.ini),$1,%z)) { if ($readini($gfile(counter.ini),$1,%z)) { inc %ct } | elseif ($readini($gfile(terrorist.ini),$1,%z)) { inc %t } } | inc %i
  1567. }
  1568. if (%ct) || (%t) {
  1569. if (%t) { writeini -n $gfile(gatherstatus.ini) $1 t_subs $calc($readini($gfile(gatherstatus.ini),$1,t_subs) + %t) }
  1570. if (%ct) { writeini -n $gfile(gatherstatus.ini) $1 ct_subs $calc($readini($gfile(gatherstatus.ini),$1,ct_subs) + %ct) }
  1571. var %subs = $calc(%ct + %t) | rconsend $1 say Now searching for %subs sub(s) | if (!$timer(submsg)) { submsg $1 } | gatherleavers $1
  1572. }
  1573. else { rconsend $1 say There is no one to search sub for }
  1574. }
  1575. alias subtjek {
  1576. var %x = $ini($gfile(players.ini),$1,0), %ct = $ini($gfile(counter.ini),$1,0), %t = $ini($gfile(terrorist.ini),$1,0), %i = $calc(%ct + %t), %slots = $iif($readini($gfile(gatherstatus.ini),$1,slots),$ifmatch,%x), %total = $calc(%ct + %t)
  1577. if ($1) && ($calc(%slots - %total - $calc($readini($gfile(gatherstatus.ini),$1,ct_subs) + $readini($gfile(gatherstatus.ini),$1,t_subs))) >= 1) { return $true } | return $false
  1578. }
  1579. alias seeksub {
  1580. if ($subtjek($1)) {
  1581. var %ct = $ini($gfile(counter.ini),$1,0), %t = $ini($gfile(terrorist.ini),$1,0), %i = $calc(%ct + %t), %slots = $iif($readini($gfile(gatherstatus.ini),$1,slots),$ifmatch,$ini($gfile(players.ini),$1,0)), %ct.s = 0, %t.s = 0
  1582. while (%i < %slots) { if (%ct < %t) { inc %ct.s } | else { inc %t.s } | inc %i } | if (%ct.s) || (%t.s) {
  1583. if (%t.s) { writeini -n $gfile(gatherstatus.ini) $1 t_subs $calc($readini($gfile(gatherstatus.ini),$1,t_subs) + %t.s) }
  1584. if (%ct.s) { writeini -n $gfile(gatherstatus.ini) $1 ct_subs $calc($readini($gfile(gatherstatus.ini),$1,ct_subs) + %ct.s) }
  1585. var %subs = $calc(%ct.s + %t.s) | rconsend $1 say Now searching for %subs sub(s) | if (!$timer(submsg)) { submsg $1 }
  1586. }
  1587. else { rconsend $1 say There is no room for more than %slots players }
  1588. }
  1589. else { rconsend $1 say There is no room for more than $iif($readini($gfile(gatherstatus.ini),$1,slots),$ifmatch,$ini($gfile(players.ini),$1,0)) players }
  1590. }
  1591. alias fastsub {
  1592. if (($2 == ct) || ($2 == t)) && ($3 isnum) && ($3 != 0) {
  1593. if ($calc($readini($gfile(gatherstatus.ini),$1,ct_subs) + $readini($gfile(gatherstatus.ini),$1,t_subs) + $3) < 9) {
  1594. if (!$sameteam($score($1,total))) { var %ini = $+($iif($2 == ct,t,ct),_subs) } | else { var %ini = $+($2,_subs) }
  1595. writeini -n $gfile(gatherstatus.ini) $1 %ini $calc($readini($gfile(gatherstatus.ini),$1,%ini) + $3) | rconsend $1 say Now searching for $3 sub(s) | if (!$timer(submsg)) { submsg $1 }
  1596. }
  1597. else { rconsend $1 say Cant search more than 9 subs at once }
  1598. }
  1599. }
  1600. alias endsub {
  1601. if ($readini($gfile(gatherstatus.ini),$1,t_subs)) { remini -n $gfile(gatherstatus.ini) $1 t_subs | var %endsub = ended } | if ($readini($gfile(gatherstatus.ini),$1,ct_subs)) { remini -n $gfile(gatherstatus.ini) $1 ct_subs | var %endsub = ended }
  1602. if (%endsub == ended) { rconsend $1 say Substitute search ended | whatcmd $meorsay $mainchan $logo Substitute search on server $serverid($1) got ended by $anick($2) $logo } | else { rconsend $1 say There is no subsitute search now }
  1603. }
  1604. alias csjoins { var %i = 1, %ct = 0, %t = 0 | while (%i <= $ini($gfile(joined.ini),$1,0)) { var %x = $ini($gfile(joined.ini),$1,%i) | if ($readini($gfile(counter.ini),$1,%x)) { inc %ct } | elseif ($readini($gfile(terrorist.ini),$1,%x)) { inc %t } | inc %i } return $iif($2 == ct,%ct,%t) }
  1605. alias mostsigns { var %i = 1, %ct = 0, %t = 0 | while (%i <= $ini($gfile(counter.ini),$1,0)) || (%i <= $ini($gfile(terrorist.ini),$1,0)) { if ($ini($gfile(counter.ini),$1,%i)) { inc %ct } | if ($ini($gfile(terrorist.ini),$1,%i)) { inc %t } | inc %i } | return $iif($2 == ct,%ct,%t) }
  1606. alias addsub {
  1607. if ($gatherstatus(sub)) {
  1608. var %ip = $ifmatch, %ip2 = %ip, %id, %forceteam
  1609. if ($2 isnum) { var %id = $2, %ip2 = $ini($gfile(gatherservers.ini),%id) | if ($3 == T) || ($3 == CT) { var %forceteam = $3 } } | elseif ($2 == T) || ($2 == CT) { var %forceteam = $2 }
  1610. if ($serverstatus(%ip2,sub)) { var %ip = %ip2 }
  1611. if (!$readini($gfile(players.ini),%ip,$1)) {
  1612. var %ct.subs = $iif($readini($gfile(gatherstatus.ini),%ip,ct_subs),$ifmatch,0), %t.subs = $iif($readini($gfile(gatherstatus.ini),%ip,t_subs),$ifmatch,0)
  1613. var %ct.score = $score(%ip,ct), %t.score = $score(%ip,t), %total = $score(%ip,total)
  1614. if (%forceteam) && (!$sameteam(%total)) { var %forceteam = $iif(%forceteam == CT,T,CT) }
  1615. if (%ct.subs) && (%t.subs) {
  1616. if (%forceteam) && (% [ $+ [ %forceteam ] $+ ] .subs) { var %team = %forceteam, %ini = $iif(%team == CT,$gfile(counter.ini),$gfile(terrorist.ini)) }
  1617. elseif (%ct.subs > %t.subs) { var %team = CT, %ini = $gfile(counter.ini) } | elseif (%t.subs > %ct.subs) { var %team = T, %ini = $gfile(terrorist.ini) }
  1618. elseif (%ct.score > %t.score) { var %team = T, %ini = $gfile(terrorist.ini) } | else { var %team = CT, %ini = $gfile(counter.ini) }
  1619. }
  1620. elseif (%ct.subs) { var %team = CT, %ini = $gfile(counter.ini) } | else { var %team = T, %ini = $gfile(terrorist.ini) }
  1621. if (%team == CT) { dec %ct.subs | if (%ct.subs >= 1) { writeini -n $gfile(gatherstatus.ini) %ip ct_subs %ct.subs } | else { remini -n $gfile(gatherstatus.ini) %ip ct_subs } }
  1622. elseif (%team == T) { dec %t.subs | if (%t.subs >= 1) { writeini -n $gfile(gatherstatus.ini) %ip t_subs %t.subs } | else { remini -n $gfile(gatherstatus.ini) %ip t_subs } }
  1623. writeini -n $gfile(players.ini) %ip $1 $calc($ctime +300) | writeini -n %ini %ip $1 $1 | if ($readini($gfile(kicked.ini),%ip,$1)) { remini -n $gfile(kicked.ini) %ip $1 } | msgnick %ip $1
  1624. writeini -n $gfile(gatherstats.ini) $1 Subs $calc($gatherstats($1,Subs) +1)
  1625. whatcmd $meorsay $mainchan $logo $anick($gauth($1)) was added as substitute (Team: $iif(%team == CT,$col(11,%team),$col(04,%team)) $+ ) and info is sent to the player $split Server $+($chr(35),,$serverid(%ip),) $logo
  1626. rconsend %ip say $gnick($gauth($1)) joins as substitute (Team: $iif($sameteam(%total),%team,$iif(%team = CT,T,CT)) $+ ) | gathertimeout %ip
  1627. var %admin = $readini($gfile(gatherstatus.ini),%ip,gatheradmin), %adminauth = $gauth(%admin), %adminlevel = $admin($+($chr(35),%adminauth)), %alevel = $admin($+($chr(35),%auth))
  1628. if (%adminlevel < 8) && (%alevel > %adminlevel) { writeini -n $gfile(gatherstatus.ini) %ip gatheradmin %id | rconsend %ip say New admin: $gnick(%auth) }
  1629. if ($gatherstatus(signout)) {
  1630. var %ipp = $gatherstatus(ip), %added = $gatherstatus(%ipp,added), %steamid = $1, %type = $gatherstatus(%ipp,type), %ga = $gatherstatus(%ipp,gatheradmin), %cl1 = $gatherstatus(%ipp,challenger), %cl2 = $gatherstatus(%ipp,challenged)
  1631. if ($readini($gfile(players.ini),%ipp,%steamid)) && (!$gatherstatus(%ip,clstatus)) {
  1632. if (%type == Challenge) && ((%steamid == %cl1) || (%steamid == %cl2)) { resetall %ipp | .timeradded 1 0 whatcmd $meorsay $mainchan $logo $anick($gauth($1)) got added as substitute, the gather is therefore stopped $logo | .timerendsignup off }
  1633. elseif (%added > 1) { remini -n $gfile(players.ini) %ipp %steamid | endsigntimer %type
  1634. if (%ga == %steamid) {
  1635. var %i = 1 | while (%i <= $ini($gfile(players.ini),%ipp,0)) {
  1636. var %newadmin = $ini($gfile(players.ini),%ipp,%i), %newauth = $gauth(%newadmin)
  1637. if ($admin($+($chr(35),%newauth)) >= 8) { writeini -n $gfile(gatherstatus.ini) %ipp gatheradmin %newadmin | var %newadmin = found, %i = $ini($gfile(players.ini),%ipp,0) }
  1638. inc %i
  1639. }
  1640. if (%newadmin != found) { var %newadmin = $ini($gfile(players.ini),%ipp,1) | writeini -n $gfile(gatherstatus.ini) %ipp gatheradmin %newadmin | writeini -n $gfile(gatherstatus.ini) %ipp type Public }
  1641. }
  1642. endsigntimer $gatherstatus(%ipp,type)
  1643. }
  1644. else { resetall %ipp | whatcmd $meorsay $mainchan $logo $anick($gauth($1)) got added as substitute, the gather is therefore stopped $logo | .timerendsignup off }
  1645. }
  1646. }
  1647. }
  1648. else {
  1649. whatcmd $meorsay $mainchan $logo $anick($1) is already signed up on server $+($chr(35),$serverid(%ip)) $logo
  1650. }
  1651. }
  1652. }
  1653. alias submsg {
  1654. if ($1) {
  1655. var %ct = $iif($readini($gfile(gatherstatus.ini),$1,ct_subs),$ifmatch,0), %t = $iif($readini($gfile(gatherstatus.ini),$1,t_subs),$ifmatch,0), %subs = $calc(%ct + %t), %map = $readini($gfile(gatherstatus.ini),$1,map) | if (%subs) {
  1656. if (!$sameteam($score($1,total))) { var %x = %ct, %ct = %t, %t = %x, %s.ct = $score($1,ct), %s.t = $score($1,t) } | else { var %s.ct = $score($1,ct), %s.t = $score($1,t) }
  1657. whatcmd $meorsay $mainchan $logo Searching for %subs sub(s) on server $serverid($1) $logo $col(11,CT:) %s.ct $col(04,T:) %s.t $logo Map: %map $+  $logo Use: .addsub %i - to sign as substitute $logo
  1658. }
  1659. elseif ($timer(submsg. [ $+ [ $1 ] ])) { .timersubmsg. [ $+ [ $1 ] ] off }
  1660. }
  1661. else {
  1662. var %i = 1, %seeksub = 0 | while (%i <= $ini($gfile(gatherservers.ini),0)) {
  1663. var %ip = $ini($gfile(gatherservers.ini),%i), %ct = $iif($readini($gfile(gatherstatus.ini),%ip,ct_subs),$ifmatch,0), %t = $iif($readini($gfile(gatherstatus.ini),%ip,t_subs),$ifmatch,0), %subs = $calc(%ct + %t), %map = $readini($gfile(gatherstatus.ini),%ip,map) | if (%subs) {
  1664. inc %seeksub | if (!$sameteam($score($1,total))) { var %x = %ct, %ct = %t, %t = %x, %s.ct = $score(%ip,ct), %s.t = $score(%ip,t) } | else { var %s.ct = $score(%ip,ct), %s.t = $score(%ip,t) }
  1665. whatcmd $meorsay $mainchan $logo Searching for %subs sub(s) on server %i $logo $col(11,CT:) %s.ct $col(04,T:) %s.t $logo Map: %map $+  $logo Use: .addsub %i - to sign as substitute $logo
  1666. }
  1667. elseif ($timer(submsg. [ $+ [ %ip ] ])) { .timersubmsg. [ $+ [ %ip ] ] off } | inc %i
  1668. }
  1669. if (!%seeksub) && ($timer(submsg)) { .timersubmsg off }
  1670. }
  1671. }
  1672.  
  1673. ;#################################### Aliases to reset servers, signup etc ##########################################
  1674.  
  1675. alias endsigntimer {
  1676. ;;SPECIAL;;
  1677. if (#signfrag.* iswm $mainchan) || (#CSGO.hu == $mainchan) {
  1678. if ($1 == Challenge) { .timerendsignup 2 150 endsignup } | else { .timerendsignup 2 60 endsignup }
  1679. }
  1680. elseif (#kosegather == $mainchan) {
  1681. .timerendsignup 2 900 endsignup
  1682. }
  1683. elseif ($1 == Challenge) { .timerendsignup 2 $calc($gatherinfo(timetoabortcl) * 30) endsignup } | else { .timerendsignup 2 $calc($gatherinfo(timetoabortsg) * 30) endsignup }
  1684. }
  1685. alias endsignup {
  1686. if ($gatherstatus(signup)) {
  1687. var %ip = $ifmatch, %type = $gatherstatus(%ip,type), %d = $timer(endsignup).delay, %time = $duration($calc(%d * 2))
  1688. if ($timer(endsignup).reps) {
  1689. var %x = $ifmatch, %s = $timer(endsignup).secs, %t = $iif(%x > 1,$calc((%x -1) * %d + %s),%s)
  1690. whatcmd $meorsay $mainchan $logo $col(04,Warning:) The gather signup will be aborted in $duration(%t) $split Can be extended with .sign; .out; .extend $logo
  1691. }
  1692. else {
  1693. resetall %ip | whatcmd settopic | whatcmd $meorsay $mainchan $logo The gather signup have been inactive for %time and is therefore stopped $logo
  1694. }
  1695. }
  1696. elseif ($timer(endsignup)) { .timerendsignup off }
  1697. }
  1698. alias clrejectimer {
  1699. if ($2 == all) { .timerchallenge 2 $calc($gatherinfo(timetoacceptall) * 30) clreject $1 } | else { .timerchallenge 2 $calc($gatherinfo(timetoaccept) * 30) clreject $1 }
  1700. }
  1701. alias clreject {
  1702. if ($gatherstatus(accept)) {
  1703. var %accept = $ifmatch, %ip = $gatherstatus(ip), %csteamid = $readini($gfile(gatherstatus.ini),%ip,challenger), %cauth = $gauth(%csteamid), %cnick = $anick(%cauth), %map = $readini($gfile(gatherstatus.ini),%ip,map), %slots = $readini($gfile(gatherstatus.ini),%ip,slots), %chan = $iif($me ison $1,$1,$iif($me ison $mainchan,$mainchan,$iif($me ison $privchan,$privchan,$ownerchan))), %d = $timer(challenge).delay, %time = $duration($calc(%d * 2)), %region = $readini($gfile(gatherstatus.ini),%ip,region)
  1704. if ($timer(challenge).reps) {
  1705. var %x = $ifmatch, %s = $timer(challenge).secs, %t = $iif(%x > 1,$calc((%x -1) * %d + %s),%s)
  1706. whatcmd $meorsay %chan $logo $col(04,Warning:) %cnick has challenged $iif(%accept == All,You?,$anick(%accept) $+ ) $iif(%slots == 2,for a 1v1) $split $iif($gatherinfo(regions),Region: $+(,%region,) $split) Map: %map $+  $logo $iif(%accept == All,Anyone can use .accept ,Use .accept or .reject) $col(14,$chr(40)) $+ $duration(%t) $+ $col(14,$chr(41)) $logo
  1707. }
  1708. else {
  1709. remini -n $gfile(gatherstatus.ini) %ip accept | resetall %ip | whatcmd $meorsay %chan $logo Challenge accept timeout after %time $logo %cnick had challenged $iif(%accept == All,All,$anick(%accept)) on %map $+ , but did not get accepted $col(14,$chr(40)) $+ .accept $+ $col(14,$chr(41)) $logo | .timerendsignup off
  1710. }
  1711. }
  1712. elseif ($timer(challenge)) { .timerchallenge off }
  1713. }
  1714. alias resetserver {
  1715. var %id = $serverid($1), %switch = $+(switch_,%id), %replace = $+(replace_,%id), %abortgame = $+(abortgame_,%id), %result = $+(result_,%id), %gamestats = $gamestatsini($1) | .timer [ $+ [ $+(*,$1,*) ] ] off | unset % [ $+ [ $+(*,$1,*) ] ]
  1716. remini -n $gfile(voting.ini) %switch | remini -n $gfile(voting.ini) %replace | remini -n $gfile(voting.ini) %abortgame | remini -n $gfile(voting.ini) %result | remini -n $gfile(leavers.ini) $1 | remini -n $gfile(ready.ini) $1 | remini -n $gfile(picked.ini) $1 | remini -n $gfile(stacks.ini) $1 | remini -n $gfile(record.ini) $1
  1717. remini -n $gfile(players.ini) $1 | remini -n $gfile(joined.ini) $1 | remini -n $gfile(kicked.ini) $1 | remini -n $gfile(counter.ini) $1 | remini -n $gfile(lancheck.ini) $1 | remini -n $gfile(kills.ini) $1 | remini -n $gfile(terrorist.ini) $1 | remini -n $gfile(score.ini) $1 | remini -n $gfile(tempreg.ini) $1
  1718. if ($ini($gfile(newteams.ini),$1)) { .timer 1 2 resetnewteams $1 } | if ($readini($gfile(gatherservers.ini),$1,status)) { remini -n $gfile(gatherservers.ini) $1 status } | if ($isfile(%gamestats)) { .remove %gamestats }
  1719. if ($2) { whatcmd $meorsay $mainchan $logo Gather on server $serverid($1) was stopped by $anick($gauth($2)) $logo | if ($vtset($1)) { .timer 1 1 delete.vt $1 } | if ($checkrematch) { var %id = $ifmatch | whatcmd rematch %id } }
  1720. .timer 1 1 resetlog $1 | .timer 1 1 resetlog2 $1 | srcon.clear $1
  1721. }
  1722. alias resetall {
  1723. if ($ini($gfile(gatherstatus.ini),$1)) { remini -n $gfile(gatherstatus.ini) $1 } | if ($readini($gfile(gatherstatus.ini),info,ip) == $1) { remini -n $gfile(gatherstatus.ini) info }
  1724. .resetserver $1-
  1725. }
  1726. alias resetnewteams { var %i = 1 | while (%i <= $ini($gfile(newteams.ini),$1,0)) { var %x = $ini($gfile(newteams.ini),$1,%i) | remini -n $gfile(newteams.ini) %x | inc %i } | if ($ini($gfile(newteams.ini),$1)) { remini -n $gfile(newteams.ini) $1 } }
  1727. alias resetchanstats {
  1728. if ($readini($gfile(gatherstats.ini),chan,day) != $day) {
  1729. writeini -n $gfile(gatherstats.ini) chan day $day | var %m = $null, %y = $null
  1730. if ($day == Monday) { remini -n $gfile(gatherstats.ini) chan thisweek }
  1731. if ($readini($gfile(gatherstats.ini),chan,year) != $date(yyyy)) { writeini -n $gfile(gatherstats.ini) chan year $date(yyyy) }
  1732. if ($readini($gfile(gatherstats.ini),chan,today)) { var %ifmatch = $ifmatch | writeini -n $gfile(gatherstats.ini) chan lastday %ifmatch | remini -n $gfile(gatherstats.ini) chan today } | elseif ($readini($gfile(gatherstats.ini),chan,lastday)) { remini -n $gfile(gatherstats.ini) chan lastday }
  1733. if ($readini($gfile(gatherstats.ini),chan,month) != $date(mmm)) { var %m = $readini($gfile(gatherstats.ini),chan,month) | if (%m) { remini -n $gfile(gatherstats.ini) chan %m } | writeini -n $gfile(gatherstats.ini) chan month $date(mmm) }
  1734. else { var %ctime = $calc($ctime +86400), %date = $date(%ctime,mmm) }
  1735. }
  1736. .timerchanstats -o 00:00 1 2 .resetchanstats
  1737. }
  1738. alias checktimers {
  1739. if (!$timer(chanstats)) { resetchanstats }
  1740. if (!$timer(adv)) { .timeradv2 1 10 advertise }
  1741. if (!$timer(gatherbans)) { .timer 1 3 gatherbans }
  1742. if (!$timer(gatherdemotes)) { .timer 1 5 gatherdemotes }
  1743. if (!$timer(checkconn)) { .timercheckconn -o 1 300 checkconn }
  1744. if (!$statscheck) && ($readini($gfile(gatherinfo.ini),modes,statschat)) && (!$timer(statschat)) { .timer -o 1 1 statschat }
  1745. }
  1746. alias advertise {
  1747. if ($ini($gfile(gatheradv.ini),0)) && ($me ison $mainchan) {
  1748. var %n = $readini($gfile(gatherinfo.ini),gatheradv,line), %line = $iif(%n,$calc(%n +1),1)
  1749. if ($ini($gfile(gatheradv.ini),%line)) { var %cmd = $ifmatch } | else { var %line = 1, %cmd = $ini($gfile(gatheradv.ini),%line) }
  1750. var %txt = $readini($gfile(gatheradv.ini),n,%cmd,txt), %saytxt = $c_text($mainchan,%txt) | writeini -n $gfile(gatherinfo.ini) gatheradv line %line | statsbot $mainchan %saytxt
  1751. ;;SPECIAL;;
  1752. if (#signfrag.* iswm $mainchan) { .timeradv 0 900 advertise | return }
  1753. .timeradv 0 $calc($gatherinfo(timetoadv) * 60) advertise
  1754. }
  1755. }
  1756. alias serverinuse { var %ip = $iif($1 != 0,$1,Error), %status = $gatherstatus(%ip) | if (!$istok(Free Error Offline Ended Cooldown,%status,32)) { return $true } | return $false }
  1757. alias servernotfree { var %ip = $iif($1 != 0,$1,Error), %status = $gatherstatus(%ip) | if (!$istok(Free Ended Cooldown,%status,32)) { return $true } | return $false }
  1758. alias posgid {
  1759. var %i = 1, %gid = $calc($gatherstats(chan,played) +1) | while ($ini($gfile(gatherservers.ini),%i)) {
  1760. var %ip = $ifmatch, %status = $gatherstatus(%ip)
  1761. if (!$istok(Free Error Offline Ended Signup Sending_Info Picking Cooldown,%status,32)) && ($1 != %ip) { inc %gid }
  1762. inc %i
  1763. }
  1764. return %gid
  1765. }
  1766. alias admindate {
  1767. var %date = $replace($1-,$chr(45),$chr(32),$chr(47),$chr(32)), %m = $gettok(%date,1,32), %y = $gettok(%date,2,32)
  1768. if (%m) && (%y) { if (%m isnum 1-12) && (%y isnum 0-9999) { var %month = $adminday($round(%m,0)), %year = $adminyear(%y) | return $+(%month,-,%year) } | return 0 }
  1769. elseif (%m isnum 1-12) { var %month = $adminday($round(%m,0)), %year = $date(yyyy) | return $+(%month,-,%year) } | return 0
  1770. }
  1771. alias adminday { if ($len($1) == 1) { return $+(0,$1) } | return $1 }
  1772. alias adminyear { var %year = $date(yyyy), %len = $calc(4 - $len($1)) | return $+($left(%year,%len),$1) }
  1773.  
  1774. alias html {
  1775. if (($1-) || ($1 == 0)) && ($prop) { var %prop = $ifmatch
  1776. if (%prop == s) || (%prop == small) { return $iif($+(<s>,$1-,</s>),$ifmatch,-ERROR-S1-) }
  1777. if (%prop == p) || (%prop == normal) { return $iif($+(<p>,$1-,</p>),$ifmatch,-ERROR-P2-) }
  1778. if (%prop == m) || (%prop == big) { return $iif($+(<m>,$1-,</m>),$ifmatch,-ERROR-) }
  1779. if (%prop == b) || (%prop == bold) { return $iif($+(<b>,$1-,</b>),$ifmatch,-ERROR-) }
  1780. if (%prop == i) || (%prop == u) { return $iif($+(<i>,$1-,</i>),$ifmatch,-ERROR-) }
  1781. if (%prop == strong) { return $iif($+(<strong>,$1-,</strong>),$ifmatch,-ERROR-) }
  1782. if (%prop == c) || (%prop == color) {
  1783. if ($1 == 0) || ($1 == white) { return $iif($+(<c style="color:#FFFFFF">,$2-,</c>),$ifmatch,-ERROR-) }
  1784. if ($1 == 1) || ($1 == black) { return $iif($+(<c style="color:#000000">,$2-,</c>),$ifmatch,-ERROR-) }
  1785. if ($1 == 2) || ($1 == navy) { return $iif($+(<c style="color:#000080">,$2-,</c>),$ifmatch,-ERROR-) }
  1786. if ($1 == 3) || ($1 == green) { return $iif($+(<c style="color:#009900">,$2-,</c>),$ifmatch,-ERROR-) }
  1787. if ($1 == 4) || ($1 == red) { return $iif($+(<c style="color:#FF0000">,$2-,</c>),$ifmatch,-ERROR-) }
  1788. if ($1 == 5) || ($1 == brown) { return $iif($+(<c style="color:#8B4513">,$2-,</c>),$ifmatch,-ERROR-) }
  1789. if ($1 == 6) || ($1 == purple) { return $iif($+(<c style="color:#800080">,$2-,</c>),$ifmatch,-ERROR-) }
  1790. if ($1 == 7) || ($1 == orange) { return $iif($+(<c style="color:#FFA520">,$2-,</c>),$ifmatch,-ERROR-) }
  1791. if ($1 == 8) || ($1 == yellow) { return $iif($+(<c style="color:#EEEE00">,$2-,</c>),$ifmatch,-ERROR-) }
  1792. if ($1 == 9) || ($1 == lime) { return $iif($+(<c style="color:#00FF00">,$2-,</c>),$ifmatch,-ERROR-) }
  1793. if ($1 == 10) || ($1 == teal) { return $iif($+(<c style="color:#008080">,$2-,</c>),$ifmatch,-ERROR-) }
  1794. if ($1 == 11) || ($1 == turquoise) || ($1 == turq) { return $iif($+(<c style="color:#80BFFF">,$2-,</c>),$ifmatch,-ERROR-) }
  1795. if ($1 == 12) || ($1 == blue) { return $iif($+(<c style="color:#0000CD">,$2-,</c>),$ifmatch,-ERROR-) }
  1796. if ($1 == 13) || ($1 == pink) { return $iif($+(<c style="color:#FF00FF">,$2-,</c>),$ifmatch,-ERROR-) }
  1797. if ($1 == 14) || ($1 == grey) || ($1 == gray) { return $iif($+(<c style="color:#A9A9A9">,$2-,</c>),$ifmatch,-ERROR-) }
  1798. if ($1 == 15) || ($1 == silver) { return $iif($+(<c style="color:#C0C0C0">,$2-,</c>),$ifmatch,-ERROR-) }
  1799. if ($1 == logo) { var %logo = $strip($remove($logo,$chr(91),$chr(93))) | return $iif($+($+(<l style="color:#A9A9A9">,$chr(91),</l>),$+(<l style="color:#80BFFF">,%logo,</l>),$+(<l style="color:#A9A9A9">,$chr(93),</l>)),$ifmatch,-ERROR-) }
  1800. if ($1 == split) { return $iif($+(<l style="color:#80BFFF">,&raquo;,</l>),$ifmatch,-ERROR-) }
  1801. return $1-
  1802. }
  1803. if (%prop == logo) { var %logo = $strip($remove($logo,$chr(91),$chr(93))) | return $+($+(<l style="color:#A9A9A9">,$chr(91),</l>),$+(<l style="color:#80BFFF">,%logo,</l>),$+(<l style="color:#A9A9A9">,$chr(93),</l>)) }
  1804. if (%prop == split) { return return $+(<l style="color:#80BFFF">,&raquo;,</l>) }
  1805. if (%prop == weapon) && ($2) { return <img src="images/ $+ $lower($1) $+ .gif" width="63" height="20" style="float:left;" /> $+($chr(40),$lower($1),$chr(41),:) $2 }
  1806. return $1-
  1807. }
  1808. return
  1809. }
  1810. alias upstats {
  1811. if ($gatherinfo(ftp)) {
  1812. var %ftp = $ifmatch, %host = $gettok(%ftp,1,32), %user = $gettok(%ftp,2,32), %pass = $gettok(%ftp,3,32), %dir = $gettok(%ftp,4,32), %url = $gettok(%ftp,5,32), %dir = $+(",$iif($left(%dir,1) != /,/),%dir,$iif($right(%dir,1) != /,/),stats/")
  1813. if (%upload.stats) || (!%url) || (($isfile(upstats.bat)) && ($isfile(upstats.txt))) || (!$isfile($gfile(upstats.html))) { return $false }
  1814. set -z %upload.stats 2 | .timerupstats 1 30 upstats_clean
  1815. var %gstats = $1, %steamid = $1, %auth = $gauth(%steamid), %nick = $gnick(%steamid), %clean = $+(%auth,.html), %file = $+(%clean), %put = %file, %s = $html(split).color, %logo = $html(logo).color | .copy -o $+(",$gfile(upstats.html),") $+(",%file,")
  1816. write %file $html(%logo $html(Stats on: $html(%nick).bold).strong %s $html(Auth: $html(%auth).bold).strong %s $html(Steamid: $html(%steamid).bold).strong %logo).p | write %file &nbsp;
  1817. write %file $html(%logo $html(Rank:).bold $gatherstats(%gstats,Rank) $+ / $+ $lines($gfile(gatherusers.dat)) %s $html(Points:).bold $round($iif($gatherstats(%gstats,Points),$ifmatch,1000),2) %s $html(Man of the Match:).bold $gatherstats(%gstats,motm) %s $html(Best K/D's:).bold $gatherstats(%gstats,bestkds) %s $html(Newb of the Match:).bold $gatherstats(%gstats,notm) %logo).p
  1818. write %file $html(%logo $html(Games:).bold $gatherstats(%gstats,Played) %s $html(Started:).bold $gatherstats(%gstats,Started) %s $html(Substitute:).bold $gatherstats(%gstats,Subs) %s $html(Won:).bold $gatherstats(%gstats,Wins) %s $html(Draw:).bold $gatherstats(%gstats,Draw) %s $html(Lost:).bold $gatherstats(%gstats,Loss) %s $html(Bans:).bold $gatherstats(%gstats,Bans) %s $html(Leavebans:).bold $gatherstats(%gstats,Leavebans) %logo).p
  1819. write %file $html(%logo $html(Entrykills:).bold $gatherstats(%gstats,Entrykills) %s $html(Kills:).bold $gatherstats(%gstats,Kills) %s $html(Deaths:).bold $gatherstats(%gstats,Deaths) %s $html(Plants:).bold $gatherstats(%gstats,Plants) %s $html(Defuses:).bold $gatherstats(%gstats,Defs) %s $html(K/D:).bold $round($calc($gatherstats(%gstats,Kills) / $gatherstats(%gstats,Deaths)),2) %s $html(Assists:).bold $gatherstats(%gstats,Assists) %s $html(Aces:).bold $gatherstats(%gstats,Aces) %logo).p
  1820. var %lastgame = $gatherstats(%steamid,lastgame), %n = $numtok(%lastgame,44), %id = $gettok(%lastgame,%n,44)
  1821. if (%id) {
  1822. if ($readini($gfile(gatherids.ini),%id,%steamid)) {
  1823. var %stats = $ifmatch, %k = $gettok($gettok(%stats,1,32),2,58), %d = $gettok($gettok(%stats,2,32),2,58), %a = $gettok($gettok(%stats,3,32),2,58), %p = $round($gettok($gettok(%stats,4,32),2,58),2), %kd = $round($calc(%k / $iif(%d,$ifmatch,1)),2)
  1824. set -u60 %gatherid. [ $+ [ $+(%id,.,%steamid) ] ] 1 | var %ct = $readini($gfile(gatherids.ini),%id,CT), %t = $readini($gfile(gatherids.ini),%id,TERRORIST), %teamwon = $readini($gfile(gatherids.ini),%id,TeamWon), %winloss = $iif(%teamwon == Draw,$html(08,Draw).c,$html(04,Lost).c)
  1825. if ($istok(%ct,%auth,32)) { var %team = CT } | if ($istok(%t,%auth,32)) { var %team = TERRORIST } | if ($readini($gfile(gatherids.ini),%id,TeamWon) == %team) { var %winloss = $html(09,Won).c }
  1826. if ($readini($gfile(gatherids.ini),%id,bestkd) == %steamid) { var %bestkd = 1 } | if ($readini($gfile(gatherids.ini),%id,MotM) == %steamid) { var %motm = 1 } | elseif ($readini($gfile(gatherids.ini),%id,NotM) == %steamid) { var %notm = 1 }
  1827. var %1on1 = $gettok($gettok(%stats,5,32),2,58), %1on2 = $gettok($gettok(%stats,6,32),2,58), %1on3 = $gettok($gettok(%stats,7,32),2,58), %1on4 = $gettok($gettok(%stats,8,32),2,58), %1on5 = $gettok($gettok(%stats,9,32),2,58), %x1 = $gettok(%1on1,2,47), %x2 = $gettok(%1on2,2,47), %x3 = $gettok(%1on3,2,47), %x4 = $gettok(%1on4,2,47), %x5 = $gettok(%1on5,2,47)
  1828. write %file $+(<p>,%logo $html(Lastgame:).bold $+($chr(35),%id) %s $gettok($readini($gfile(gatherids.ini),%id,Ended),1,32) %s $html(Type:).bold $readini($gfile(gatherids.ini),%id,Type) %s $html(Points:).bold $iif(%p >= 0,$html(09,$+(+,%p)).c,$html(04,%p).c) %s $html(K/D:).bold %kd $+($html(14,$chr(91)).c,%k,/,%d,$html(14,$chr(93)).c))
  1829. write %file $+($iif(%x1,%s $html(1on1:).bold %1on1) $iif(%x2,%s $html(1on2:).bold %1on2) $iif(%x3,%s $html(1on3:).bold %1on3) $iif(%x4,%s $html(1on4:).bold %1on4) $iif(%x5,%s $html(1on5:).bold %1on5) %s $html(Status:).bold %winloss $iif(%motm,%s $html(07,Man of the Match).c,$iif(%notm,%s $html(04,Newb of the Match).c)) $iif(%bestkd,%s $html(07,Best K/D).c) %logo,<p>)
  1830. }
  1831. else { write %file $html(%logo $html(Lastgame:).bold $+($chr(35),%id) %s $gettok($readini($gfile(gatherids.ini),%id,Ended),1,32) %s $html(Type:).bold $readini($gfile(gatherids.ini),%id,Type) %s $html(Points:).bold $html(04,-39).c %s $html(Status:).bold $html(04,Leaver).c %logo).p }
  1832. }
  1833. if ($gatherstats(%gstats,Lastpoints)) {
  1834. var %pp = $remove($strip($ifmatch),+), %ii = 1, %aa = 1, %ppoints, %bb | while (%ii <= $numtok(%pp,32)) {
  1835. var %xx = $round($gettok(%pp,%ii,32),1), %nn = $iif(%xx < 0,$html(04,%xx).c,$html(09,$+(+,%xx)).c), %ppoints = %ppoints %nn | inc %ii
  1836. if (%aa > $iif(%bb,20,18)) {
  1837. if (!%bb) { if (%ii <= $numtok(%pp,32)) { write %file $+(<p>,%logo) $html(Skill history:).bold %ppoints | var %bb = 1, %ppoints } | else { write %file $html(%logo $html(Skill history:).bold %ppoints %logo).p | var %bb = 1, %ppoints } }
  1838. else { if (%ii <= $numtok(%pp,32)) { write %file %ppoints | var %ppoints } | else { write %file %ppoints $+(%logo,<p>) | var %ppoints } }
  1839. }
  1840. inc %aa
  1841. }
  1842. if (%ppoints) { if (!%bb) { write %file $html(%logo $html(Skill history:).bold %ppoints %logo).p } | else { write %file %ppoints $+(%logo,<p>) } }
  1843. }
  1844. else { write %file $html(%logo $html(Skill history:).bold $html(04,Inactive).c %logo).p }
  1845. write %file &nbsp; | var %1on1 = $clutchstats(%gstats,1on1), %fon1 = $clutchstats(%gstats,fail_1on1), %1on2 = $clutchstats(%gstats,1on2), %fon2 = $clutchstats(%gstats,fail_1on2), %1on3 = $clutchstats(%gstats,1on3), %fon3 = $clutchstats(%gstats,fail_1on3), %1on4 = $clutchstats(%gstats,1on4), %fon4 = $clutchstats(%gstats,fail_1on4), %1on5 = $clutchstats(%gstats,1on5), %fon5 = $clutchstats(%gstats,fail_1on5)
  1846. write %file $html(%logo $html(1on1:).bold %1on1 out of $calc(%1on1 + %fon1) $html(14,$chr(91)).c $+ $html(07,$round($calc(100 / (%1on1 + %fon1) * %1on1),2)).c $+ $html(14,$+($chr(37),$chr(93))).c).p
  1847. write %file $html(%logo $html(1on2:).bold %1on2 out of $calc(%1on2 + %fon2) $html(14,$chr(91)).c $+ $html(07,$round($calc(100 / (%1on2 + %fon2) * %1on2),2)).c $+ $html(14,$+($chr(37),$chr(93))).c).p
  1848. write %file $html(%logo $html(1on3:).bold %1on3 out of $calc(%1on3 + %fon3) $html(14,$chr(91)).c $+ $html(07,$round($calc(100 / (%1on3 + %fon3) * %1on3),2)).c $+ $html(14,$+($chr(37),$chr(93))).c).p
  1849. write %file $html(%logo $html(1on4:).bold %1on4 out of $calc(%1on4 + %fon4) $html(14,$chr(91)).c $+ $html(07,$round($calc(100 / (%1on4 + %fon4) * %1on4),2)).c $+ $html(14,$+($chr(37),$chr(93))).c).p
  1850. write %file $html(%logo $html(1on5:).bold %1on5 out of $calc(%1on5 + %fon5) $html(14,$chr(91)).c $+ $html(07,$round($calc(100 / (%1on5 + %fon5) * %1on5),2)).c $+ $html(14,$+($chr(37),$chr(93))).c).p
  1851. var %x = 1 | window -eh1 @wepstats | while (%x <= $ini($gfile(wepstats.ini),%gstats,0)) { var %wep = $ini($gfile(wepstats.ini),%gstats,%x) | aline @wepstats %wep $ex_nr($readini($gfile(wepstats.ini),%gstats,%wep)) | inc %x }
  1852. filter -twce 2 32 @wepstats @wepstats | var %x = 1, %crlf | while (%x <= $line(@wepstats,0)) { var %wep = $upleft($gettok($line(@wepstats,%x),1,32)), %stat = $round($gettok($line(@wepstats,%x),2,32),0) | inc %x
  1853. if (!%crlf) { write %file &nbsp; | var %crlf = 1 } | write %file $html($html(%wep,%stat).weapon).p
  1854. }
  1855. window -c @wepstats | write %file &nbsp; | write %file $html(%logo End of stats file %s $html(Uploaded: $html($date $time).bold).strong %logo).p
  1856. write %file <!-- end #stats --></div>
  1857. write %file <!-- end #mainContent --></div>
  1858. write %file &nbsp;
  1859. write %file <div id="footer">
  1860. write %file <p>Copyright &copy; Fragportal - <a href="http://www.fragportal.dk" style="color:#000; text-decoration:none;">www.fragportal.dk</a> - Created by W33D -aka- cokE</p>
  1861. write %file <!-- end #footer --></div>
  1862. write %file <!-- end #container --></div>
  1863. write %file &nbsp;
  1864. write %file </body>
  1865. write %file </html>
  1866. write -c upstats.txt open %host | write upstats.txt %user | write upstats.txt %pass | write upstats.txt bin
  1867. write upstats.txt cd %dir | write upstats.txt dele %put | write upstats.txt put %put | write upstats.txt quit
  1868. write -c upstats.bat @echo off | write upstats.bat ftp -i -s:"upstats.txt" | write upstats.bat del %put
  1869. write upstats.bat del upstats.txt | write upstats.bat del upstats.bat | .timer 1 0 run -hp upstats.bat
  1870. return $+(%url,$iif($right(%url,1) != /,/),stats/,%clean)
  1871. }
  1872. return $false
  1873. }
  1874. alias upstats_clean {
  1875. if ($isfile(upstats.bat)) { .timer 1 0 .remove upstats.bat }
  1876. if ($isfile(upstats.txt)) { .timer 1 0 .remove upstats.txt }
  1877. }
  1878. alias upbans {
  1879. if ($gatherinfo(ftp)) {
  1880. var %ftp = $ifmatch, %host = $gettok(%ftp,1,32), %user = $gettok(%ftp,2,32), %pass = $gettok(%ftp,3,32), %dir = $gettok(%ftp,4,32), %url = $gettok(%ftp,5,32), %dir = $+(",$iif($left(%dir,1) != /,/),%dir,$iif($right(%dir,1) != /,/),")
  1881. if (%upload.bans) || (!%url) || (($isfile(upload.txt)) && ($isfile(upload.bat))) { return $false }
  1882. if ($isfile(bans.txt)) { write -c bans.txt }
  1883. set -z %upload.bans 5
  1884. var %i = 1, %put = $+(",bans.txt,") | while (%i <= $ini($gfile(gatherbans.ini),0)) {
  1885. write bans.txt Ban $+($chr(35),%i,:)
  1886. var %id = $ini($gfile(gatherbans.ini),%i), %admin = $readini($gfile(gatherbans.ini),%id,admin), %tid = $readini($gfile(gatherbans.ini),%id,tid), %grund = $readini($gfile(gatherbans.ini),%id,grund), %type = $readini($gfile(gatherbans.ini),%id,type), %nick = $gnick(%id), %auth = $gauth(%id)
  1887. if (%auth) {
  1888. if (%tid != Permanent) { var %bantime = $duration($calc(%tid - $ctime)) } | else { var %bantime = %tid }
  1889. if ($gettok(%grund,1-7,32) == Was not ingame while checking for leavers) && ($numtok(%grund,32) > 8) { var %ga = $gettok(%grund,9,32), %ga = $left(%ga,-1), %grund = $gettok(%grund,1-7,32) [Admin: $strip($anick(%ga)) $+ $chr(93) }
  1890. if ($gettok(%grund,1-8,32) == You have been kicked ingame by an admin) && ($numtok(%grund,32) > 9) { var %ga = $gettok(%grund,10,32), %ga = $left(%ga,-1), %grund = $gettok(%grund,1-8,32) [Admin: $strip($anick(%ga)) $+ $chr(93) }
  1891. if ($gettok(%grund,1-8,32) == Was not ingame before the time limit expired) && ($numtok(%grund,32) > 9) { var %ga = $gettok(%grund,10,32), %ga = $left(%ga,-1), %grund = $gettok(%grund,1-8,32) [Admin: $strip($anick(%ga)) $+ $chr(93) }
  1892. write bans.txt Nick: %nick - Auth: %auth - Steamid: %id
  1893. }
  1894. else { write bans.txt $iif(*.* iswm %id,IP:,Steamid:) %id }
  1895. write bans.txt Banned by $strip($anick(%admin)) - Type: %type - Expire: %bantime - Reason: %grund | write bans.txt $crlf | inc %i
  1896. }
  1897. write bans.txt End of banlist, $calc(%i -1) bans - Updated: $date $time
  1898. write -c upload.txt open %host | write upload.txt %user | write upload.txt %pass | write upload.txt bin
  1899. write upload.txt cd %dir | write upload.txt dele %put | write upload.txt put %put | write upload.txt quit
  1900. write -c upload.bat @echo off | write upload.bat ftp -i -s:"upload.txt" | write upload.bat del bans.txt
  1901. write upload.bat del upload.txt | write upload.bat del upload.bat | .timer 1 0 run upload.bat
  1902. return $+(%url,$iif($right(%url,1) != /,/),bans.txt)
  1903. }
  1904. return $false
  1905. }
  1906. alias upcslog {
  1907. if ($gatherinfo(ftp)) {
  1908. var %ftp = $ifmatch, %host = $gettok(%ftp,1,32), %user = $gettok(%ftp,2,32), %pass = $gettok(%ftp,3,32), %dir = $gettok(%ftp,4,32), %url = $gettok(%ftp,5,32)
  1909. if (!%upload) || (($isfile(upload.txt)) && ($isfile(upload.bat))) { var %gid = $remove($1,gatherid,.log), %logput = $+("gatherlogs\gatherid,%gid,.log"), %logdir = $+(",$iif($left(%dir,1) != /,/),%dir,$iif($right(%dir,1) != /,/),gatherlogs/")
  1910. if ($isfile(%logput)) { set -u60 %upload 1
  1911. write -c upload.txt open %host | write upload.txt %user | write upload.txt %pass | write upload.txt bin | write upload.txt cd %logdir
  1912. write upload.txt put %logput | write upload.txt quit | write -c upload.bat @echo off | write upload.bat ftp -i -s:"upload.txt"
  1913. write upload.bat del upload.txt | write upload.bat del upload.bat | .timer 1 0 run upload.bat
  1914. }
  1915. else { echo -s $date ][ $time $logo %logput doesnt exist $logo }
  1916. }
  1917. else { .timer 1 10 upcslog $1- }
  1918. }
  1919. }
  1920. alias logchan {
  1921. ;;SPECIAL;;
  1922. if (#signfrag.* iswm $mainchan) { return }
  1923. if ($readini($gfile(gatherinfo.ini),log,date) != $date) {
  1924. var %date = $iif($readini($gfile(gatherinfo.ini),log,date),$ifmatch,$date)
  1925. if (!$isdir(chanlogs)) { .mkdir chanlogs } | writeini -n $gfile(gatherinfo.ini) log date $date
  1926. if ($isfile(chanlog.txt)) { write chanlog.txt Session Close: $date $time
  1927. var %file = $+($mircdirchanlogs\,chanlog_,$replace(%date,$chr(47),$chr(45))), %mput = $+(",%file,.log"), %i = 2 | while ($isfile(%mput)) { var %mput = $+(",%file,_,%i,.log") | inc %i }
  1928. .rename chanlog.txt %mput
  1929. if ($gatherinfo(ftp)) {
  1930. var %ftp = $ifmatch, %host = $gettok(%ftp,1,32), %user = $gettok(%ftp,2,32), %pass = $gettok(%ftp,3,32), %dir = $gettok(%ftp,4,32), %url = $gettok(%ftp,5,32)
  1931. var %dir = $+(",$iif($left(%dir,1) != /,/),%dir,$iif($right(%dir,1) != /,/),chanlogs/"), %numtok = $numtok(%mput,92)
  1932. if ($isfile(uploadlog.txt)) { .remove uploadlog.txt } | if ($isfile(uploadlog.bat)) { .remove uploadlog.bat }
  1933. write uploadlog.txt open %host | write uploadlog.txt %user | write uploadlog.txt %pass | write uploadlog.txt bin | write uploadlog.txt cd %dir
  1934. write uploadlog.txt put %mput | write uploadlog.txt quit | write uploadlog.bat @echo off | write uploadlog.bat ftp -i -s:"uploadlog.txt"
  1935. write uploadlog.bat del uploadlog.txt | write uploadlog.bat del uploadlog.bat | .timer 1 0 run uploadlog.bat
  1936. whatcmd $meorsay $iif($me ison $privchan,$privchan,$ownerchan) $logo Channel log from yesterday $col(14,$chr(40)) $+ %date $+ $col(14,$chr(41)) being uploaded now $split $+(,%url,$iif($right(%url,1) != /,/),chanlogs/,$gettok(%mput,%numtok,92),) $logo
  1937. }
  1938. }
  1939. }
  1940. if ($1) { if (!$isfile(chanlog.txt)) { write chanlog.txt Session Start: $date $time } | write chanlog.txt $time » $1- }
  1941. }
  1942. alias gofopen {
  1943. var %file = $1, %window = $2, %stats = $3, %req = $iif($4,$iif($4 isnum,$4,3),0)
  1944. if (!$isfile(%file)) { return $false } | if ($fopen(%window)) { .fclose %window } | .fopen %window %file
  1945. if ($fopen(%window).err) { return $false } | if (!$window(%window)) { window -eh1 %window } | else { clear %window }
  1946. .fseek -w %window *STEAM_*:*:* | while ($fread(%window)) {
  1947. var %info = $ifmatch, %id = $remove(%info,$chr(91),$chr(93))
  1948. if ((!%req) || ((%req) && ($readini(%file,%id,Played) >= %req))) && ($readini(%file,%id,%stats)) { aline %window %id $ex_nr($ifmatch) }
  1949. .fseek -w %window *STEAM_*:*:*
  1950. }
  1951. .fclose %window | return $true
  1952. }
  1953. alias gofopen2 {
  1954. var %file = $1, %window = $2, %stats = $3, %file2 = $gfile(gatherstats.ini), %stats2 = Played
  1955. if (!$isfile(%file)) { return $false } | if ($fopen(%window)) { .fclose %window } | .fopen %window %file
  1956. if ($fopen(%window).err) { return $false } | if (!$window(%window)) { window -eh1 %window } | else { clear %window }
  1957. .fseek -w %window *STEAM_*:*:* | while ($fread(%window)) {
  1958. var %info = $ifmatch, %id = $remove(%info,$chr(91),$chr(93))
  1959. if ($readini(%file,%id,%stats)) && ($readini(%file2,%id,%stats2)) { var %s1 = $readini(%file,%id,%stats), %s2 = $readini(%file2,%id,%stats2), %s = $calc(%s1 / %s2) | aline %window %id $ex_nr(%s1) %s }
  1960. .fseek -w %window *STEAM_*:*:*
  1961. }
  1962. .fclose %window | return $true
  1963. }
  1964. alias gofopen3 {
  1965. var %file = $1, %window = $2, %stats = $3, %stats2 = $4
  1966. if (!$isfile(%file)) { return $false } | if ($fopen(%window)) { .fclose %window } | .fopen %window %file
  1967. if ($fopen(%window).err) { return $false } | if (!$window(%window)) { window -eh1 %window } | else { clear %window }
  1968. .fseek -w %window *STEAM_*:*:* | while ($fread(%window)) {
  1969. var %info = $ifmatch, %id = $remove(%info,$chr(91),$chr(93))
  1970. if ($readini(%file,%id,%stats)) || ($readini(%file,%id,%stats2)) { var %s1 = $readini(%file,%id,%stats), %s2 = $readini(%file,%id,%stats2), %s = $calc(100 / (%s1 + %s2) * %s1) | aline %window %id $ex_nr(%s1) %s }
  1971. .fseek -w %window *STEAM_*:*:*
  1972. }
  1973. .fclose %window | return $true
  1974. }
  1975. alias gofopen4 {
  1976. var %file = $1, %window = $2, %stats = $3, %file2 = $gfile(gatherstats.ini), %stats2 = Played
  1977. if (!$isfile(%file)) { return $false } | if ($fopen(%window)) { .fclose %window } | .fopen %window %file
  1978. if ($fopen(%window).err) { return $false } | if (!$window(%window)) { window -eh1 %window } | else { clear %window }
  1979. .fseek -w %window *STEAM_*:*:* | while ($fread(%window)) {
  1980. var %info = $ifmatch, %id = $remove(%info,$chr(91),$chr(93))
  1981. if ($readini(%file,%id,%stats)) && ($readini(%file2,%id,%stats2) >= 3) { var %s1 = $readini(%file,%id,%stats), %s2 = $readini(%file2,%id,%stats2), %s = $calc(%s1 / %s2) | aline %window %id $ex_nr(%s) %s1 }
  1982. .fseek -w %window *STEAM_*:*:*
  1983. }
  1984. .fclose %window | return $true
  1985. }
  1986. alias resetstats { var %ctime = $ctime, %time
  1987. if ($1) && ($1 != chan) { var %xPoints = $readini($gfile(gatherstats.ini),$1,Points), %Lastgame = $readini($gfile(gatherstats.ini),$1,Lastgame)
  1988. remini -n $gfile(wepstats.ini) $1 | remini -n $gfile(hitstats.ini) $1 | remini -n $gfile(clutchstats.ini) $1 | remini -n $gfile(gatherstats.ini) $1
  1989. if (%xPoints) { writeini -n $gfile(gatherstats.ini) $1 xPoints %xPoints }
  1990. if (%Lastgame) { writeini -n $gfile(gatherstats.ini) $1 Lastgame %Lastgame }
  1991. var %time = $calc($ctime - %ctime) | return $iif(%time > 0,%time,1)
  1992. }
  1993. else {
  1994. if ($isfile($gfile(wepstats.ini))) { .remove -b $gfile(wepstats.ini) }
  1995. if ($isfile($gfile(hitstats.ini))) { .remove -b $gfile(hitstats.ini) }
  1996. if ($isfile($gfile(clutchstats.ini))) { .remove -b $gfile(clutchstats.ini) }
  1997. if ($isfile($gfile(gatherstats.ini))) {
  1998. var %file = $gfile(gatherstats.ini), %i = 1, %oldfile = statsfile.ini | while ($isfile(%oldfile)) { var %oldfile = $+(statsfile_,%i,.ini) | inc %i } | .rename %file %oldfile
  1999. var %i = 1, %x = chan | while ($ini(%oldfile,%x,%i)) { var %t = $lower($ifmatch), %s = $readini(%oldfile,%x,%t) | if (%s) { writeini -n %file %x %t %s } | inc %i }
  2000. var %i = 1 | while ($ini(%oldfile,%i)) { var %x = $ifmatch
  2001. if (STEAM_*:*:* iswm %x) {
  2002. if ($readini(%oldfile,%x,Points)) { writeini -n %file %x xPoints $ifmatch }
  2003. if ($readini(%oldfile,%x,Lastgame)) { writeini -n %file %x Lastgame $ifmatch }
  2004. }
  2005. inc %i
  2006. }
  2007. }
  2008. if ($isfile(%oldfile)) { .remove -b %oldfile }
  2009. var %time = $calc($ctime - %ctime) | return $iif(%time > 0,%time,1)
  2010. }
  2011. return $false
  2012. }
  2013.  
  2014. ;#################################### Aliases rank/toplist ##########################################;
  2015.  
  2016. alias updaterank {
  2017. if ($timer(upuser)) { .timerupuser off }
  2018. if ($window(@toplist)) { .window -c @toplist }
  2019. if ($gofopen($gfile(gatherstats.ini),@toplist,Points,1)) { filter -twce 2 32 @toplist @toplist | set %up.id 1 | set %up.start $ctime | .timerupuser 1 1 updateuser }
  2020. }
  2021. alias updateuser {
  2022. if (%up.id) && (%up.id <= $line(@toplist,0)) {
  2023. var %s = $gettok($line(@toplist,%up.id),1,32) | writeini -n $gfile(gatherstats.ini) %s Rank %up.id | inc %up.id | .timerupuser -m 1 100 updateuser
  2024. }
  2025. elseif (%up.id) { unset %up.* | window -c @toplist }
  2026. }
  2027. alias splitnum { if (!$calc($1 % 2)) { return $calc($1 /2) } | var %x = $calc($1 -1) | return $calc(%x /2 +1) }
  2028. alias toplist {
  2029. if ($gofopen($gfile(gatherstats.ini),@top5,Points,1)) {
  2030. filter -twce 2 32 @top5 @top5 | var %i = 1, %x = 10, %st = $null, %a = $iif($line(@top5,0) > 10,%x,$line(@top5,0)), %split = $splitnum(%a) | while (%i <= $line(@top5,0)) && (%i <= %x) {
  2031. var %line = $line(@top5,%i), %s = $gettok(%line,1,32), %p = $round($gettok(%line,2,32),2)
  2032. if (%i <= %split) || (%a <= 7) { var %st = $iif(%st,$ifmatch $split,) %i $+ . $anick($gauth(%s)) $col(14,$chr(40)) $+ %p $+ $col(14,$chr(41)) } | else { var %st2 = $iif(%st2,$ifmatch $split,) %i $+ . $anick($gauth(%s)) $col(14,$chr(40)) $+ %p $+ $col(14,$chr(41)) } | inc %i
  2033. }
  2034. if (%st) && (%st2) { set -u300 %tmp.top 1 | statsbot $1 $logo Top 1- $+ %split $+  $logo %st $logo | statsbot $1 $logo Top $calc(%split +1) $+ - $+ $calc(%i -1) $+  $logo %st2 $logo }
  2035. elseif (%st) { set -u300 %tmp.top 1 | statsbot $1 $logo Top $calc(%i -1) $+  $logo %st $logo } | else { statsbot $1 $logo There is not enough stats for a toplist yet $logo }
  2036. }
  2037. window -c @top5
  2038. }
  2039. alias botlist {
  2040. if ($gofopen($gfile(gatherstats.ini),@bot5,Points,1)) {
  2041. filter -twce 2 32 @bot5 @bot5 | var %i = $line(@bot5,0), %x = 10, %st = $null, %b = 1, %m = $calc(%i -10), %i = $iif(%m >= 1,%m,1), %a = $iif($line(@bot5,0) > 10,%x,$line(@bot5,0)), %split = $splitnum(%a)
  2042. while (%i <= $line(@bot5,0)) && (%b <= %x) { var %line = $line(@bot5,%i), %s = $gettok(%line,1,32), %p = $round($gettok(%line,2,32),2)
  2043. if (%b <= %split) || (%a <= 7) { var %st = $iif(%st,$ifmatch $split,) %i $+ . $anick($gauth(%s)) $col(14,$chr(40)) $+ %p $+ $col(14,$chr(41)) }
  2044. else { var %st2 = $iif(%st2,$ifmatch $split,) %i $+ . $anick($gauth(%s)) $col(14,$chr(40)) $+ %p $+ $col(14,$chr(41)) } | inc %i | inc %b
  2045. }
  2046. if (%st) && (%st2) { set -u300 %tmp.bot 1 | statsbot $1 $logo Botlist $logo %st $logo | statsbot $1 $logo Botlist $logo %st2 $logo }
  2047. elseif (%st) { set -u300 %tmp.bot 1 | statsbot $1 $logo Bot $calc(%b -1) $+  $logo %st $logo } | else { statsbot $1 $logo There is not enough stats for a botlist yet $logo }
  2048. }
  2049. window -c @bot5
  2050. }
  2051.  
  2052. ;#################################### Aliases for rcon start/send/etc and diverse ##########################################;
  2053.  
  2054. alias getname {
  2055. if ($1 isnum) { var %n = $1, %t = $2- } | else { var %n = 1, %t = $1- } | var %i = 1, %x = $gettok(%t,%n,34) | while (%i <= $numtok(%x,60)) {
  2056. var %n = $gettok(%x,%i,60) | if (*STEAM_*:*:* iswm %n) { var %gettok = 1- $+ $calc(%i -2) | return $gettok(%x,%gettok,60) } | inc %i
  2057. }
  2058. return 0
  2059. }
  2060. alias getteam {
  2061. if ($1 isnum) { var %n = $1, %t = $2- } | else { var %n = 1, %t = $1- } | var %i = 1, %x = $gettok(%t,%n,34) | while (%i <= $numtok(%x,60)) {
  2062. var %n = $gettok(%x,%i,60) | if (*STEAM_*:*:* iswm %n) { var %gettok = $calc(%i +1) | return $left($gettok(%x,%gettok,60),-1) } | inc %i
  2063. }
  2064. return 0
  2065. }
  2066. alias getsteamid {
  2067. if ($1 isnum) { var %n = $1, %t = $2- } | else { var %n = 1, %t = $1- } | var %i = 1, %x = $gettok(%t,%n,34) | while (%i <= $numtok(%x,60)) {
  2068. var %n = $left($gettok(%x,%i,60),-1) | if (*STEAM_*:*:* iswm %n) { return %n } | inc %i
  2069. }
  2070. return 0
  2071. }
  2072. alias getuserid {
  2073. if ($1 isnum) { var %n = $1, %t = $2- } | else { var %n = 1, %t = $1- } | var %i = 1, %x = $gettok(%t,%n,34) | while (%i <= $numtok(%x,60)) {
  2074. var %n = $gettok(%x,%i,60) | if (*STEAM_*:*:* iswm %n) { var %gettok = $calc(%i -1) | return $left($gettok(%x,%gettok,60),-1) } | inc %i
  2075. }
  2076. return 0
  2077. }
  2078. alias assini { return $gfile($+(assists,$replace($1,$chr(58),$chr(45)),.ini)) }
  2079. alias killsini { return $gfile($+(kills,$replace($1,$chr(58),$chr(45)),.ini)) }
  2080. alias gamestatsini { return $gfile($+(gamestats,$replace($1,$chr(58),$chr(45)),.ini)) }
  2081.  
  2082. alias recordname {
  2083. var %ip = $1, %id = $2, %game = $calc($gatherstats(%id,played) +1), %name = $remove($gettok($mainchan,1,46),$chr(35))
  2084. if ($readini($gfile(record.ini),%ip,%id)) { var %demo = $ifmatch, %demo = $calc(%demo +1) | writeini -n $gfile(record.ini) %ip %id %demo | return $+(%name,_,%game,_,%demo) }
  2085. writeini -n $gfile(record.ini) %ip %id 1 | return $+(%name,_,%game)
  2086. }
  2087. alias overtime_rounds {
  2088. if ($gatherinfo(overtime)) { return $iif($ifmatch isnum,$ifmatch,3) }
  2089. ;;SPECIAL;;
  2090. if (#signfrag.* iswm $mainchan) { return 5 }
  2091. return 3
  2092. }
  2093. alias mr3 { var %s = $1, %r = $calc($overtime_rounds *2), %n = $calc(30 + %r) | while (%s > %n) { inc %n %r } | return %n }
  2094. alias mr3.half { var %s = $1, %r = $overtime_rounds, %n = $calc(30 + %r) | while (%s > %n) { inc %n %r } | return %n }
  2095. alias sameteam_OLD {
  2096. var %score = $1, %s = 1, %x = 32
  2097. if (%score < 15) { return $true }
  2098. if (%score < 30) { return $false }
  2099. while (%x < %score) { inc %x 3 | var %s = $iif(%s,0,1) }
  2100. return $iif(%s,$true,$false)
  2101. }
  2102. alias sameteam {
  2103. var %score = $1, %s = 0, %r = $overtime_rounds, %x = $calc(30 + %r -1), %c = $calc(30 + %r)
  2104. if (%score < 15) { return $true }
  2105. if (%score < 30) { return $false }
  2106. while (%x < %score) {
  2107. if ($calc(%x +1) == %c) { var %s = $iif(%s,0,1), %c = $calc(%c + %r + %r) }
  2108. inc %x %r
  2109. }
  2110. return $iif(%s,$true,$false)
  2111. }
  2112. alias swapteams {
  2113. if ($gatherinfo(game) == CS:GO) {
  2114. var %ipp = $1, %gfile = $gfile(joined.ini), %i = 1 | while ($ini(%gfile,%ipp,%i)) {
  2115. var %x = $ifmatch, %t = $readini(%gfile,%ipp,%x)
  2116. if (%t == CT) { writeini -n %gfile %ipp %x TERRORIST } | elseif (%t == TERRORIST) { writeini -n %gfile %ipp %x CT }
  2117. inc %i
  2118. }
  2119. .timer 1 5 start_only %ipp | return
  2120.  
  2121. rconsend %ipp mp_swapteams
  2122. if ($ini(%gfile,%ipp,0) == $ini($gfile(players.ini),%ipp,0)) && (!$serverstatus(%ipp,sub)) { .timer 1 2 start %ipp } | else { .timer 1 2 pregame %ipp }
  2123. }
  2124. else {
  2125. .timer 1 1 pregame $1
  2126. }
  2127. }
  2128. alias swapteams2 {
  2129. if ($gatherinfo(game) == CS:GO) {
  2130. var %ipp = $1, %gfile_ct = $gfile(counter.ini), %gfile_t = $gfile(terrorist.ini), %new_ct, %new_t
  2131. var %i = 1 | while ($ini(%gfile_ct,%ipp,%i)) { var %x = $ifmatch, %new_t = %new_t %x | inc %i }
  2132. var %i = 1 | while ($ini(%gfile_t,%ipp,%i)) { var %x = $ifmatch, %new_ct = %new_ct %x | inc %i }
  2133. remini -n %gfile_ct %ipp | remini -n %gfile_t %ipp
  2134. var %i = 1 | while ($gettok(%new_ct,%i,32)) { var %x = $ifmatch | writeini -n %gfile_ct %ipp %x %x | inc %i }
  2135. var %i = 1 | while ($gettok(%new_t,%i,32)) { var %x = $ifmatch | writeini -n %gfile_t %ipp %x %x | inc %i }
  2136. rconsend %ipp mp_swapteams | rconsend %ipp say Teams has been swapped
  2137. }
  2138. }
  2139. alias team_ct_won {
  2140. var %ipp = $1, %idd = $serverid(%ipp), %gamestats = $gamestatsini(%ipp)
  2141. .timerbombdefused. [ $+ [ %ipp ] ] off | set -u5 %roundend. [ $+ [ %ipp ] ] 1 | set -u5 %teamwon. [ $+ [ %ipp ] ] CT
  2142. var %score = $score(%ipp,total), %score.ct = $score(%ipp,ct), %score.t = $score(%ipp,t)
  2143. if ($2 isnum) && ($3 isnum) {
  2144. var %newscore.ct = $calc($2 - 1), %newscore.t = $3
  2145. writeini -n $gfile(score.ini) %ipp antiterrorist %newscore.ct
  2146. writeini -n $gfile(score.ini) %ipp terrorist %newscore.t
  2147. }
  2148. score %ipp inc ct | checkace %ipp | var %score = $score(%ipp,total), %score.ct = $score(%ipp,ct), %score.t = $score(%ipp,t)
  2149. logit %ipp Team CT won the round. CT: %score.ct - T: %score.t
  2150. logit2 %ipp Team CT won the round. CT: %score.ct - T: %score.t
  2151. srcon_echo %ipp Team CT won the round. CT: %score.ct - T: %score.t
  2152. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Team CT won the round. CT: %score.ct - T: %score.t }
  2153. if (%score == 15) {
  2154. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2155. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2156. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2157. }
  2158. elseif (%score == 30) {
  2159. if (%score.ct > %score.t) {
  2160. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2161. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2162. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2163. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2164. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2165. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2166. }
  2167. elseif (%score.t > %score.ct) {
  2168. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2169. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2170. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2171. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2172. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2173. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2174. }
  2175. elseif ($gatherinfo(game) != CS:GO) {
  2176. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2177. rconsend %ipp say Second half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2178. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2179. }
  2180. elseif ($gatherinfo(overtime)) || (#rasta.gather == $mainchan) || (#go.ee == $mainchan) || (#cisgl.gotime2 == $mainchan) || (#gamebase.csgo == $mainchan) || (#ihl.csgo == $mainchan) {
  2181. ;writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2182. ;rconsend %ipp say Second half is over - Time to change teams! | ;rconsend %ipp mp_swapteams | ;.score %ipp switch | ;.timer 1 1 swapteams %ipp
  2183. rconsend %ipp say Second half is over - Get ready for overtime!
  2184. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2185. }
  2186. else {
  2187. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2188. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2189. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2190. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon Draw | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2191. rconsend %ipp say The gather ends draw %score.ct - %score.t | .timer 1 1 stop %ipp
  2192. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) The gather ends draw %score.ct - %score.t }
  2193. }
  2194. }
  2195. elseif (%score < 30) {
  2196. if (%score.ct >= 16) {
  2197. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2198. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2199. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2200. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2201. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2202. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2203. }
  2204. elseif (%score.t >= 16) {
  2205. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2206. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2207. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2208. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2209. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2210. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2211. }
  2212. }
  2213. elseif ($calc(%score.ct - %score.t) > 3) || ($calc(%score.ct - %score.t) > $calc($mr3(%score) - %score)) {
  2214. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2215. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2216. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2217. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2218. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2219. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2220. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2221. }
  2222. elseif ($calc(%score.t - %score.ct) > 3) || ($calc(%score.t - %score.ct) > $calc($mr3(%score) - %score)) {
  2223. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2224. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2225. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2226. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2227. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2228. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2229. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2230. }
  2231. elseif (%score == $mr3(%score)) {
  2232. if (%score.ct > %score.t) {
  2233. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2234. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2235. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2236. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2237. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2238. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2239. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2240. }
  2241. elseif (%score.t > %score.ct) {
  2242. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2243. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2244. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2245. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2246. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2247. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2248. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2249. }
  2250. elseif ($gatherinfo(game) != CS:GO) {
  2251. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2252. rconsend %ipp say Second half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2253. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2254. }
  2255. else {
  2256. ;writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2257. ;rconsend %ipp say Second half is over - Time to change teams! | ;rconsend %ipp mp_swapteams | ;.score %ipp switch | ;.timer 1 1 swapteams %ipp
  2258. rconsend %ipp say Second half is over - Get ready for overtime!
  2259. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2260. }
  2261. }
  2262. elseif (%score == $mr3.half(%score)) {
  2263. if ($gatherinfo(game) != CS:GO) {
  2264. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2265. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2266. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2267. }
  2268. else {
  2269. ;writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2270. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2271. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2272. }
  2273. }
  2274. }
  2275. alias team_t_won {
  2276. var %ipp = $1, %idd = $serverid(%ipp), %gamestats = $gamestatsini(%ipp)
  2277. .timerbombdefused. [ $+ [ %ipp ] ] off | set -u5 %roundend. [ $+ [ %ipp ] ] 1 | set -u5 %teamwon. [ $+ [ %ipp ] ] TERRORIST
  2278. var %score = $score(%ipp,total), %score.ct = $score(%ipp,ct), %score.t = $score(%ipp,t)
  2279. if ($2 isnum) && ($3 isnum) {
  2280. var %newscore.t = $calc($2 - 1), %newscore.ct = $3
  2281. writeini -n $gfile(score.ini) %ipp antiterrorist %newscore.ct
  2282. writeini -n $gfile(score.ini) %ipp terrorist %newscore.t
  2283. }
  2284. score %ipp inc t | checkace %ipp | var %score = $score(%ipp,total), %score.ct = $score(%ipp,ct), %score.t = $score(%ipp,t)
  2285. logit %ipp Team TERRORIST won the round. CT: %score.ct - T: %score.t
  2286. logit2 %ipp Team TERRORIST won the round. CT: %score.ct - T: %score.t
  2287. srcon_echo %ipp Team TERRORIST won the round. CT: %score.ct - T: %score.t
  2288. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Team TERRORIST won the round. CT: %score.ct - T: %score.t }
  2289. if (%score == 15) {
  2290. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2291. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2292. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2293. }
  2294. elseif (%score == 30) {
  2295. if (%score.t > %score.ct) {
  2296. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2297. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2298. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2299. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2300. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2301. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2302. }
  2303. elseif (%score.ct > %score.t) {
  2304. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2305. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2306. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2307. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2308. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2309. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2310. }
  2311. elseif ($gatherinfo(game) != CS:GO) {
  2312. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2313. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2314. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2315. }
  2316. elseif ($gatherinfo(overtime)) || (#rasta.gather == $mainchan) || (#go.ee == $mainchan) || (#cisgl.gotime2 == $mainchan) || (#gamebase.csgo == $mainchan) || (#ihl.csgo == $mainchan) {
  2317. ;writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2318. ;rconsend %ipp say Second half is over - Time to change teams! | ;rconsend %ipp mp_swapteams | ;.score %ipp switch | ;.timer 1 1 swapteams %ipp
  2319. rconsend %ipp say Second half is over - Get ready for overtime!
  2320. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2321. }
  2322. else {
  2323. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2324. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2325. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2326. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon Draw | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2327. rconsend %ipp say The gather ends draw %score.ct - %score.t | .timer 1 1 stop %ipp
  2328. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) The gather ends draw %score.ct - %score.t }
  2329. }
  2330. }
  2331. elseif (%score < 30) {
  2332. if (%score.t >= 16) {
  2333. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2334. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2335. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2336. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2337. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2338. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2339. }
  2340. elseif (%score.ct >= 16) {
  2341. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2342. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2343. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2344. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2345. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2346. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2347. }
  2348. }
  2349. elseif ($calc(%score.t - %score.ct) > 3) || ($calc(%score.t - %score.ct) > $calc($mr3(%score) - %score)) {
  2350. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2351. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2352. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2353. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2354. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2355. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2356. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2357. }
  2358. elseif ($calc(%score.ct - %score.t) > 3) || ($calc(%score.ct - %score.t) > $calc($mr3(%score) - %score)) {
  2359. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2360. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2361. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2362. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2363. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2364. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2365. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2366. }
  2367. elseif (%score == $mr3(%score)) {
  2368. if (%score.t > %score.ct) {
  2369. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2370. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2371. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2372. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2373. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+(%score.t,-,%score.ct)
  2374. rconsend %ipp say Terrorist won the gather %score.t - %score.ct | .timer 1 1 stop %ipp
  2375. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather %score.t - %score.ct }
  2376. }
  2377. elseif (%score.ct > %score.t) {
  2378. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2379. if ($sameteam($calc(%score -1))) { var %ctini = $gfile(counter.ini), %tini = $gfile(terrorist.ini) } | else { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) }
  2380. var %i = 1, %t = $null | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2381. var %i = 1, %ct = $null | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2382. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+(%score.ct,-,%score.t)
  2383. rconsend %ipp say Counter-Terrorist won the gather %score.ct - %score.t | .timer 1 1 stop %ipp
  2384. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather %score.ct - %score.t }
  2385. }
  2386. elseif ($gatherinfo(game) != CS:GO) {
  2387. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2388. rconsend %ipp say Second half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2389. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2390. }
  2391. else {
  2392. ;writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2393. ;rconsend %ipp say Second half is over - Time to change teams! | ;rconsend %ipp mp_swapteams | ;.score %ipp switch | ;.timer 1 1 swapteams %ipp
  2394. rconsend %ipp say Second half is over - Get ready for overtime!
  2395. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2396. }
  2397. }
  2398. elseif (%score == $mr3.half(%score)) {
  2399. if ($gatherinfo(game) != CS:GO) {
  2400. writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2401. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2402. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2403. }
  2404. else {
  2405. ;writeini -n $gfile(gatherservers.ini) %ipp status Pregame | rconsend %ipp say Counter-Terrorist: %score.ct - Terrorist: %score.t
  2406. rconsend %ipp say First half is over - Time to change teams! | .score %ipp switch | .timer 1 1 swapteams %ipp
  2407. if ($gatherinfo(amx)) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { set -u10 %forceteams. [ $+ [ %ipp ] ] 1 | .timer 1 2 rconsend %ipp status }
  2408. }
  2409. }
  2410. }
  2411. alias setscore {
  2412. var %ipp = $1, %idd = $serverid(%ipp), %gamestats = $gamestatsini(%ipp)
  2413. if ($2 == ct) || ($2 == counter) || ($2 == counterterrorist) {
  2414. if ($3 isnum 0-15) && ($calc($3 + $score(%ipp,t)) <= 29) {
  2415. writeini -n $gfile(score.ini) %ipp antiterrorist $3 | score %ipp save | rconsend %ipp say $+($chr(91),$iif($readini($gfile(gatherservers.ini),%ipp,status),$ifmatch,Score),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t)
  2416. }
  2417. elseif ($3 isnum 15) && ($calc($3 + $score(%ipp,t)) == 30) {
  2418. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2419. writeini -n $gfile(score.ini) %ipp antiterrorist $3 | rconsend %ipp say $+($chr(91),$iif($readini($gfile(gatherservers.ini),%ipp,status),$ifmatch,Score),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t)
  2420. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2421. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2422. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon Draw | writeini -n %gamestats %ipp Score $+($score(%ipp,ct),-,$score(%ipp,t))
  2423. rconsend %ipp say The gather ends draw $score(%ipp,ct) - $score(%ipp,t) | .timer 1 1 stop %ipp
  2424. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) The gather ends draw $score(%ipp,ct) - $score(%ipp,t) }
  2425. }
  2426. elseif ($3 isnum 16) && ($calc($3 + $score(%ipp,t)) <= 30) {
  2427. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2428. writeini -n $gfile(score.ini) %ipp antiterrorist $3 | rconsend %ipp say $+($chr(91),$iif($readini($gfile(gatherservers.ini),%ipp,status),$ifmatch,Score),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t)
  2429. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2430. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2431. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon CT | writeini -n %gamestats %ipp Score $+($score(%ipp,ct),-,$score(%ipp,t))
  2432. rconsend %ipp say Counter-Terrorist won the gather $score(%ipp,ct) - $score(%ipp,t) | .timer 1 1 stop %ipp
  2433. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Counter-Terrorist won the gather $score(%ipp,ct) - $score(%ipp,t) }
  2434. }
  2435. }
  2436. elseif ($2 == terrorist) || ($2 == t) {
  2437. if ($3 isnum 0-15) && ($calc($3 + $score(%ipp,ct)) <= 29) {
  2438. writeini -n $gfile(score.ini) %ipp terrorist $3 | score %ipp save | rconsend %ipp say $+($chr(91),$iif($readini($gfile(gatherservers.ini),%ipp,status),$ifmatch,Score),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t)
  2439. }
  2440. elseif ($3 isnum 15) && ($calc($3 + $score(%ipp,ct)) == 30) {
  2441. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2442. writeini -n $gfile(score.ini) %ipp terrorist $3 | score %ipp save | rconsend %ipp say $+($chr(91),$iif($readini($gfile(gatherservers.ini),%ipp,status),$ifmatch,Score),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t)
  2443. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2444. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Draw 1 | inc %i }
  2445. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon Draw | writeini -n %gamestats %ipp Score $+($score(%ipp,ct),-,$score(%ipp,t))
  2446. rconsend %ipp say The gather ends draw $score(%ipp,ct) - $score(%ipp,t) | .timer 1 1 stop %ipp
  2447. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) The gather ends draw $score(%ipp,ct) - $score(%ipp,t) }
  2448. }
  2449. elseif ($3 isnum 16) && ($calc($3 + $score(%ipp,ct)) <= 30) {
  2450. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2451. writeini -n $gfile(score.ini) %ipp terrorist $3 | score %ipp save | rconsend %ipp say $+($chr(91),$iif($readini($gfile(gatherservers.ini),%ipp,status),$ifmatch,Score),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t)
  2452. var %i = 1, %t = $null, %tini = $gfile(counter.ini) | while (%i <= $ini(%tini,%ipp,0)) { var %s = $ini(%tini,%ipp,%i), %t = %t $gauth(%s), %t.sid = %t.sid %s | writeini -n %gamestats %s Wins 1 | inc %i }
  2453. var %i = 1, %ct = $null, %ctini = $gfile(terrorist.ini) | while (%i <= $ini(%ctini,%ipp,0)) { var %s = $ini(%ctini,%ipp,%i), %ct = %ct $gauth(%s), %ct.sid = %ct.sid %s | writeini -n %gamestats %s Loss 1 | inc %i }
  2454. writeini -n %gamestats %ipp CT $iif(%ct.sid,$ifmatch,0) | writeini -n %gamestats %ipp TERRORIST $iif(%t.sid,$ifmatch,0) | writeini -n %gamestats %ipp TeamWon TERRORIST | writeini -n %gamestats %ipp Score $+($score(%ipp,t),-,$score(%ipp,ct))
  2455. rconsend %ipp say Terrorist won the gather $score(%ipp,t) - $score(%ipp,ct) | .timer 1 1 stop %ipp
  2456. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Terrorist won the gather $score(%ipp,t) - $score(%ipp,ct) }
  2457. }
  2458. }
  2459. }
  2460. alias teamcolor {
  2461. if ($1 == CT) || ($1 == Counter) || ($1 == CounterTerrorist) || ($1 == Counter-Terrorist) { return $col(11,CT) }
  2462. if ($1 == TERRORIST) { return $col(04,TERRORIST) }
  2463. if ($1 == T) { return $col(04,T) }
  2464. return $1
  2465. }
  2466. alias killpoints {
  2467. var %points = $getpoints($1), %apoints = $getpoints($2), %diff = $calc(%points - %apoints)
  2468. if (%points < 1000) || (%apoints < 1000) {
  2469. if (%diff >= 1500) { return 0.6 }
  2470. if (%diff >= 1000) { return 0.7 }
  2471. if (%diff >= 600) { return 0.8 }
  2472. if (%diff >= 300) { return 0.9 }
  2473. if (%diff >= -300) { return 1.0 }
  2474. if (%diff >= -600) { return 1.1 }
  2475. if (%diff >= -1000) { return 1.2 }
  2476. if (%diff >= -1500) { return 1.3 }
  2477. return 1.4
  2478. }
  2479. if (%diff >= 1500) { return 0.7 }
  2480. if (%diff >= 800) { return 0.8 }
  2481. if (%diff >= 300) { return 0.9 }
  2482. if (%diff >= -300) { return 1.0 }
  2483. if (%diff >= -800) { return 1.1 }
  2484. if (%diff >= -1300) { return 1.2 }
  2485. return 1.3
  2486. }
  2487. alias echostuff { if (!$window(@echostuff)) { window -ezk0 @echostuff } | echo @echostuff $date ][ $time ][ $1- }
  2488. alias echostuff2 { if (!$window(@echostuff2)) { window -ezk0 @echostuff2 } | echo @echostuff2 $date ][ $time ][ $1- }
  2489. alias ingamenick {
  2490. var %auth = $gauth($2), %nick = $remove($gnick(%auth),$chr(35),[G],-Admin-), %admin = $admin($+($chr(35),%auth)), %ingame = $read(ingamenicks.dat,s,$iif($2,$2,$1)), %isit = $remove($iif(%ingame,$ifmatch,%nick),[G],[A])
  2491. var %team = $iif($readini($gfile(counter.ini),$1,$2),CT,T), %score = $score($1,total), %team = $iif($sameteam(%score),%team,$iif(%team == CT,T,CT)), %n = %team %isit, %name = $replace(%n,$chr(92),$chr(124)) | return %name
  2492. }
  2493. alias tjekteams {
  2494. if (!$sameteam($score($1,total))) { var %ct = $gfile(terrorist.ini), %t = $gfile(counter.ini) } | else { var %ct = $gfile(counter.ini), %t = $gfile(terrorist.ini) }
  2495. var %i = 1, %w = 0 | while (%i <= $ini($gfile(joined.ini),$1,0)) {
  2496. var %x = $ini($gfile(joined.ini),$1,%i), %join = $readini($gfile(joined.ini),$1,%x), %team = $null | if ($readini(%ct,$1,%x)) { var %team = CT } | if ($readini(%t,$1,%x)) { var %team = TERRORIST }
  2497. if (%team) && (%team != %join) { .timer 1 %w rconsend $1 say $gnick($gauth(%x)) needs to be on team $iif(%team == CT,CounterTerrorist!,Terrorist!) | inc %w } | inc %i
  2498. }
  2499. if (!%w) { rconsend $1 say All ingame players are on the right team.. }
  2500. }
  2501. alias tjeklan {
  2502. if (!$readini($gfile(gatherstatus.ini),$1,lantjek)) {
  2503. writeini -n $gfile(gatherstatus.ini) $1 lantjek $time | rconsend $1 say Please wait while checking for LAN.. | set -u10 %lancheck. [ $+ [ $1 ] ] 1 | .timer 1 1 rconsend $1 status
  2504. }
  2505. }
  2506. alias lancheck {
  2507. if ($ini($gfile(newteams.ini),$1)) { resetnewteams $1 } | var %i = 1, %tjek = $null | while (%i <= $ini($gfile(lancheck.ini),$1,0)) {
  2508. var %x = $ini($gfile(lancheck.ini),$1,%i), %xids = $ini($gfile(lancheck.ini),%x,0) | if (%xids >= 2) {
  2509. var %c = 1, %teamct = $null, %teamt = $null | while (%c <= %xids) { var %cx = $ini($gfile(lancheck.ini),%x,%c)
  2510. if ($readini($gfile(counter.ini),$1,%cx)) { var %teamct = %teamct %cx } | elseif ($readini($gfile(terrorist.ini),$1,%cx)) { var %teamt = %teamt %cx } | inc %c
  2511. }
  2512. writeini -n $gfile(newteams.ini) $1 %x %x | if (%teamct) && (%teamt) { var %tjek = lan } | elseif (!%tjek) { var %tjek = sameteam }
  2513. var %g = 1 | while (%g <= $numtok(%teamt,32)) { writeini -n $gfile(newteams.ini) %x $gettok(%teamt,%g,32) $gettok(%teamt,%g,32) | inc %g }
  2514. var %g = 1 | while (%g <= $numtok(%teamct,32)) { writeini -n $gfile(newteams.ini) %x $gettok(%teamct,%g,32) $gettok(%teamct,%g,32) | inc %g }
  2515. }
  2516. remini -n $gfile(lancheck.ini) %x | inc %i
  2517. }
  2518. if ($ini($gfile(lancheck.ini),$1)) { remini -n $gfile(lancheck.ini) $1 } | if (!%tjek) { rconsend $1 say There was not found any players on LAN | .timer 1 1 .tjekteams $1 | resetnewteams $1 }
  2519. elseif (%tjek == sameteam) { rconsend $1 say Players on LAN already on the same team | .timer 1 1 .tjekteams $1 | resetnewteams $1 } | else { rconsend $1 say There was found players on LAN.. | newteams $1 }
  2520. }
  2521. alias checkclutch {
  2522. if (!$sameteam($score($1,total))) { var %ini = $iif($2 == CT,$gfile(terrorist.ini),$gfile(counter.ini)) } | else { var %ini = $iif($2 == CT,$gfile(counter.ini),$gfile(terrorist.ini)) }
  2523. var %dead = $iif($readini($gfile(kills.ini),$1,$2),$ifmatch,0), %team = $ini(%ini,$1,0), %alive = $calc(%team - %dead) | if (%alive == 1) { return $true } | return $false
  2524. }
  2525. alias checkace {
  2526. var %i = 1, %s = 0, %p = $ini($gfile(kills.ini),$1,0), %ct = $iif($readini($gfile(kills.ini),$1,CT),$ifmatch,0), %t = $iif($readini($gfile(kills.ini),$1,TERRORIST),$ifmatch,0), %gamestats = $gamestatsini($1), %teamwon = %teamwon. [ $+ [ $1 ] ]
  2527. if (!$sameteam($score($1,total))) { var %old = %ct, %ct = %t, %t = %old, %teamwon = $iif(%teamwon == CT,TERRORIST,CT) }
  2528. while (%i <= %p) {
  2529. var %x = $ini($gfile(kills.ini),$1,%i), %k = $readini($gfile(kills.ini),$1,%x), %auth = $gauth(%x)
  2530. if (STEAM_*:*:* iswm %x) { var %clutch = $+(clutch,%x)
  2531. if ($readini($gfile(kills.ini),$1,%clutch)) { var %c = $ifmatch, %type = $+(1on,%c), %last = $readini($gfile(lastkill.ini),$1,%x)
  2532. if ($readini($gfile(counter.ini),$1,%x)) { var %t.p = $ini($gfile(terrorist.ini),$1,0)
  2533. if (%t == %t.p) {
  2534. if (%teamwon == CT) {
  2535. if (%c >= 2) && (%c <= 5) {
  2536. if (%c >= 4) { var %points = %c } | elseif (%c == 3) { var %points = 2 } | else { var %points = 1 } | rconsend $1 say $gnick(%x) scored a %type clutch!
  2537. writeini -n %gamestats %x %type $calc($readini(%gamestats,%x,%type) +1) | writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) + %points)
  2538. if (%last) && ($readini($gfile(terrorist.ini),$1,%last)) { var %fail = $+(fail_,%type) | writeini -n %gamestats %last %fail $calc($readini(%gamestats,%last,%fail) +1) }
  2539. }
  2540. elseif (%c == 1) { writeini -n %gamestats %x %type $calc($readini(%gamestats,%x,%type) +1)
  2541. if (%last) && ($readini($gfile(terrorist.ini),$1,%last)) { var %fail = $+(fail_,%type) | writeini -n %gamestats %last %fail $calc($readini(%gamestats,%last,%fail) +1) }
  2542. }
  2543. }
  2544. elseif (%c >= 1) && (%c <= 5) { var %fail = $+(fail_,%type) | writeini -n %gamestats %x %fail $calc($readini(%gamestats,%x,%fail) +1) }
  2545. }
  2546. elseif (%teamwon == CT) {
  2547. var %p = $calc(%t.p - %t + %c), %type = $+(1on,%p) | if (%p >= 4) { var %points = %p } | elseif (%p == 3) { var %points = 2 } | else { var %points = 1 }
  2548. writeini -n %gamestats %x %type $calc($readini(%gamestats,%x,%type) +1) | writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) + %points) | rconsend $1 say $gnick(%x) scored a %type clutch!
  2549. }
  2550. else { var %type = $+(1on,$calc(%t.p - %t + %c)), %fail = $+(fail_,%type) | writeini -n %gamestats %x %fail $calc($readini(%gamestats,%x,%fail) +1) }
  2551. }
  2552. elseif ($readini($gfile(terrorist.ini),$1,%x)) { var %ct.p = $ini($gfile(counter.ini),$1,0)
  2553. if (%ct == %ct.p) {
  2554. if (%teamwon == TERRORIST) {
  2555. if (%c >= 2) && (%c <= 5) {
  2556. if (%c >= 4) { var %points = %c } | elseif (%c == 3) { var %points = 2 } | else { var %points = 1 } | rconsend $1 say $gnick(%x) scored a %type clutch!
  2557. writeini -n %gamestats %x %type $calc($readini(%gamestats,%x,%type) +1) | writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) + %points)
  2558. if (%last) && ($readini($gfile(counter.ini),$1,%last)) { var %fail = $+(fail_,%type) | writeini -n %gamestats %last %fail $calc($readini(%gamestats,%last,%fail) +1) }
  2559. }
  2560. elseif (%c == 1) { writeini -n %gamestats %x %type $calc($readini(%gamestats,%x,%type) +1)
  2561. if (%last) && ($readini($gfile(counter.ini),$1,%last)) { var %fail = $+(fail_,%type) | writeini -n %gamestats %last %fail $calc($readini(%gamestats,%last,%fail) +1) }
  2562. }
  2563. }
  2564. elseif (%c >= 1) && (%c <= 5) { var %fail = $+(fail_,%type) | writeini -n %gamestats %x %fail $calc($readini(%gamestats,%x,%fail) +1) }
  2565. }
  2566. elseif (%teamwon == TERRORIST) {
  2567. var %p = $calc(%ct.p - %ct + %c), %type = $+(1on,%p) | if (%p >= 4) { var %points = %p } | elseif (%p == 3) { var %points = 2 } | else { var %points = 1 }
  2568. writeini -n %gamestats %x %type $calc($readini(%gamestats,%x,%type) +1) | writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) + %points) | rconsend $1 say $gnick(%x) scored a %type clutch!
  2569. }
  2570. else { var %type = $+(1on,$calc(%ct.p - %ct + %c)), %fail = $+(fail_,%type) | writeini -n %gamestats %x %fail $calc($readini(%gamestats,%x,%fail) +1) }
  2571. }
  2572. }
  2573. if (%k >= 5) {
  2574. if ($readini($gfile(counter.ini),$1,%x)) && (%k == $ini($gfile(terrorist.ini),$1,0)) {
  2575. writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) +3) | writeini -n %gamestats %x Aces $calc($readini(%gamestats,%x,Aces) +1) | rconsend $1 say $gnick(%x) made an ACE!!
  2576. }
  2577. elseif ($readini($gfile(terrorist.ini),$1,%x)) && (%k == $ini($gfile(counter.ini),$1,0)) {
  2578. writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) +3) | writeini -n %gamestats %x Aces $calc($readini(%gamestats,%x,Aces) +1) | rconsend $1 say $gnick(%x) made an ACE!!
  2579. }
  2580. }
  2581. }
  2582. inc %i
  2583. }
  2584. remini -n $gfile(kills.ini) $1 | remini -n $gfile(lastkill.ini) $1 | unset %teamwon. [ $+ [ $1 ] ]
  2585. }
  2586. alias missing {
  2587. if (!$2) {
  2588. var %i = 1, %s = 0, %p = $ini($gfile(players.ini),$1,0), %m = $null | while (%i <= %p) {
  2589. var %x = $ini($gfile(players.ini),$1,%i), %tid = $readini($gfile(players.ini),$1,%x)
  2590. if (!$readini($gfile(joined.ini),$1,%x)) {
  2591. if (!%m) { var %m = $gnick(%x) $+ ( $+ $duration($calc(%tid - $ctime)) $+ ) }
  2592. else {
  2593. if (!%s) { rconsend $1 say The following are missing on the server: | inc %s }
  2594. .timer 1 %s rconsend $1 say %m $gnick(%x) $+ ( $+ $duration($calc(%tid - $ctime)) $+ ) | var %m = $null | inc %s
  2595. }
  2596. }
  2597. inc %i
  2598. }
  2599. if (%m) { if (!%s) { rconsend $1 say Players missing on the server: | inc %s } | .timer 1 %s rconsend $1 say %m } | elseif (!%s) { rconsend $1 say There is no players missing }
  2600. }
  2601. else {
  2602. var %i = 1, %s = 0, %p = $ini($gfile(players.ini),$1,0), %m | while (%i <= %p) {
  2603. var %x = $ini($gfile(players.ini),$1,%i), %tid = $readini($gfile(players.ini),$1,%x)
  2604. if (!$readini($gfile(joined.ini),$1,%x)) { var %m = $iif(%m,$+(%m,$chr(44))) $anick(%x) $+ ( $+ $duration($calc(%tid - $ctime)) $+ ) }
  2605. inc %i
  2606. }
  2607. whatcmd $meorsay $2 $logo Players missing on server $+($chr(35),$serverid($1),:) $iif(%m,%m,None) $logo
  2608. }
  2609. }
  2610. alias queryteams {
  2611. var %msgtime = 0 | if ($2 == newteams) { rconsend $1 say LAN Script: New teams upcomming.. | inc %msgtime 2000 }
  2612. if (!$sameteam($score($1,total))) { var %tini = $gfile(counter.ini), %ctini = $gfile(terrorist.ini) } | else { var %tini = $gfile(terrorist.ini), %ctini = $gfile(counter.ini) }
  2613. var %i = 1, %p = $ini(%tini,$1,0), %t | while (%i <= %p) { var %x = $ini(%tini,$1,%i), %t = $iif(%t,$+(%t,$chr(44))) $gnick(%x) | inc %i }
  2614. var %i = 1, %p = $ini(%ctini,$1,0), %ct | while (%i <= %p) { var %x = $ini(%ctini,$1,%i), %ct = $iif(%ct,$+(%ct,$chr(44))) $gnick(%x) | inc %i }
  2615. .timer -m 1 %msgtime rconsend $1 say T: $iif(%t,$ifmatch,0) | .timer -m 1 %msgtime rconsend $1 say CT: $iif(%ct,$ifmatch,0) | inc %msgtime 1000
  2616. if ($2 == newteams) { .timer -m 1 %msgtime rconsend $1 say If u need info, use .send on mIRC. } | else { .timer -m 1 %msgtime tjekteams $1 }
  2617. }
  2618. alias savelastid {
  2619. var %ids = $readini($gfile(gatherstats.ini),$1,lastgame)
  2620. if ($numtok(%ids,44) >= 5) { var %new = $+($gettok(%ids,2-5,44),$chr(44),$2) } | elseif (%ids) { var %new = $+(%ids,$chr(44),$2) } | else { var %new = $2 }
  2621. if ($2 isnum) { writeini -n $gfile(gatherstats.ini) $1 lastgame %new }
  2622. }
  2623. alias saveplayedstats {
  2624. writeini -n $gfile(gatherstats.ini) chan $date(yyyy) $calc($readini($gfile(gatherstats.ini),chan,$date(yyyy)) +1) | writeini -n $gfile(gatherstats.ini) chan $date(mmm) $calc($readini($gfile(gatherstats.ini),chan,$date(mmm)) +1)
  2625. writeini -n $gfile(gatherstats.ini) chan Thisweek $calc($readini($gfile(gatherstats.ini),chan,thisweek) +1) | writeini -n $gfile(gatherstats.ini) chan Today $calc($readini($gfile(gatherstats.ini),chan,today) +1)
  2626. writeini -n $gfile(gatherinfo.ini) maps $1 $calc($readini($gfile(gatherinfo.ini),maps,$1) +1) | writeini -n $gfile(gatherstats.ini) $2 Started $calc($readini($gfile(gatherstats.ini),$2,Started) +1)
  2627. }
  2628. alias stop {
  2629. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2630. if ($sock($+($srcon.prefix, $1))) {
  2631. if ($gatherinfo(gotv)) { rconsend $1 tv_stoprecord }
  2632. if (%gatherstopped. [ $+ [ $1 ] ]) { rconsend $1 say The gather got stopped.. }
  2633. .timer -o 1 1 srcon.clear $1
  2634. }
  2635. .timer -o 1 2 stopnow $1-
  2636. }
  2637. alias stopnow {
  2638. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2639. if (%gatherstopped. [ $+ [ $1 ] ]) { .timer -o 1 5 resetall $1 %gatherstopped. [ $+ [ $1 ] ] | .timer -o 1 6 whatcmd settopic | unset %gatherstopped. [ $+ [ $1 ] ] }
  2640. elseif (!%ignore) { var %cl1 = $readini($gfile(gatherstatus.ini),$1,challenger), %cl2 = $readini($gfile(gatherstatus.ini),$1,challenged)
  2641. var %map = $readini($gfile(gatherstatus.ini),$1,map), %admin = $readini($gfile(gatherstatus.ini),$1,gatheradmin), %type = $readini($gfile(gatherstatus.ini),$1,type), %gid = $calc($readini($gfile(gatherstats.ini),chan,played) +1), %players = $readini($gfile(gatherstatus.ini),$1,slots), %slots = $round($calc(%players /2),0), %adminauth = $gauth(%admin), %gamestats = $gamestatsini($1)
  2642. set -u10 %ignore 1 | logtop $1 | writeini -n $gfile(gatherstats.ini) chan Played %gid | writeini -n $gfile(gatherservers.ini) $1 lastgame %gid
  2643. if ($me ison $mainchan) { whatcmd mute $mainchan | whatcmd $meorsay $mainchan $logo Gather on server $+($chr(35),$serverid($1)) ended, please wait.. $split Almost all commands are blocked for 30 seconds $logo }
  2644. writeini -n $gfile(gatherids.ini) %gid Started $readini($gfile(gatherstatus.ini),$1,start_time) | writeini -n $gfile(gatherids.ini) %gid Ended $date $time | writeini -n $gfile(gatherids.ini) %gid Game %type
  2645. writeini -n $gfile(gatherids.ini) %gid GatherAdmin %admin | writeini -n $gfile(gatherids.ini) %gid Type $+(%slots,on,%slots) | writeini -n $gfile(gatherids.ini) %gid Map %map | writeini -n $gfile(gatherids.ini) %gid Server $1
  2646. var %s = 1 | while ($ini(%gamestats,$1,%s)) { var %n = $ifmatch, %ns = $readini(%gamestats,$1,%n) | writeini -n $gfile(gatherids.ini) %gid %n %ns | if (%n == CT) || (%n == TERRORIST) { logtop $1 $+(%n,:) %ns } | inc %s }
  2647. var %s = 1 | while ($ini($gfile(leavers.ini),$1,%s)) { var %id = $ifmatch, %leavers = $readini($gfile(gatherids.ini),%gid,Leavers) | if (!$istok(%leavers,%id,32)) && (!$readini($gfile(players.ini),$1,%id)) { writeini -n $gfile(gatherids.ini) %gid Leavers %leavers %id } | inc %s }
  2648. remini -n %gamestats $1 | writeini -n $gfile(gatherstatus.ini) $1 gid %gid | logtop $1 GatherAdmin: $gauth(%admin) | logtop $1 GatherID: $+($chr(35),%gid,:) $+(%slots,on,%slots) on %map | savelog $1 $+(gatherid,%gid) | savelog2 $1 $+(gatherid,%gid)
  2649. remini -n $gfile(gatherids.ini) %gid Points | .timer -o 1 1 saveplayedstats %map %admin | .timer -o 1 3 stopnext $1 %gid
  2650. ;;SPECIAL;;
  2651. if (#signfrag.* iswm $mainchan) { set -z %CL. [ $+ [ %cl1 ] ] 600 | set -z %CL. [ $+ [ %cl2 ] ] 600 }
  2652. }
  2653. else { .timer -o 1 5 stopnow $1- }
  2654. }
  2655. alias stopnext {
  2656. set -u10 %ignore 1 | var %gid = $2, %i = 1, %window = @best, %b = 2, %ce = 1, %te = 1, %ct = 0, %t = 0
  2657. while ($ini($gfile(counter.ini),$1,%ce)) { var %x = $ifmatch, %p = $getpoints(%x), %ct = $calc(%ct + %p) | inc %ce }
  2658. while ($ini($gfile(terrorist.ini),$1,%te)) { var %x = $ifmatch, %p = $getpoints(%x), %t = $calc(%t + %p) | inc %te }
  2659. dec %ce | dec %te | var %avg_ct = $calc(%ct / %ce), %avg_t = $calc(%t / %te) | set %ct. [ $+ [ $1 ] ] %avg_ct | set %t. [ $+ [ $1 ] ] %avg_t
  2660. while ($window(%window)) { var %window = $+(@best,%b) | inc %b } | inc %b | var %window2 = $+(@best,%b) | while ($window(%window2)) { inc %b | var %window2 = $+(@best,%b) }
  2661. window -eh1 %window | window -eh1 %window2 | .timer -o 1 2 gamestopstats $1 %gid %window %window2
  2662. }
  2663. alias gamestopstats {
  2664. set -u10 %ignore 1 | var %gamestats = $gamestatsini($1), %gid = $2, %window = $3, %window2 = $4, %ce = $iif(%ct. [ $+ [ $1 ] ],$ifmatch,1000), %te = $iif(%t. [ $+ [ $1 ] ],$ifmatch,1000)
  2665. while ($ini(%gamestats,1)) { var %id = $ifmatch
  2666. if (*STEAM_*:*:* iswm %id) {
  2667. savelastid %id %gid
  2668. if ($gatherinfo(mysql)) { writeini -n mysql.ini update_all %id %id }
  2669. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) steamids %id %id }
  2670. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) steamids %id %id }
  2671. if ($readini($gfile(players.ini),$1,%id)) { writeini -n $gfile(gatherstats.ini) %id played $calc($readini($gfile(gatherstats.ini),%id,played) +1)
  2672. var %entrykills, %kills = 0, %deaths = 0, %assists = 0, %ownkills = 0, %teamkills = 0, %plants = 0, %defs = 0, %wins = 0, %draw = 0, %loss = 0, %match = 0, %aces = 0, %wl = 0, %best = 0, %mypoints = 0, %points = 0, %s = 1
  2673. var %1on1 = 0, %1on2 = 0, %1on3 = 0, %1on4 = 0, %1on5 = 0, %fail_1on1 = 0, %fail_1on2 = 0, %fail_1on3 = 0, %fail_1on4 = 0, %fail_1on5 = 0
  2674. while ($ini(%gamestats,%id,%s)) { var %n = $ifmatch, %ns = $readini(%gamestats,%id,%n) | inc %s
  2675. if ($istok(Kills Teamkills Deaths Assists Plants Defs Aces Wins Loss Draw Entrykills 4K 3K Headshots,%n,32)) { var % [ $+ [ %n ] ] %ns | writeini -n $gfile(gatherstats.ini) %id %n $calc($readini($gfile(gatherstats.ini),%id,%n) + %ns) }
  2676. elseif ($istok(1on1 1on2 1on3 1on4 1on5 fail_1on1 fail_1on2 fail_1on3 fail_1on4 fail_1on5,%n,32)) { var % [ $+ [ %n ] ] %ns | writeini -n $gfile(clutchstats.ini) %id %n $calc($readini($gfile(clutchstats.ini),%id,%n) + %ns) }
  2677. elseif (%n == Points) { var %mypoints = %ns }
  2678. elseif (*1on* !iswm %n) { writeini -n $gfile(wepstats.ini) chan %n $calc($readini($gfile(wepstats.ini),chan,%n) + %ns) | writeini -n $gfile(wepstats.ini) %id %n $calc($readini($gfile(wepstats.ini),%id,%n) + %ns) }
  2679. }
  2680. if (%loss) { var %match = -13, %wl = -5 } | if (%wins) { var %match = 13, %wl = 5 } | var %tp = $iif($readini($gfile(counter.ini),$1,%id),%ce,%te), %pointsnow = $getpoints(%id), %pointsdif = $calc(%tp - %pointsnow)
  2681. if (%pointsdif >= 600) || (%pointsnow < 900) { var %1onx = $calc((%1on2 * 1.5) + (%1on3 * 2) + (%1on4 * 3) + (%1on5 * 3))
  2682. var %best = $calc(%wl + %1onx + (%kills / 2) + (%entrykills / 3) + (%aces * 3) + (%plants / 4) + (%defs / 4) + (%assists / 3) - (%deaths / 2.5)), %points = $calc(%match + %best)
  2683. }
  2684. else { var %1onx = $calc(%1on2 + (%1on3 * 1.5) + (%1on4 * 2.5) + (%1on5 * 2.5))
  2685. var %best = $calc(%wl + %1onx + (%kills / 2.5) + (%entrykills / 4) + (%aces * 3) + (%plants / 4) + (%defs / 4) + (%assists / 3) - (%deaths / 2.5)), %points = $calc(%match + %best)
  2686. }
  2687. var %kd = $calc(%kills / %deaths), %1onx = 1on1: $+ %1on1 $+ / $+ $calc(%fail_1on1 + %1on1) 1on2: $+ %1on2 $+ / $+ $calc(%fail_1on2 + %1on2) 1on3: $+ %1on3 $+ / $+ $calc(%fail_1on3 + %1on3) 1on4: $+ %1on4 $+ / $+ $calc(%fail_1on4 + %1on4) 1on5: $+ %1on5 $+ / $+ $calc(%fail_1on5 + %1on5)
  2688. aline %window %id $ex_nr(%best) | aline %window2 %id $ex_nr(%kd) | writeini -n $gfile(gatherids.ini) %gid %id Kills: $+ %kills Deaths: $+ %deaths Assists: $+ %assists Points: $+ %points %1onx
  2689. givepoints %id %points
  2690. }
  2691. else {
  2692. var %leavers = $iif($readini($gfile(gatherids.ini),%gid,Leavers),$ifmatch,$null) | if (!$istok(%leavers,%id,32)) { writeini -n $gfile(gatherids.ini) %gid Leavers %leavers %id }
  2693. }
  2694. }
  2695. remini -n %gamestats %id
  2696. }
  2697. .timer -o 1 2 stoprest $1 %gid %window %window2
  2698. }
  2699. alias stoprest {
  2700. set -u10 %ignore 1 | var %gamestats = $gamestatsini($1), %gid = $2, %window = $3, %window2 = $4
  2701. if ($gatherinfo(mysql)) { writeini -n mysql.ini update_gather %gid %gid }
  2702. filter -twce 2 32 %window %window | var %motm = $gettok($line(%window,1),1,32), %notm = $findnotm(%window) | window -c %window
  2703. filter -twce 2 32 %window2 %window2 | var %kd = $gettok($line(%window2,1),1,32) | window -c %window2
  2704. if (%motm) { writeini -n $gfile(gatherstats.ini) %motm motm $calc($readini($gfile(gatherstats.ini),%motm,motm) +1) | writeini -n $gfile(gatherids.ini) %gid motm %motm }
  2705. if (%kd) { writeini -n $gfile(gatherstats.ini) %kd bestkds $calc($readini($gfile(gatherstats.ini),%kd,bestkds) +1) | writeini -n $gfile(gatherids.ini) %gid bestkd %kd }
  2706. if (%notm) && (%notm != %motm) { writeini -n $gfile(gatherstats.ini) %notm notm $calc($readini($gfile(gatherstats.ini),%notm,notm) +1) | writeini -n $gfile(gatherids.ini) %gid notm %notm }
  2707. .timer -o 1 2 gatherdone $1
  2708. var %leavers = $readini($gfile(gatherids.ini),%gid,Leavers), %i = 1 | while ($gettok(%leavers,%i,32)) { var %id = $ifmatch
  2709. if ($gatherinfo(leavebans)) { givepoints %id -39 }
  2710. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) steamids %id %id }
  2711. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) steamids %id %id }
  2712. inc %i
  2713. }
  2714. }
  2715. alias gatherdone {
  2716. var %gamestats = $gamestatsini($1)
  2717. if ($ini(%gamestats,1)) {
  2718. if ($readini($gfile(gatherstatus.ini),$1,gid)) { var %ifmatch = $ifmatch | stopnext $1 %ifmatch } | else { stop $1 }
  2719. }
  2720. else {
  2721. var %gid = $readini($gfile(gatherstatus.ini),$1,gid)
  2722. if ($readini($gfile(gatherstatus.ini),info,ip) == $1) { remini -n $gfile(gatherstatus.ini) info }
  2723. if ($readini($gfile(gatherservers.ini),$1,status)) { remini -n $gfile(gatherservers.ini) $1 status }
  2724. if ($ini($gfile(gatherstatus.ini),$1)) { remini -n $gfile(gatherstatus.ini) $1 }
  2725. .timer [ $+ [ $+(*,$1,*) ] ] off | unset % [ $+ [ $+(*,$1,*) ] ] | if (%gid) { .timer -o 1 1 gatherend $1 %gid }
  2726. }
  2727. }
  2728. alias resultgame {
  2729. if (!$istok(CT TERRORIST,$2,32)) { return }
  2730. writeini -n $gfile(gatherservers.ini) $1 status Ended
  2731. if (!%ignore) {
  2732. var %map = $readini($gfile(gatherstatus.ini),$1,map), %admin = $readini($gfile(gatherstatus.ini),$1,gatheradmin), %type = $readini($gfile(gatherstatus.ini),$1,type), %gid = $calc($readini($gfile(gatherstats.ini),chan,played) +1), %players = $readini($gfile(gatherstatus.ini),$1,slots), %slots = $round($calc(%players /2),0), %adminauth = $gauth(%admin), %gamestats = $gamestatsini($1), %teamwon = $iif($2 == Draw,$upleft($2),$upper($2))
  2733. set -u10 %ignore 1
  2734. logtop $1
  2735. writeini -n $gfile(gatherstats.ini) chan Played %gid
  2736. writeini -n $gfile(gatherservers.ini) $1 lastgame %gid
  2737. if ($me ison $mainchan) {
  2738. whatcmd mute $mainchan
  2739. whatcmd $meorsay $mainchan $logo Gather on server $+($chr(35),$serverid($1)) ended, please wait.. $split Almost all commands are blocked for a few seconds $logo
  2740. }
  2741. writeini -n $gfile(gatherids.ini) %gid Started $readini($gfile(gatherstatus.ini),$1,start_time)
  2742. writeini -n $gfile(gatherids.ini) %gid Ended $date $time
  2743. writeini -n $gfile(gatherids.ini) %gid Game %type
  2744. writeini -n $gfile(gatherids.ini) %gid GatherAdmin %admin
  2745. writeini -n $gfile(gatherids.ini) %gid Type $+(%slots,on,%slots)
  2746. writeini -n $gfile(gatherids.ini) %gid Map %map
  2747. writeini -n $gfile(gatherids.ini) %gid Server $1
  2748. var %i = 1, %team.ct, %team.ct.sid | while ($ini($gfile(counter.ini),$1,%i)) { var %s = $ifmatch, %team.ct = %team.ct $gauth(%s), %team.ct.sid = %team.ct.sid %s | inc %i }
  2749. var %i = 1, %team.t, %team.t.sid | while ($ini($gfile(terrorist.ini),$1,%i)) { var %s = $ifmatch, %team.t = %team.t $gauth(%s), %team.t.sid = %team.t.sid %s | inc %i }
  2750. writeini -n $gfile(gatherids.ini) %gid CT $iif(%team.ct.sid,$ifmatch,0)
  2751. writeini -n $gfile(gatherids.ini) %gid TERRORIST $iif(%team.t.sid,$ifmatch,0)
  2752. logtop $1 CT: %team.ct | logtop $1 TERRORIST: %team.t
  2753. writeini -n $gfile(gatherids.ini) %gid TeamWon %teamwon
  2754. remini -n %gamestats $1
  2755. writeini -n $gfile(gatherstatus.ini) $1 gid %gid
  2756. logtop $1 GatherAdmin: $gauth(%admin)
  2757. logtop $1 GatherID: $+($chr(35),%gid,:) $+(%slots,on,%slots) on %map
  2758. savelog $1 $+(gatherid,%gid)
  2759. .timer -o 1 1 saveplayedstats %map %admin | .timer -o 1 2 resultnext $1 %gid %teamwon
  2760. ;;SPECIAL;;
  2761. if (#signfrag.* iswm $mainchan) && (%type == Challenge) {
  2762. var %cl1 = $readini($gfile(gatherstatus.ini),$1,challenger), %cl2 = $readini($gfile(gatherstatus.ini),$1,challenged)
  2763. set -z %CL. [ $+ [ %cl1 ] ] 600 | set -z %CL. [ $+ [ %cl2 ] ] 600
  2764. }
  2765. }
  2766. else { .timer -o 1 5 resultgame $1- }
  2767. }
  2768. alias resultnext {
  2769. set -u10 %ignore 1 | var %gid = $2, %teamwon = $3, %i = 1, %ce = 1, %te = 1, %ct = 0, %t = 0, %won = 20, %lost = -20
  2770. while ($ini($gfile(counter.ini),$1,%ce)) { var %x = $ifmatch, %p = $getpoints(%x), %ct = $calc(%ct + %p) | inc %ce } | dec %ce
  2771. while ($ini($gfile(terrorist.ini),$1,%te)) { var %x = $ifmatch, %p = $getpoints(%x), %t = $calc(%t + %p) | inc %te } | dec %te
  2772. var %avg_ct = $round($calc(%ct / %ce),0), %avg_t = $round($calc(%t / %te),0), %total = $calc(%avg_ct + %avg_t), %ct_pct = $round($calc(100 / %total * %avg_ct),0), %t_pct = $round($calc(100 / %total * %avg_t),0)
  2773. if (%ct_pct > %t_pct) {
  2774. var %dif = $calc(%ct_pct - %t_pct)
  2775. if (%teamwon == CT) {
  2776. var %d = 0.3 | while (%dif) && (%d < 2) { dec %won %d | inc %lost $calc(%d - $iif(%d > 1,0.3,0.2)) | inc %d $iif(%d > 1,0.1,0.3) | dec %dif }
  2777. }
  2778. else {
  2779. var %d = 0.2 | while (%dif) && (%d < 2) { inc %won %d | dec %lost $calc(%d - $iif(%d > 1,0.3,0.2)) | inc %d 0.3 | dec %dif }
  2780. }
  2781. }
  2782. elseif (%t_pct > %ct_pct) {
  2783. var %dif = $calc(%t_pct - %ct_pct)
  2784. if (%teamwon == TERRORIST) {
  2785. var %d = 0.3 | while (%dif) && (%d < 2) { dec %won %d | inc %lost $calc(%d - $iif(%d > 1,0.3,0.2)) | inc %d $iif(%d > 1,0.1,0.3) | dec %dif }
  2786. }
  2787. else {
  2788. var %d = 0.2 | while (%dif) && (%d < 2) { inc %won %d | dec %lost $calc(%d - $iif(%d > 1,0.3,0.2)) | inc %d 0.3 | dec %dif }
  2789. }
  2790. }
  2791. var %i = 1, %points = $iif(%teamwon == CT,%won,%lost), %winloss = $iif(%teamwon == CT,Wins,Loss) | while ($ini($gfile(counter.ini),$1,%i)) {
  2792. var %id = $ifmatch | savelastid %id %gid
  2793. writeini -n $gfile(gatherstats.ini) %id played $calc($readini($gfile(gatherstats.ini),%id,played) +1)
  2794. writeini -n $gfile(gatherstats.ini) %id %winloss $calc($readini($gfile(gatherstats.ini),%id,%winloss) +1)
  2795. writeini -n $gfile(gatherids.ini) %gid %id Kills:0 Deaths:0 Assists:0 $+(Points:,%points) 1on1:0/0 1on2:0/0 1on3:0/0 1on4:0/0 1on5:0/0
  2796. givepoints %id %points
  2797. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) steamids %id %id }
  2798. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) steamids %id %id }
  2799. inc %i
  2800. }
  2801. var %i = 1, %points = $iif(%teamwon == TERRORIST,%won,%lost), %winloss = $iif(%teamwon == TERRORIST,Wins,Loss) | while ($ini($gfile(terrorist.ini),$1,%i)) {
  2802. var %id = $ifmatch | savelastid %id %gid
  2803. writeini -n $gfile(gatherstats.ini) %id played $calc($readini($gfile(gatherstats.ini),%id,played) +1)
  2804. writeini -n $gfile(gatherstats.ini) %id %winloss $calc($readini($gfile(gatherstats.ini),%id,%winloss) +1)
  2805. writeini -n $gfile(gatherids.ini) %gid %id Kills:0 Deaths:0 Assists:0 $+(Points:,%points) 1on1:0/0 1on2:0/0 1on3:0/0 1on4:0/0 1on5:0/0
  2806. givepoints %id %points
  2807. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) steamids %id %id }
  2808. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) steamids %id %id }
  2809. inc %i
  2810. }
  2811. if ($readini($gfile(gatherstatus.ini),info,ip) == $1) { remini -n $gfile(gatherstatus.ini) info }
  2812. if ($readini($gfile(gatherservers.ini),$1,status)) { remini -n $gfile(gatherservers.ini) $1 status }
  2813. if ($ini($gfile(gatherstatus.ini),$1)) { remini -n $gfile(gatherstatus.ini) $1 }
  2814. .timer [ $+ [ $+(*,$1,*) ] ] off | unset % [ $+ [ $+(*,$1,*) ] ] | .timer -o 1 1 gatherend $1 %gid
  2815. }
  2816. alias gatherend {
  2817. var %gid = $2, %motm = $readini($gfile(gatherids.ini),%gid,motm), %kd = $readini($gfile(gatherids.ini),%gid,bestkd), %notm = $readini($gfile(gatherids.ini),%gid,notm)
  2818. var %ct_p = $readini($gfile(gatherids.ini),%gid,CT), %t_p = $readini($gfile(gatherids.ini),%gid,TERRORIST), %leavers = $iif($readini($gfile(gatherids.ini),%gid,Leavers),$ifmatch,0)
  2819. var %teamwon = $readini($gfile(gatherids.ini),%gid,TeamWon), %score = $readini($gfile(gatherids.ini),%gid,Score)
  2820. if (%ct_p) && (%t_p) {
  2821. var %ct_pl, %i = 1 | while ($gettok(%ct_p,%i,32)) { var %s = $ifmatch, %p = $iif($gettok($gettok($readini($gfile(gatherids.ini),%gid,%s),4,32),2,58),$ifmatch,0), %p = $round(%p,2), %points = $iif(%p >= 0,$col(09,$+(+,%p)),$col(04,%p)), %ct_pl = $iif(%ct_pl,$+(%ct_pl,$chr(44))) $+($colnick(%s),$col(14,$chr(91)),%points,$col(14,$chr(93))) | inc %i }
  2822. var %t_pl, %i = 1 | while ($gettok(%t_p,%i,32)) { var %s = $ifmatch, %p = $iif($gettok($gettok($readini($gfile(gatherids.ini),%gid,%s),4,32),2,58),$ifmatch,0), %p = $round(%p,2), %points = $iif(%p >= 0,$col(09,$+(+,%p)),$col(04,%p)), %t_pl = $iif(%t_pl,$+(%t_pl,$chr(44))) $+($colnick(%s),$col(14,$chr(91)),%points,$col(14,$chr(93))) | inc %i }
  2823. }
  2824. var %leavers_pl, %i = 1 | while ($gettok(%leavers,%i,32)) { var %s = $ifmatch, %leavers_pl = $iif(%leavers_pl,$+(%leavers_pl,$chr(44))) $+($colnick(%s),$iif($gatherinfo(leavebans),$+($col(14,$chr(91)),$col(04,-39),$col(14,$chr(93))))) | inc %i }
  2825. if ($gatherinfo(php.exe)) && (%gid) { writeini -n $gfile($php.ini) gathers %gid %gid | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  2826. if ($gatherinfo(mysql.exe)) && (%gid) { writeini -n $gfile(upload.ini) gather gatherid %gid | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  2827. whatcmd $meorsay $mainchan $logo Gather on server $+($chr(35),$serverid($1)) ended (ID: %gid $+ ) $split $iif(%teamwon == Draw,Match ended $col(08,Draw),$iif(%teamwon == CT,Team $col(11,CT) won %score,Team $col(04,Terrorist) won %score)) $iif(%motm,$logo Man of the Match: $col(07,$anick(%motm))) $iif(%kd,$logo Best K/D: $col(07,$anick(%kd))) $iif(%notm,$logo Newb of the Match: $col(04,$anick(%notm))) $logo
  2828. if (%ct_pl) && (%t_pl) { whatcmd $meorsay $mainchan $logo $+($col(11,CT),:) %ct_pl $logo $+($col(04,T),:) %t_pl $logo $iif(%leavers_pl,$col(04,Leavers:) %leavers_pl $logo) }
  2829. if ($vtset($1)) { .timer -o 1 1 delete.vt $1 } | whatcmd unsetvar ignore | .timer -o 1 5 updaterank | whatcmd resetall $1 | whatcmd settopic
  2830. if ($gatherstatus(start)) && ($checkrematch) { var %id = $ifmatch | whatcmd rematch %id } | else { whatcmd unmute $mainchan }
  2831. playedup
  2832. }
  2833. alias gatherend_OLD {
  2834. var %gid = $2, %motm = $readini($gfile(gatherids.ini),%gid,motm), %kd = $readini($gfile(gatherids.ini),%gid,bestkd), %notm = $readini($gfile(gatherids.ini),%gid,notm)
  2835. var %ct_p = $readini($gfile(gatherids.ini),%gid,CT), %t_p = $readini($gfile(gatherids.ini),%gid,TERRORIST), %leavers = $iif($readini($gfile(gatherids.ini),%gid,Leavers),$ifmatch,0)
  2836. var %teamwon = $readini($gfile(gatherids.ini),%gid,TeamWon), %score = $readini($gfile(gatherids.ini),%gid,Score)
  2837. if (%ct_p) && (%t_p) {
  2838. var %ct_pl, %i = 1 | while ($gettok(%ct_p,%i,32)) { var %a = $ifmatch, %s = $gsteamid($+($chr(35),%a)), %p = $iif($gettok($gettok($readini($gfile(gatherids.ini),%gid,%s),4,32),2,58),$ifmatch,0), %p = $round(%p,2), %points = $iif(%p >= 0,$col(09,$+(+,%p)),$col(04,%p)), %ct_pl = $iif(%ct_pl,$+(%ct_pl,$chr(44))) $+($colnick(%s),$col(14,$chr(91)),%points,$col(14,$chr(93))) | inc %i }
  2839. var %t_pl, %i = 1 | while ($gettok(%t_p,%i,32)) { var %a = $ifmatch, %s = $gsteamid($+($chr(35),%a)), %p = $iif($gettok($gettok($readini($gfile(gatherids.ini),%gid,%s),4,32),2,58),$ifmatch,0), %p = $round(%p,2), %points = $iif(%p >= 0,$col(09,$+(+,%p)),$col(04,%p)), %t_pl = $iif(%t_pl,$+(%t_pl,$chr(44))) $+($colnick(%s),$col(14,$chr(91)),%points,$col(14,$chr(93))) | inc %i }
  2840. }
  2841. var %leavers_pl, %i = 1 | while ($gettok(%leavers,%i,32)) { var %s = $ifmatch, %leavers_pl = $iif(%leavers_pl,$+(%leavers_pl,$chr(44))) $+($colnick(%s),$iif($gatherinfo(leavebans),$+($col(14,$chr(91)),$col(04,-39),$col(14,$chr(93))))) | inc %i }
  2842. if ($gatherinfo(php.exe)) && (%gid) { writeini -n $gfile($php.ini) gathers %gid %gid | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  2843. if ($gatherinfo(mysql.exe)) && (%gid) { writeini -n $gfile(upload.ini) gather gatherid %gid | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  2844. whatcmd $meorsay $mainchan $logo Gather on server $+($chr(35),$serverid($1)) ended (ID: %gid $+ ) $split $iif(%teamwon == Draw,Match ended $col(08,Draw),$iif(%teamwon == CT,Team $col(11,CT) won %score,Team $col(04,Terrorist) won %score)) $iif(%motm,$logo Man of the Match: $col(07,$anick(%motm))) $iif(%kd,$logo Best K/D: $col(07,$anick(%kd))) $iif(%notm,$logo Newb of the Match: $col(04,$anick(%notm))) $logo
  2845. if (%ct_pl) && (%t_pl) { whatcmd $meorsay $mainchan $logo $+($col(11,CT),:) %ct_pl $logo $+($col(04,T),:) %t_pl $logo $iif(%leavers_pl,$col(04,Leavers:) %leavers_pl $logo) }
  2846. if ($vtset($1)) { .timer -o 1 1 delete.vt $1 } | whatcmd unsetvar ignore | .timer -o 1 5 updaterank
  2847. if ($gatherstatus(start)) && ($checkrematch) { var %id = $ifmatch | whatcmd rematch %id } | else { whatcmd unmute $mainchan }
  2848. }
  2849. alias unsetvar { if (% [ $+ [ $1 ] ]) { unset % [ $+ [ $1 ] ] } }
  2850. alias findnotm { var %i = 1, %notm | while (%i <= $line($1,0)) { var %x = $line($1,%i), %id = $gettok(%x,1,32), %p = $gettok(%x,2,32) | if (%p < %l) || (!%notm) { var %notm = %id, %l = %p } | inc %i } | return %notm }
  2851. alias skillhist {
  2852. var %p = $remove($1-,+), %i = 1, %points | while (%i <= $numtok(%p,32)) { var %x = $round($gettok(%p,%i,32),1), %n = $+($iif(%x < 0,04,10+),%x), %points = %points %n | inc %i }
  2853. return %points
  2854. }
  2855. alias givepoints {
  2856. if ($readini($gfile(gatherstats.ini),$1,points)) { var %points = $ifmatch } | else { var %points = 1000 }
  2857. var %lastpoints = $gatherstats($1,Lastpoints), %lastpoints = $iif($numtok(%lastpoints,32) > 39,$gettok(%lastpoints,2-,32),$iif(%lastpoints,$ifmatch)) $2
  2858. writeini -n $gfile(gatherstats.ini) $1 Points $calc(%points + $2) | writeini -n $gfile(gatherstats.ini) $1 Lastpoint $2 | writeini -n $gfile(gatherstats.ini) $1 Lastpoints %lastpoints
  2859. }
  2860. alias score {
  2861. if ($2 == total) { return $calc($iif($readini($gfile(score.ini),$1,antiterrorist),$ifmatch,0) + $iif($readini($gfile(score.ini),$1,terrorist),$ifmatch,0)) }
  2862. elseif ($2 == ct) { return $iif($readini($gfile(score.ini),$1,antiterrorist),$ifmatch,0) }
  2863. elseif ($2 == t) { return $iif($readini($gfile(score.ini),$1,terrorist),$ifmatch,0) }
  2864. elseif ($2 == reset) {
  2865. if ($readini($gfile(score.ini),$1,saved_ct)) || ($readini($gfile(score.ini),$1,saved_t)) {
  2866. var %t = $iif($readini($gfile(score.ini),$1,saved_t),$ifmatch,0), %ct = $iif($readini($gfile(score.ini),$1,saved_ct),$ifmatch,0)
  2867. writeini -n $gfile(score.ini) $1 terrorist %t | writeini -n $gfile(score.ini) $1 antiterrorist %ct
  2868. }
  2869. elseif ($ini($gfile(score.ini),$1)) { remini -n $gfile(score.ini) $1 }
  2870. }
  2871. elseif ($2 == switch) {
  2872. var %ct = $iif($readini($gfile(score.ini),$1,antiterrorist),$ifmatch,0), %t = $iif($readini($gfile(score.ini),$1,terrorist),$ifmatch,0)
  2873. writeini -n $gfile(score.ini) $1 terrorist %ct | writeini -n $gfile(score.ini) $1 antiterrorist %t | writeini -n $gfile(score.ini) $1 saved_t %ct | writeini -n $gfile(score.ini) $1 saved_ct %t
  2874. }
  2875. elseif ($2 == save) {
  2876. var %ct = $iif($readini($gfile(score.ini),$1,antiterrorist),$ifmatch,0), %t = $iif($readini($gfile(score.ini),$1,terrorist),$ifmatch,0) | writeini -n $gfile(score.ini) $1 saved_t %t | writeini -n $gfile(score.ini) $1 saved_ct %ct
  2877. }
  2878. elseif ($2 == inc) {
  2879. if ($3 == ct) { writeini -n $gfile(score.ini) $1 antiterrorist $calc($readini($gfile(score.ini),$1,antiterrorist) +1) } | elseif ($3 == t) { writeini -n $gfile(score.ini) $1 terrorist $calc($readini($gfile(score.ini),$1,terrorist) +1) }
  2880. var %ct = $iif($readini($gfile(score.ini),$1,antiterrorist),$ifmatch,0), %t = $iif($readini($gfile(score.ini),$1,terrorist),$ifmatch,0), %score = $calc(%ct + %t)
  2881. if (%score < 30) && (%ct != 16) && (%t != 16) && (%score != 15) && ((%score == 5) || (%score == 10) || (%score == 20) || (%score == 25) || (%ct == 15) || (%t == 15)) { .timerscore 1 1 rconsend $1 say [Reminder $+ $chr(93) CounterTerrorist: %ct - Terrorist: %t }
  2882. }
  2883. }
  2884. alias myip { if ($sock(myip)) { sockclose myip } | sockopen myip checkip.dyndns.org 80 }
  2885. on *:sockopen:myip:{
  2886. sockwrite -n $sockname GET /index.php HTTP/1.0
  2887. sockwrite -n $sockname Host: checkip.dyndns.org
  2888. sockwrite -n $sockname user-agent: Mozilla/??
  2889. sockwrite -n $sockname Connection: Keep-Alive
  2890. sockwrite -n $sockname $crlf
  2891. }
  2892. on *:sockread:myip:{
  2893. if ($sockerr > 0) return | :nextread | var %temp | sockread %temp | if ($sockbr == 0) return
  2894. if (*Current IP Address* iswm %temp) { var %z = $remove(%temp,<html><head><title>Current IP Check</title></head><body>Current IP Address:,</body></html>) | .localinfo $strip(%z %z) }
  2895. goto nextread
  2896. }
  2897. raw 473:*:{
  2898. ; $1 = $me ; $2 = $chan ; $3 = unable to join channel (invite only)
  2899. haltdef | echo -as $+($chr(91),$time,$chr(93)) Raw 473: $1-
  2900.  
  2901. if ($me ison $2) && (!%tmp.raw473) { set -z %tmp.raw473 30 | .timerqinvite 1 1 whatcmd msg $Qbot invite }
  2902. }
  2903. raw 477:*:{
  2904. ; $1 = $me ; $2 = $chan ; $3 = Cannot join channel (+r):
  2905. haltdef | echo -as $+($chr(91),$time,$chr(93)) Raw 477: $1-
  2906.  
  2907. if ($me ison $2) && (!%tmp.raw477) { set -z %tmp.raw477 30 | .timerauth 1 1 authme }
  2908. }
  2909. raw 442:*:{
  2910. ; $1 = $me ; $2 = $chan ; $3 = You're not on that channel
  2911. haltdef | echo -as $+($chr(91),$time,$chr(93)) Raw 442: $1-
  2912.  
  2913. if ($me ison $2) && (!%tmp.raw442) { set -z %tmp.raw442 30 | part $2 | .timerraw 1 1 raw join $2 | .timerqinvite 1 2 whatcmd msg $Qbot invite | .timer 1 3 gatherchans }
  2914. }
  2915. raw 404:*:{
  2916. ; $1 = $me ; $2 = $chan ; $3 = Cannot send to channel
  2917. haltdef | echo -as $+($chr(91),$time,$chr(93)) Raw 404: $1-
  2918.  
  2919. if ($me ison $2) && (!%tmp.raw404) { set -z %tmp.raw404 30 | part $2 | .timerraw 1 1 raw join $2 | .timerqinvite 1 2 whatcmd msg $Qbot invite | .timer 1 3 gatherchans }
  2920. }
  2921. raw 417:*:{ haltdef | echo -as $+($chr(91),$time,$chr(93)) Raw 417: Input line was too long }
  2922. raw 315:*:{ haltdef }
  2923. raw 354:*:{ haltdef | reguser $2 $3 }
  2924. raw 352:*:{ haltdef | reguser $6 $6 $8 }
  2925. alias reguser {
  2926. if ($network == GRNet) {
  2927. if ($3 != 0) {
  2928. if (($1 ison $mainchan) || ($1 ison $privchan) || ($1 ison $ownerchan)) && ($1 != $Qbot) && ($1 != S) && ($1 != $me) { var %sid = $gsteamid($+($chr(35),$2))
  2929. if ($read($gfile(authed.dat),s,$1)) { write -ds $+ $1 $gfile(authed.dat) }
  2930. if ($read($gfile(authed.dat),w,* $2 *)) { write -ds $+ $gettok($ifmatch,1,32) $gfile(authed.dat) }
  2931. if (%sid != 0) && ($read($gfile(authed.dat),w,* %sid)) { write -ds $+ $gettok($ifmatch,1,32) $gfile(authed.dat) } | write $gfile(authed.dat) $1 $2 %sid
  2932. if ($istok($headadmins,$2,32)) { return }
  2933. return
  2934. if ($admin($+($chr(35),$2)) >= 8) && ($1 !ison $privchan) && ($me isop $privchan) { ;invitebot $1 $privchan }
  2935. if ($admin($+($chr(35),$2)) >= 10) && ($1 !isop $mainchan) && ($me isop $mainchan) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +o $1 }
  2936. elseif ($admin($+($chr(35),$2)) >= 8) && ($1 isreg $mainchan) && ($me isop $mainchan) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +v $1 }
  2937. }
  2938. }
  2939. return
  2940. }
  2941. if ($network == Aitvaras) {
  2942. if (r isincs $3) {
  2943. if (($1 ison $mainchan) || ($1 ison $privchan) || ($1 ison $ownerchan)) && ($1 != $Qbot) && ($1 != S) && ($1 != $me) { var %sid = $gsteamid($+($chr(35),$2))
  2944. if ($read($gfile(authed.dat),s,$1)) { write -ds $+ $1 $gfile(authed.dat) }
  2945. if ($read($gfile(authed.dat),w,* $2 *)) { write -ds $+ $gettok($ifmatch,1,32) $gfile(authed.dat) }
  2946. if (%sid != 0) && ($read($gfile(authed.dat),w,* %sid)) { write -ds $+ $gettok($ifmatch,1,32) $gfile(authed.dat) } | write $gfile(authed.dat) $1 $2 %sid
  2947. if ($istok($headadmins,$2,32)) { return }
  2948. return
  2949. if ($admin($+($chr(35),$2)) >= 8) && ($1 !ison $privchan) && ($me isop $privchan) { ;invitebot $1 $privchan }
  2950. if ($admin($+($chr(35),$2)) >= 10) && ($1 !isop $mainchan) && ($me isop $mainchan) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +o $1 }
  2951. elseif ($admin($+($chr(35),$2)) >= 8) && ($1 isreg $mainchan) && ($me isop $mainchan) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +v $1 }
  2952. }
  2953. }
  2954. return
  2955. }
  2956. if ($2 != 0) {
  2957. if (($1 ison $mainchan) || ($1 ison $privchan) || ($1 ison $ownerchan)) && ($1 != $Qbot) && ($1 != S) && ($1 != $me) { var %sid = $gsteamid($+($chr(35),$2))
  2958. if ($read($gfile(authed.dat),s,$1)) { write -ds $+ $1 $gfile(authed.dat) }
  2959. if ($read($gfile(authed.dat),w,* $2 *)) { write -ds $+ $gettok($ifmatch,1,32) $gfile(authed.dat) }
  2960. if (%sid != 0) && ($read($gfile(authed.dat),w,* %sid)) { write -ds $+ $gettok($ifmatch,1,32) $gfile(authed.dat) } | write $gfile(authed.dat) $1 $2 %sid
  2961. if ($istok($headadmins,$2,32)) { return }
  2962. if ($admin($+($chr(35),$2)) >= 8) && ($1 !ison $privchan) && ($me isop $privchan) { ;invitebot $1 $privchan }
  2963. if ($admin($+($chr(35),$2)) >= 10) && ($1 !isop $mainchan) && ($me isop $mainchan) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +o $1 }
  2964. elseif ($admin($+($chr(35),$2)) >= 8) && ($1 isreg $mainchan) && ($me isop $mainchan) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +v $1 }
  2965. elseif (#cisgl.gotime2 == $mainchan) && ($1 isreg $mainchan) && ($me isop $mainchan) && ($read("D:\Gather\mIRC (CISGL.GOtime)\gatherbot\gatherusers.dat",s,$2)) {
  2966. ;;SPECIAL;;
  2967. var %sid = $ifmatch
  2968. if (STEAM_T:E:MP* !iswm %sid) { $iif($script(pushmode.mrc),pushmode -l,putmode) $mainchan +v $1 }
  2969. }
  2970. }
  2971. }
  2972. }
  2973. alias invitebot {
  2974. if ($me isop $2) && ($1 !ison $2) { whatcmd invite $1 $2 }
  2975. }
  2976. alias whatcmd { g.list $1- }
  2977. alias g.list {
  2978. var %w = @glist, %t = glist, %txt = 0, %map = 0
  2979. if (!$window(%w)) { window -ezk0 %w } | if ($1 != $null) { aline %w $1- }
  2980. if ((!$timer(%t)) || ($ctimer == %t)) && ($line(%w,1)) { tokenize 32 $ifmatch | var %s = $line(%w,0) | dline %w 1
  2981. if ($istok(describe msg notice cnotice cprivmsg,$remove($1,$chr(46)),32)) { var %txt = 1
  2982. if ($2 == $mainchan) { var %tt = $iif($me isop $mainchan,<@,$iif($me isreg $mainchan,<,<+)) | logchan $+(%tt,$me,>) $3- }
  2983. }
  2984. if (!$istok(describe msg notice mode chanmode cnotice cprivmsg aoe claoe unmute,$remove($1,$chr(46)),32)) { .timer $+ %t -m 1 500 g.list | inc -z %glist 1 }
  2985. elseif (#signfrag.* iswm $mainchan) {
  2986. var %n = $iif(%glist > 12,4,$iif(%glist,$iif(%glist <= 5,1,3.5),0)) | .timer $+ %t 1 %n g.list | inc -z %glist $iif(%glist > 12,6,5)
  2987. }
  2988. else { var %n = $iif(%glist > 12,3.5,$iif(%glist,$iif(%glist <= 5,$iif(%s > 1,1,0.5),3),0)) | .timer $+ %t 1 %n g.list | inc -z %glist $iif(%glist > 12,6,5) }
  2989. if (%txt) && ($len($3-) > 430) {
  2990. var %txt = $3-, %i = 10, %a = $gettok(%txt,1 - %i,32), %b, %c
  2991. if (* Map:* Players:* iswm %txt) { var %map = $gettok(%txt,2-5,32) }
  2992. if ($len($3-) > 825) {
  2993. while ($len(%a) < 390) { inc %i | var %a = $gettok(%txt,1 - %i,32) } | inc %i | var %z = $calc(%i +10), %b = $gettok(%txt,%i - %z,32)
  2994. while ($len(%b) < 375) { inc %z | var %b = $gettok(%txt,%i - %z,32) } | inc %z | var %c = $gettok(%txt,%z -,32)
  2995. g.list.exe $1 $2 %a $iif(%b,....)
  2996. if (%b) { g.list.exe $1 $2 $iif($gettok(%b,1,32) != $logo,$logo) %b $iif($numtok(%c,32) > 1,....,%c) }
  2997. if ($numtok(%c,32) > 1) { g.list.exe $1 $2 $iif($gettok(%c,1,32) != $logo,$logo) %c }
  2998. }
  2999. else {
  3000. while ($len(%a) < 390) { inc %i | var %a = $gettok(%txt,1 - %i,32) } | inc %i | var %b = $iif(%map,$ifmatch) $gettok(%txt,%i -,32)
  3001. g.list.exe $1 $2 %a $iif($numtok(%b,32) > 1,....,%b)
  3002. if ($numtok(%b,32) > 1) { g.list.exe $1 $2 $iif($gettok(%b,1,32) != $logo,$logo) %b }
  3003. }
  3004. }
  3005. else { g.list.exe $1 $2- }
  3006. }
  3007. }
  3008. alias g.list.exe {
  3009. if ($mainchan == #OBS) { [ $1 ] $strip($2-) | return }
  3010. [ $1 ] $2-
  3011. }
  3012.  
  3013. alias vtset { if ($readini($gfile(gatherservers.ini),$1,vt_ip)) && ($readini($gfile(gatherservers.ini),$1,vt_rcon)) && ($readini($gfile(gatherservers.ini),$1,vt_rcon) != n/a) && ($readini($gfile(gatherservers.ini),$1,voice) == Ventrilo) { return $true } | return $false }
  3014. alias vr { return " $+ $mircdir $+ ventrcon\ventrcon.exe" }
  3015. alias create.vt {
  3016. if ($vtset($1)) {
  3017. var %ct_pw = $+($rand(a,z),$rand(1,9)), %t_pw = $+($rand(a,z),$rand(1,9)) | writeini -n $gfile(gatherservers.ini) $1 vt_ct %ct_pw | writeini -n $gfile(gatherservers.ini) $1 vt_t %t_pw
  3018. var %pw = $readini($gfile(gatherservers.ini),$1,cs_pw), %vt_ip = $readini($gfile(gatherservers.ini),$1,vt_ip), %vt_rcon = $readini($gfile(gatherservers.ini),$1,vt_rcon), %vt_pass = $readini($gfile(gatherservers.ini),$1,vt_pw), %id = $serverid($1), %game = $gatherinfo(game), %room = " $+ %game Gather $+($chr(35),%id,")
  3019. write -c cmds.txt /chan delete %room | write cmds.txt /chan create %room %id "" %id $+("connect $1,;password %pw,")
  3020. write cmds.txt /subchan %room "Counter-Terrorist" 2 %ct_pw | write cmds.txt /subchan %room "Terrorist" 3 %t_pw
  3021. run $VR -w $iif(%vt_pass,$ifmatch,fp) -a %vt_rcon -t 1 -f cmds.txt %vt_ip
  3022. }
  3023. }
  3024. alias delete.vt {
  3025. if ($vtset($1)) {
  3026. var %vt_ip = $readini($gfile(gatherservers.ini),$1,vt_ip), %vt_rcon = $readini($gfile(gatherservers.ini),$1,vt_rcon), %vt_pass = $readini($gfile(gatherservers.ini),$1,vt_pw), %id = $serverid($1), %game = $gatherinfo(game), %room = " $+ %game Gather $+($chr(35),%id,")
  3027. write -c cmds.txt /chan delete %room | run $VR -w $iif(%vt_pass,$ifmatch,fp) -a %vt_rcon -f cmds.txt %vt_ip
  3028. }
  3029. }
  3030.  
  3031. ;;;;;;;;;;;;;;;;;;;;;;;SCHAT;;;;;;;;;;;;;;;;;;;;;;;;;
  3032.  
  3033. alias achat {
  3034. if (!$sock(achat2)) {
  3035. if ($1 isnum) { socklisten achat2 $1 } | else { socklisten achat2 }
  3036. schatecho $+($col(start),Now) listenning for connection on IP $iif($ip,$ifmatch,$iif($sock(achat2).ip,$ifmatch,n/a)) with Port $sock(achat2).port
  3037. }
  3038. else { schatecho $+($col(start),Now) listenning for connection on IP $iif($ip,$ifmatch,$iif($sock(achat2).ip,$ifmatch,n/a)) with Port $sock(achat2).port }
  3039. }
  3040. alias schataccept { var %schat = $1
  3041. if ($sock(%schat)) {
  3042. var %pw = $+($r(a,z),$r(1,9),$r(a,z),$r(1,9),$r(a,z),$r(1,9)) | schatsendto %schat $+($col(start),Use) "/msg $me .schatlogin $+(%pw,") to sign in, you got 60 sec.
  3043. .timer [ $+ [ %schat ] ] 1 60 schatclose %schat | set -u60 % [ $+ [ %pw ] ] %schat
  3044. }
  3045. elseif ($readini($gfile(gatherinfo.ini),schat,%sock)) { remini -n $gfile(gatherinfo.ini) schat %sock }
  3046. }
  3047. alias schatclose { var %schat = $1
  3048. if ($sock(%schat)) { schatsendto %schat $+($col(start),You) didnt make it, the connection is being closed! | sockclose %schat }
  3049. if ($gatherinfo(schat)) { schatsend $+($col(start),User) $col(14,$chr(40)) $+ Unknown $+ $col(14,$chr(41)) Disconnected. }
  3050. if ($readini($gfile(gatherinfo.ini),schat,%sock)) { remini -n $gfile(gatherinfo.ini) schat %sock }
  3051. }
  3052. on *:socklisten:achat2: {
  3053. var %sock = schat.1, %n = 2 | while ($sock(%sock)) { var %sock = $+(schat.,%n) | inc %n }
  3054. sockaccept %sock | writeini -n $gfile(gatherinfo.ini) schat %sock Unknown | .timer -o 1 2 schataccept %sock | schatsend $+($col(start),User) Connecting..
  3055. }
  3056. on *:sockclose:schat.*: {
  3057. var %sock = $sockname | schatsend $+($col(start),User) $col(14,$chr(40)) $+ $iif($readini($gfile(gatherinfo.ini),schat,%sock),$ifmatch,Unknown) $+ $col(14,$chr(41)) Disconnected | schaterase %sock
  3058. }
  3059. on *:sockread:schat.*: {
  3060. var %user = 0, %sock = $sockname, %schat | sockread %schat | schatecho %schat
  3061. if ($readini($gfile(gatherinfo.ini),schat,%sock)) { var %user = $ifmatch } | if (!%user) { sockclose %sock | return } | if (%user == Unknown) { return }
  3062. tokenize 32 $gettok(%schat,2-,32) | var %cmd = $cmd_ingame($1)
  3063. if ($1) { schatsendfrom $gettok(%schat,1,32) %user $1- }
  3064. if (%cmd != 0) {
  3065. if (%cmd == mastercmd) || (%cmd == onlysetbybenjimymaster) { $2- }
  3066. elseif (%cmd == schatusers) || (%cmd == users) {
  3067. var %i = 1, %u | while ($ini($gfile(gatherinfo.ini),schat,%i)) { var %y = $ifmatch, %x = $readini($gfile(gatherinfo.ini),schat,%y), %u = %u $split $+(%i,.) $gnick(%x) $+ $col(14,$chr(40)) $+ %x $+ $col(14,$chr(41)) | inc %i }
  3068. dec %i | schatsend $+($col(start),Users:) %i connected to Socket-chat %u
  3069. }
  3070. elseif ($2 != 0) && ($ini($gfile(gatherservers.ini),$2)) { var %ipp = $iif($2 isnum,$ini($gfile(gatherservers.ini),$2),$2), %idd = $serverid(%ipp)
  3071. if ($sock($+($srcon.prefix, %ipp))) { var %info = $1 $3- | tokenize 32 %info
  3072. if (%cmd == score) || (%cmd == status) { set -u5 %wscore. [ $+ [ %ipp ] ] 1 | rconsend %ipp say $+($chr(91),$gatherstatus(%ipp),$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t) }
  3073. elseif (%cmd == time) || (%cmd == thetime) { rconsend %ipp say Date&Time: $asctime($ctime) }
  3074. elseif (%cmd == teams) { set -u5 %teams. [ $+ [ %ipp ] ] 1 | queryteams %ipp }
  3075. elseif (%cmd == check) || (%cmd == checkjoin) || (%cmd == missing) { set -u5 %missing. [ $+ [ %ipp ] ] 1 | missing %ipp }
  3076. elseif (readylist* iswm %cmd) || (rdylist* iswm %cmd) || (%cmd == checkrdy) || (%cmd == checkready) {
  3077. if ($gatherstatus(%ipp) != Started) && ($gatherstatus(%ipp) != Round_End) {
  3078. set -u5 %ready. $+ %ipp 1 | var %i = 1, %x = 1, %m = $null
  3079. rconsend %ipp say Players still not ready to go: | while (%i <= $ini($gfile(players.ini),%ipp,0)) {
  3080. var %s = $ini($gfile(players.ini),%ipp,%i) | if (!$readini($gfile(ready.ini),%ipp,%s)) { var %m = $iif(%m,$+(%m,$chr(44))) $gnick(%s) | if ($len(%m) >= 18) { .timer -o 1 %x rconsend %ipp say %m | var %m = $null | inc %x } } | inc %i
  3081. }
  3082. if (%m) { .timer -o 1 %x rconsend %ipp say %m } | .timer -o 1 %x rconsend %ipp say Use: .ready -/- .unready
  3083. }
  3084. }
  3085. elseif (%cmd == whois) && ($2 != $null) && ($2 != 0) { set %whois. [ $+ [ %ipp ] ] $2- | rconsend %ipp status }
  3086. elseif (%cmd == rs) || (%cmd == restart) { ;rconsend %ipp sv_restart 1 }
  3087. elseif (%cmd == swapteams) { set -u3 %swapteams. [ $+ [ %ipp ] ] 1 | swapteams2 %ipp }
  3088. elseif (%cmd == seeksub) { set -u5 %needsub. [ $+ [ %ipp ] ] 1 | seeksub %ipp }
  3089. elseif (%cmd == needsub) { set -u5 %needsub. [ $+ [ %ipp ] ] 1 | needsub %ipp }
  3090. elseif (%cmd == endsub) || (%cmd == subend) { .endsub %ipp :gatherbot: }
  3091. elseif (%cmd == setmap) || (%cmd == changemap) || (%cmd == changelevel) {
  3092. if ($findmap($2)) {
  3093. var %map = $ifmatch | writeini -n $gfile(gatherstatus.ini) %ipp map %map
  3094. if ($workshop(%ipp,%map)) { var %x = $remove($ifmatch,workshop/) | rconsend %ipp host_workshop_map %x } | else { rconsend %ipp changelevel %map }
  3095. }
  3096. else { rconsend %ipp say $2 is not a valid map! }
  3097. }
  3098. elseif (%cmd == freeze) || (%cmd == freezetime) && ($2 isnum) { rconsend %ipp mp_freezetime $2 }
  3099. elseif (%cmd == pregame) || (%cmd == pre) && (!%spt. [ $+ [ %ipp ] ]) { set -u2 %spt. [ $+ [ %ipp ] ] 1 | pregame %ipp }
  3100. elseif (%cmd == tacs) && (!%spt. [ $+ [ %ipp ] ]) { set -u2 %spt. [ $+ [ %ipp ] ] 1 | tacs %ipp }
  3101. elseif (%cmd == start) && (!%spt. [ $+ [ %ipp ] ]) { set -u3 %spt. [ $+ [ %ipp ] ] 1 | start %ipp }
  3102. elseif (%cmd == adminstop) && (!%gatherstopped. [ $+ [ %ipp ] ]) { set -u10 %gatherstopped. [ $+ [ %ipp ] ] :gatherbot: | .stop %ipp }
  3103. elseif (%cmd == setscore) || (%cmd == updatescore) || (%cmd == newscore) { setscore %ipp $2- }
  3104. elseif (%cmd == say) && ($2 != $null) { rconsend %ipp say $+($gnick(%user),:) $2- }
  3105. elseif (%cmd == kick) && ($2 != $null) { set %kick. [ $+ [ %ipp ] ] :gatherbot: $2- | rconsend %ipp status }
  3106. elseif (%cmd == rcon) && ($2 != $null) { schatsendto %sock $+($col(start),Rcon:) $2- | rconsend %ipp $2- }
  3107. }
  3108. else { schatsendto %sock $+($col(start),There) is no connection to server $+($chr(35),%idd) }
  3109. }
  3110. else { schatsendto %sock $+($col(start),Error.) Use: .cmd <server:ID/IP> <rest of the cmd here> }
  3111. }
  3112. }
  3113. on *:input:@schat:{
  3114. if ($left($1,1) != $chr(47)) {
  3115. var %open = 0, %i = 1 | while ($ini($gfile(gatherinfo.ini),schat,%i)) { var %schat = $ifmatch, %user = $readini($gfile(gatherinfo.ini),schat,%schat)
  3116. if ($sock(%schat)) { if (%user) { var %open = 1 | sockwrite -n %schat $+(<,$me,>) $1- } | inc %i } | else { remini -n $gfile(gatherinfo.ini) schat %schat }
  3117. }
  3118. if (%open) { schatecho $+(<,$me,>) $1- } | else { schatecho 0,1<4Error0> No users are logged in }
  3119. }
  3120. }
  3121. alias schatsend {
  3122. if ($1) {
  3123. var %open = 0, %i = 1 | while ($ini($gfile(gatherinfo.ini),schat,%i)) { var %schat = $ifmatch, %user = $readini($gfile(gatherinfo.ini),schat,%schat)
  3124. if ($sock(%schat)) { if (%user != Unknown) { var %open = 1 | sockwrite -n %schat $+(<,$me,>) $1- } | inc %i } | else { remini -n $gfile(gatherinfo.ini) schat %schat }
  3125. }
  3126. if (%open) { schatecho $+(<,$me,>) $1- }
  3127. }
  3128. }
  3129. alias schatsendfrom {
  3130. if ($3) {
  3131. var %i = 1 | while ($ini($gfile(gatherinfo.ini),schat,%i)) { var %schat = $ifmatch, %user = $readini($gfile(gatherinfo.ini),schat,%schat)
  3132. if ($sock(%schat)) { if (%user != Unknown) && (%user != $2) { sockwrite -n %schat $1 $col(14,$chr(40)) $+ User: $2 $+ $col(14,$chr(41)) $+ : $3- } | inc %i } | else { schaterase %schat }
  3133. }
  3134. }
  3135. }
  3136. alias schatsendto { if ($sock($1)) { if ($2) { sockwrite -n $1 $+(<,$me,>) $2- | schatecho $+(<,$me,>) $2- } } | elseif ($readini($gfile(gatherinfo.ini),schat,$1)) { remini -n $gfile(gatherinfo.ini) schat $1 } }
  3137. alias schatecho { if ($1) { if (!$window(@Schat)) { window -ezk0 @Schat } | echo @Schat $time » $1- | window -g @Schat } }
  3138. alias schaterase { var %sock = $1
  3139. if ($sock(%sock)) { sockclose %sock }
  3140. if ($timer(%sock)) { .timer [ $+ [ %sock ] ] off }
  3141. if ($readini($gfile(gatherinfo.ini),schat,%sock)) { remini -n $gfile(gatherinfo.ini) schat %sock }
  3142. }
  3143. ;;;;;;;;;;;;;;;;;;;;;;;STATSBOT CLIENT;;;;;;;;;;;;;;;;;;;;;;;;;
  3144.  
  3145. on *:sockopen:statschat: {
  3146. if ($sockerr) { .timerstatschat -o 0 60 statschat }
  3147. }
  3148. on *:sockread:statschat: {
  3149. var %schat | sockread %schat
  3150. if ($gettok(%schat,1,32) == reload) { rload $ownerchan | .timer -o 1 1 echo -s $timestamp Scripts reloaded. }
  3151. }
  3152. alias statschat {
  3153. if (!$statscheck) && ($readini($gfile(gatherinfo.ini),modes,statschat)) {
  3154. var %info = $ifmatch, %ip = $gettok(%info,1,58), %port = $gettok(%info,2,58)
  3155. if (*?*.*?*.*?* !iswm %ip) { return }
  3156. if (%port !isnum) { var %port = 1337 }
  3157. if ($sock(statschat)) { sockclose statschat }
  3158. .timerstatschat -o 1 300 statschat | sockopen statschat %ip %port
  3159. }
  3160. }
  3161. alias statsend { if ($1-) && ($sock(statschat).status == active) { sockwrite -n statschat $1- } }
  3162. alias statscheck { if ($sock(statschat).status == active) { return $true } | return $false }
  3163. alias statsbot { if ($2-) { if ($statscheck) { statsend $meorsay $1 $2- } | else { whatcmd $meorsay $1 $2- } } }
  3164.  
  3165. ;;;;;;;;;;;;;;;;;;;;;;;HLTV;;;;;;;;;;;;;;;;;;;;;;;;;
  3166.  
  3167. alias hltvstart {
  3168. if ($sock(rconhltv. [ $+ [ $1 ] ])) { sockclose rconhltv. [ $+ [ $1 ] ] }
  3169. hltvchallenge $1
  3170. .timer -o 1 2 hltvcmd $1 connect
  3171. .timer -o 1 5 hltvcmd $1 record gatherid
  3172. }
  3173. alias hltvinfo {
  3174. var %ip = $iif($1 isnum,$ini($gfile(gatherservers.ini),$1),$1), %id = $iif($1 isnum,$1,$serverid(%ip))
  3175. if ($2 == port) { return $calc(9100 + %id) }
  3176. if ($2 == log) || ($2 == logport) { return $calc(9200 + %id) }
  3177. if ($2 == ip) { var %x = $iif($readini(gatherservers.ini,%ip,hltv_ip),$ifmatch,0) | if (myip == %x) { return $iif($ip,$ifmatch,0) } | return %x }
  3178. if ($2 == challenge) { return $iif($readini(gatherservers.ini,%ip,hltv_challenge),$ifmatch,0) }
  3179. if ($2 == rcon) { return $iif($readini(gatherservers.ini,%ip,hltv_rcon),$ifmatch,$iif($readini(gatherservers.ini,%ip,cs_rcon),$ifmatch,0)) }
  3180. if ($2 != $null) { return $iif($readini(gatherservers.ini,%ip,$2),$ifmatch,0) } | return 0
  3181. }
  3182. alias hltvchallenge { var %ip = $iif($1 isnum,$ini(gatherservers.ini,$1),$1)
  3183. .sockudp -nk rconhltv. $+ %ip $hltvinfo(%ip,log) $hltvinfo(%ip,ip) $hltvinfo(%ip,port) ÿÿÿÿchallenge rcon
  3184. }
  3185. alias hltvsend { var %ip = $iif($1 isnum,$ini(gatherservers.ini,$1),$1)
  3186. .sockudp -nk rconhltv. $+ %ip $hltvinfo(%ip,log) $hltvinfo(%ip,ip) $hltvinfo(%ip,port) ÿÿÿÿrcon $hltvinfo(%ip,challenge) $hltvinfo(%ip,rcon) $2-
  3187. }
  3188. alias hltvrcon { var %ip = $iif($1 isnum,$ini(gatherservers.ini,$1),$1) | h.list %ip hltvsend %ip $2- }
  3189.  
  3190. alias hltvcmd { var %ip = $iif($1 isnum,$ini(gatherservers.ini,$1),$1), %status = $gatherinfo(%ip,hltvstatus)
  3191. if ($2 == connect) { hltvrcon %ip connect %ip ;serverpassword $gatherinfo(%ip,cs_pw) }
  3192. elseif ($2 == disconnect) || ($2 == stop) { hltvrcon %ip stop }
  3193. elseif ($2 == record) { var %demo = $iif($3,$ifmatch,gatherid)
  3194. if ($readini(gatherservers.ini,%ip,hltv_stoprecord)) { remini -n gatherservers.ini %ip hltv_stoprecord }
  3195. writeini -n gatherservers.ini %ip hltv_record %demo | hltvrcon %ip record %demo | .timerhltvrecord. $+ %ip 1 3 hltvrcon %ip status
  3196. }
  3197. elseif ($2 == stoprecording) || ($2 == stoprecord) {
  3198. writeini -n gatherservers.ini %ip hltv_stoprecord $iif($3,$ifmatch,hltvdelete) | if ($4) { writeini -n gatherservers.ini %ip hltv_record $4 } | hltvrcon %ip stop | .timerhltvstop $+ %ip 1 2 hltvrcon %ip stop
  3199. }
  3200. else { h.list %ip hltvsend %ip $2- }
  3201. }
  3202. alias hltvecho { if (!$window(@HLTVLOG)) { window -ezk0 @HLTVLOG } | echo @HLTVLOG $1- }
  3203. alias hltvsave {
  3204. var %dir = $+(",$findfile($hltvdir,$1,1),"), %dem = $+($2,.dem), %newdir = $+(",$mircdirgatherdemo\,%dem,")
  3205. if (!$isdir($mircdirgatherdemo\)) { mkdir gatherdemo\ } | .rename %dir %newdir | .timer -o 1 2 winrar %dem
  3206. }
  3207. alias hltvsave2 {
  3208. var %dir = $+(",$findfile($hltvdir,$1,1),"), %dem = $+($2,.dem), %newdir = $+(",$mircdirgatherdemo\,%dem,")
  3209. if (!$isdir($mircdirgatherdemo\)) { mkdir gatherdemo\ } | .rename %dir %newdir | .timer -o 1 2 winrar %dem
  3210. }
  3211. alias hltvfailsave {
  3212. var %dir = $+(",$findfile($hltvdir,$1,1),"), %dem = $+($2,.dem), %newdir = $+(",$mircdirgatherdemo2\,%dem,")
  3213. if (!$isdir($mircdirgatherdemo2\)) { mkdir gatherdemo2\ } | .rename %dir %newdir | .timer -o 1 2 winrar2 %dem
  3214. }
  3215. alias hltvdelete { var %dir = $+(",$findfile($hltvdir,$1,1),") | if (%dir) { .remove -b %dir } }
  3216. alias h.list {
  3217. var %w = @hlist, %t = hlist, %s = $line(%w,0)
  3218. if (!$window(%w)) { window -ezk0 %w } | if ($2 != $null) { aline %w $1- } | if ($1 == stuck) { dline %w 1 }
  3219. if ((!$timer(%t)) || ($ctimer == %t)) && ($line(%w,1)) { tokenize 32 $ifmatch
  3220. if (%hltvchall. [ $+ [ $1 ] ]) { .timer $+ %t -m 1 200 h.list stuck | [ $2 ] $3- | dline %w 1 | .timer $+ %t -m 1 100 h.list } | else { set %h.list 1 | hltvchallenge $1 | .timer $+ %t 1 2 h.list stuck }
  3221. }
  3222. }
  3223. on *:udpread:rconhltv.*: {
  3224. if (!$window(@hltv)) { window -ezk0 @hltv }
  3225. :nextread
  3226. if ($sockerr > 0) { return }
  3227. var %ipp = $gettok($sockname,2-,46), %chall = $null
  3228. var %temp. [ $+ [ %ipp ] ] | sockread -f %temp. [ $+ [ %ipp ] ]
  3229. if ($sockbr == 0) { return }
  3230. if (%temp. [ $+ [ %ipp ] ]) { tokenize 32 $strip($remove(%temp. [ $+ [ %ipp ] ],ÿÿÿÿl,ÿÿÿÿ))
  3231. echo @hltv $chr(91) $+ $time $+ ][ $+($chr(35),$serverid(%ipp)) $chr(93) $1-
  3232. if (challenge rcon isin $1-) { var %chall = $3
  3233. if (%chall) {
  3234. writeini -n gatherservers.ini %ipp hltv_challenge %chall | set -u5 %hltvchall. [ $+ [ %ipp ] ] $time
  3235. if (%h.list) { unset %h.list | .timerhlist -m 1 200 h.list }
  3236. }
  3237. else { .timerhltvchall $+ %ipp 1 2 hltvchallenge %ipp }
  3238. }
  3239. if (Recording initialized isin $1-) {
  3240. if ($timer(rec [ $+ [ %ipp ] ])) { .timerrec [ $+ [ %ipp ] ] off } | if ($timer(record [ $+ [ %ipp ] ])) { .timerrecord [ $+ [ %ipp ] ] off } | goto nextread
  3241. }
  3242. if (Already recording isin $1-) {
  3243. if ($timer(rec [ $+ [ %ipp ] ])) { .timerrec [ $+ [ %ipp ] ] off } | if ($timer(record [ $+ [ %ipp ] ])) { .timerrecord [ $+ [ %ipp ] ] off } | goto nextread
  3244. }
  3245. if (Completed demo isin $1-) { var %demo = $left($3,-1)
  3246. if ($timer(hltvstop [ $+ [ %ipp ] ])) { .timerhltvstop [ $+ [ %ipp ] ] off }
  3247. if ($readini(gatherservers.ini,%ipp,hltv_stoprecord)) { var %type = $ifmatch | remini -n gatherservers.ini %ipp hltv_stoprecord
  3248. if ($readini(gatherservers.ini,%ipp,hltv_record)) { var %dem = $ifmatch
  3249. remini -n gatherservers.ini %ipp hltv_record | [ %type ] $iif(%type == hltvsave,%demo %dem,%demo)
  3250. }
  3251. else { [ %type ] $iif(%type == hltvsave,%demo,) $remove(%demo,.dem) }
  3252. }
  3253. elseif ($readini(gatherservers.ini,%ipp,hltv_record)) { hltvcmd %ipp record $ifmatch | hltvfailsave %demo $remove(%demo,.dem) } | else { hltvfailsave %demo $remove(%demo,.dem) }
  3254. goto nextread
  3255. }
  3256. if (HLTV Status isin $1-) { set -u2 %hltvstatus. [ $+ [ %ipp ] ] 1 | goto nextread }
  3257. if (Local IP isin $1-) && (%hltvstatus. [ $+ [ %ipp ] ]) { writeini -n $gfile(gatherstatus.ini) %ipp hltvip $remove($3,$chr(44)) | goto nextread }
  3258. if (Not connected isin $1-) && (%hltvstatus. [ $+ [ %ipp ] ]) {
  3259. if ($serverstatus(%ipp,clean) != Free) && ($readini(gatherservers.ini,%ipp,hltv_record)) && (!$readini(gatherservers.ini,%ipp,hltv_stoprecord)) { hltvcmd %ipp connect | .timerstatus $+ %ipp 1 2 hltvrcon %ipp status } | goto nextread
  3260. }
  3261. if ((Connected to Game Server isin $1-) || (Connected to HLTV Proxy isin $1-)) && (%hltvstatus. [ $+ [ %ipp ] ]) {
  3262. if ($serverstatus(%ipp,clean) != Free) && (!$readini(gatherservers.ini,%ipp,hltv_stoprecord)) && ($readini(gatherservers.ini,%ipp,hltv_record)) {
  3263. .timerrec $+ %ipp 1 1 hltvrcon %ipp record $ifmatch
  3264. if (!$readini(gatherstatus.ini,%ipp,hltv)) && ($readini(gatherstatus.ini,%ipp,hltvip)) { var %hltvip = $ifmatch
  3265. writeini -n $gfile(gatherstatus.ini) %ipp hltv $time | whatcmd msg $mainchan $logo LIVE: Du kan nu følge med i gatheren på server $+($chr(35),$serverid(%ipp)) $logo HLTV: connect %hltvip $logo
  3266. }
  3267. }
  3268. else { hltvrcon %ipp stop }
  3269. .timerrecord $+ %ipp 1 2 hltvrcon %ipp status | goto nextread
  3270. }
  3271. if (Recording to isin $1-) && (%hltvstatus. [ $+ [ %ipp ] ]) {
  3272. if ($timer(rec [ $+ [ %ipp ] ])) { .timerrec [ $+ [ %ipp ] ] off } | if ($timer(record [ $+ [ %ipp ] ])) { .timerrecord [ $+ [ %ipp ] ] off }
  3273. if ($readini(gatherservers.ini,%ipp,hltv_record)) && ($readini(gatherservers.ini,%ipp,hltv_stoprecord)) { .timer -o 1 1 hltvrcon %ipp stop }
  3274. elseif (!$readini(gatherservers.ini,%ipp,hltv_record)) { .timer -o 1 1 hltvrcon %ipp stop } | unset %hltvstatus. [ $+ [ %ipp ] ] | goto nextread
  3275. }
  3276. }
  3277. goto nextread
  3278. }
  3279.  
  3280. ;;;;;;;;;;;;;;;;;;;;;;;STATSBOT;;;;;;;;;;;;;;;;;;;;;;;;;
  3281.  
  3282. alias statsclient {
  3283.  
  3284. on *:socklisten:statschat: { var %sock = statschat.1, %n = 2 | while ($sock(%sock)) { var %sock = $+(statschat.,%n) | inc %n } | sockaccept %sock }
  3285. on *:sockclose:statschat.*: { .timer -o 1 0 statserase $sockname }
  3286. on *:sockread:statschat.*: {
  3287. var %sockname = $sockname, %schat | sockread %schat
  3288. if (%schat) { tokenize 32 %schat | if ($3-) && ($me ison $2 || $comchan($2,0)) { [ $1 ] $2 $3- } }
  3289. }
  3290. alias statschat {
  3291. if (!$sock(statschat)) { var %port = $iif($1 isnum,$calc($1 +1),1337) | if (%port < 1350) { .timerag 1 0 statschat %port } | socklisten statschat %port | .timerag off }
  3292. }
  3293. alias statsall { if ($1-) { var %i = 1 | while ($sock(*,%i)) { var %sockname = $ifmatch | if (statschat.* iswm %sockname) && ($sock(%sockname).status == active) { sockwrite -n %sockname $2- } | inc %i } } }
  3294. alias statsend { if ($2-) && ($sock($1).status == active) { sockwrite -n $1 $2- } }
  3295. alias statserase { var %sock = $iif($1,$1,statschat*)
  3296. if ($sock(%sock)) { sockclose %sock }
  3297. if ($timer(%sock)) { .timer [ $+ [ %sock ] ] off }
  3298. }
  3299.  
  3300. }
  3301.  
  3302. ;; START/STOP SERVER SOCKETS ;;
  3303.  
  3304. on *:sockopen:startserver.*:{
  3305. var %ip = $gettok($sockname,2-,46)
  3306. echo -s $timestamp $+($chr(35),$serverid(%ip),:) Sockopen.
  3307. var %link = $cleanlink($readini($gfile(gatherservers.ini),%ip,startlink)), %host = $gettok(%link,1,47), %get = $+(/,$gettok(%link,2-,47))
  3308. .sockwrite -n $sockname GET %get HTTP/1.1
  3309. .sockwrite -n $sockname Host: %host
  3310. .sockwrite -n $sockname $crlf
  3311. if ($timer(startserver. [ $+ [ %ip ] ])) { .timerstartserver. [ $+ [ %ip ] ] off }
  3312. .timerrconlast. [ $+ [ %ip ] ] 1 60 rconlast %ip
  3313. }
  3314. on *:sockread:startserver.*:{
  3315. var %ip = $gettok($sockname,2-,46)
  3316. if ($sockerr) { echo -s 4SOCKERR on $sockname | return }
  3317. var %sock | .sockread -f %sock
  3318. if (%sock) {
  3319. echo -s $timestamp $+($chr(35),$serverid(%ip),:) %sock
  3320. if ($timer(startserver. [ $+ [ %ip ] ])) { .timerstartserver. [ $+ [ %ip ] ] off }
  3321. .timerrconlast. [ $+ [ %ip ] ] 1 20 rconlast %ip
  3322. }
  3323. }
  3324. on *:sockclose:startserver.*:{
  3325. var %ip = $gettok($sockname,2-,46)
  3326. echo -s $timestamp $+($chr(35),$serverid(%ip),:) Sockclose.
  3327. if ($timer(startserver. [ $+ [ %ip ] ])) { .timerstartserver. [ $+ [ %ip ] ] off }
  3328. .timerrconlast. [ $+ [ %ip ] ] 1 15 rconlast %ip
  3329. }
  3330. alias startserver {
  3331. if ($readini($gfile(gatherservers.ini),$1,startlink)) {
  3332. var %link = $cleanlink($ifmatch), %host = $gettok(%link,1,47), %get = $+(/,$gettok(%link,2-,47))
  3333. if (!$sock(startserver. [ $+ [ $1 ] ])) { .sockopen $iif(#go.ee == $mainchan,-e) startserver. [ $+ [ $1 ] ] %host $iif(#go.ee == $mainchan,443,80) }
  3334. }
  3335. }
  3336. alias startlink {
  3337. if ($readini($gfile(gatherservers.ini),$1,startlink)) {
  3338. var %link = $cleanlink($ifmatch), %host = $gettok(%link,1,47), %get = $+(/,$gettok(%link,2-,47))
  3339. if (!$sock(startserver. [ $+ [ $1 ] ])) {
  3340. if (!$timer(startserver. [ $+ [ $1 ] ])) { .timerstartserver. [ $+ [ $1 ] ] 1 10 startlink $1 }
  3341. .timerrconlast. [ $+ [ $1 ] ] 1 20 rconlast $1
  3342. .sockopen $iif(#go.ee == $mainchan,-e) startserver. [ $+ [ $1 ] ] %host $iif(#go.ee == $mainchan,443,80)
  3343. }
  3344. }
  3345. else {
  3346. resetall $1 | writeini -n $gfile(gatherservers.ini) $1 error No Response | whatcmd $meorsay $mainchan $logo Couldnt connect to server $+($chr(35),$serverid($1)) $+ , the gather is therefore stopped! $logo
  3347. }
  3348. }
  3349. alias cleanlink {
  3350. return $remove($1-,http://,https://,www.)
  3351. }
  3352.  
  3353. ;##### ONLY CS GO PART #####;
  3354.  
  3355. alias rconlast {
  3356. if (!$serverinuse($1)) { return }
  3357. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3358. .timerretry. $+ $1 1 10 rconretry $1 | set %retry. [ $+ [ $1 ] ] 2
  3359. writeini -n $gfile(gatherstatus.ini) $1 startlink $ctime | sourcercon $replace($1,$chr(58),$chr(32))
  3360. }
  3361. alias rconstart {
  3362. var %rconsocket = $+($srcon.prefix, $1), %logsocket = $+($log.prefix, $1)
  3363.  
  3364. ;;writeini -n $gfile(gatherstatus.ini) $1 error $ctime
  3365.  
  3366. if ($sock(%rconsocket)) { sockclose %rconsocket }
  3367. if ($sock(%logsocket)) { sockclose %logsocket }
  3368. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3369. if ($2 == startup) { set %startup. [ $+ [ $1 ] ] 1 }
  3370. set %retry. [ $+ [ $1 ] ] 1 | .timerretry. $+ $1 1 10 rconretry $1 | sourcercon $replace($1,$chr(58),$chr(32))
  3371. }
  3372. alias rconretry {
  3373. if (!$serverinuse($1)) { return }
  3374. var %rconsocket = $+($srcon.prefix, $1)
  3375. if ($readini($gfile(gatherservers.ini),$1,status) == Ended) { return }
  3376. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3377. if (%retry. [ $+ [ $1 ] ]) {
  3378. if (%retry. [ $+ [ $1 ] ] > 2) {
  3379. if ($readini($gfile(gatherstatus.ini),$1,startlink)) || (!$readini($gfile(gatherservers.ini),$1,startlink)) {
  3380. ;resetall $1 | ;writeini -n $gfile(gatherservers.ini) $1 error No Response | ;whatcmd $meorsay $mainchan $logo Couldnt connect to server $+($chr(35),$serverid($1)) $+ , the gather is therefore stopped! $logo
  3381. if ($vtset($1)) { ;.timer -o 1 1 delete.vt $1 }
  3382.  
  3383. writeini -n $gfile(gatherstatus.ini) $1 error $ctime | remini -n $gfile(score.ini) $1
  3384. whatcmd $meorsay $mainchan $logo Connection to server $+($chr(35),$serverid($1)) have been lost, game can be resulted with .result [win/lost] or aborted with .abortgame $logo
  3385. }
  3386. else {
  3387. unset %retry. [ $+ [ $1 ] ] | startlink $1
  3388. }
  3389. }
  3390. else {
  3391. if ($sock(%rconsocket)) { sockclose %rconsocket }
  3392. .timerretry. $+ $1 1 10 rconretry $1 | sourcercon $replace($1,$chr(58),$chr(32))
  3393. }
  3394. inc %retry. [ $+ [ $1 ] ]
  3395. }
  3396. elseif (%nodata. [ $+ [ $1 ] ]) { whatcmd $meorsay $privchan $logo Reconnected to server $serverid($1) $logo | unset %nodata. [ $+ [ $1 ] ] }
  3397. }
  3398. alias challenge {
  3399. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3400. var %ip = $iif($1 isnum,$ini($gfile(gatherservers.ini),$1),$1) | sourcercon $replace(%ip,$chr(58),$chr(32))
  3401. }
  3402. alias rconsayscript {
  3403. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3404. rconlogstart $1
  3405. }
  3406. alias rconsayscript2 {
  3407. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3408. rconlogstart2 $1
  3409. }
  3410. alias rconset {
  3411. if (!$serverinuse($1)) { return }
  3412. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3413. if (%startup. [ $+ [ $1 ] ]) {
  3414. unset %startup. [ $+ [ $1 ] ]
  3415. if ($readini($gfile(gatherstatus.ini),$1,map)) {
  3416. var %map = $ifmatch
  3417. if ($workshop($1,%map)) { var %x = $remove($ifmatch,workshop/) | rconsend $1 host_workshop_map %x } | else { rconsend $1 changelevel %map }
  3418. }
  3419. .timerrecheck. [ $+ [ $1 ] ] 1 3 rechecksocket $1 | .timer -o 1 5 rconset $1 | return
  3420. }
  3421. rconsetpw $1 | .timer -o 1 3 pregame $1
  3422. }
  3423. alias rconadv {
  3424. if (!$serverinuse($1)) { return }
  3425. if ($readini($gfile(gatherservers.ini),$1,status) == Ended) { return }
  3426. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3427. if ($sock($+($srcon.prefix, $1))) {
  3428. rconsetpw $1 | if ($network == QuakeNet) { ;rconsend $1 say Get your CS Gather bot from #OBS @ QuakeNet. }
  3429. }
  3430. elseif ($timer($1)) { .timer $+ $1 off }
  3431. }
  3432. alias rconsetpw {
  3433. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3434. rconsend $1 sv_password $iif($readini($gfile(gatherservers.ini),$1,cs_pw),$ifmatch,"")
  3435. }
  3436. alias keepalive {
  3437. if (!$serverinuse($1)) { return }
  3438. if ($readini($gfile(gatherservers.ini),$1,status) == Ended) { return }
  3439. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3440. if ($sock($+($srcon.prefix, $1))) { rconsend $1 echo Keep connection alive.. | .timerrecheck. [ $+ [ $1 ] ] 1 2 rechecksocket $1 }
  3441. elseif ($serverinuse($1)) {
  3442. if (!%retry. [ $+ [ $1 ] ]) { set %retry. [ $+ [ $1 ] ] 1 }
  3443. .timerretry. $+ $1 1 10 rconretry $1 | sourcercon $replace($1,$chr(58),$chr(32))
  3444. }
  3445. elseif ($timer(keepalive. [ $+ [ $1 ] ])) { .timerkeepalive. [ $+ [ $1 ] ] off }
  3446. }
  3447.  
  3448.  
  3449. alias rconsend {
  3450. var %rconsocket = $+($srcon.prefix, $1), %logsocket = $+($log.prefix, $1)
  3451. if (!$sock(%rconsocket)) {
  3452. if ($sock(%logsocket)) { sockclose %logsocket }
  3453. srcon_echo $1 04 $time * Error: Socket is dead. $+($chr(40),Cmd: $2-,$chr(41))
  3454. return
  3455. }
  3456. if ($sock(%rconsocket).status != active) { .timer -o 1 1 rconsend $1- | return }
  3457. inc %srcon.id. $+ %rconsocket
  3458. srcon.getrequest &srcon.cmd %srcon.id. [ $+ [ %rconsocket ] ] $srcon.req.execcmd $2-
  3459. if ($2 != echo) { srcon_echo $1 $time -> $2- }
  3460. if ($2 == changelevel) { .timerrecheck. [ $+ [ $1 ] ] 1 3 rechecksocket $1 }
  3461. sockwrite %rconsocket &srcon.cmd
  3462. }
  3463.  
  3464. alias cfgfolder {
  3465. var %folder = $readini($gfile(gatherservers.ini),$1,cfgfolder), %i = 1, %result
  3466. if (!%folder) { var %folder = $readini($gfile(gatherinfo.ini),global,cfgfolder) }
  3467. if (!%folder) { return }
  3468. while ($gettok(%folder,%i,47)) { var %x = $ifmatch, %result = $+(%result,%x,/) | inc %i }
  3469. return %result
  3470. }
  3471. alias workshop {
  3472. var %workshop = $readini($gfile(gatherservers.ini),$1,$2)
  3473. if (!%workshop) { var %workshop = $readini($gfile(gatherinfo.ini),global,$2) }
  3474. return %workshop
  3475. }
  3476. alias startkick { set -u10 %startkick. [ $+ [ $1 ] ] 1 | rconsend $1 status }
  3477. alias endkick { set -u10 %endkick. [ $+ [ $1 ] ] 1 | rconsend $1 status }
  3478. alias start_only { var %gamestats = $gamestatsini($1) | if ($score($1,total) <= 2) && ($ini(%gamestats,0)) { .remove %gamestats } | if ($ini($gfile(ready.ini),$1)) { remini -n $gfile(ready.ini) $1 } | .score $1 reset | set -u10 %gatherhold. [ $+ [ $1 ] ] 1 | writeini -n $gfile(gatherservers.ini) $1 status Started }
  3479. alias start { var %gamestats = $gamestatsini($1) | if ($score($1,total) <= 2) && ($ini(%gamestats,0)) { .remove %gamestats } | if ($ini($gfile(ready.ini),$1)) { remini -n $gfile(ready.ini) $1 } | .score $1 reset | set -u10 %gatherhold. [ $+ [ $1 ] ] 1 | writeini -n $gfile(gatherservers.ini) $1 status Started | startgame $1 }
  3480. alias startgame {
  3481. rconsend $1 say Starting game..
  3482. var %cfgfolder = $cfgfolder($1)
  3483. if ($score($1,total) < 30) {
  3484. if ($gatherinfo(gotv)) {
  3485. var %start = $readini($gfile(gatherstatus.ini),$1,start_time), %name = $+($replace($gettok(%start,1,32),/,-),_,$remove($gettok(%start,2,32),:),_,$readini($gfile(gatherstatus.ini),$1,map))
  3486. rconsend $1 tv_stoprecord | rconsend $1 tv_record %name
  3487. }
  3488. var %slots = $readini($gfile(gatherstatus.ini),$1,slots)
  3489. if (%slots == 2) && ($readini($gfile(gatherservers.ini),$1,alias_1v1)) {
  3490. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3491. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3492. rconsend $1 %alias | return
  3493. }
  3494. if (%slots == 2) && ($readini($gfile(gatherinfo.ini),global,alias_1v1)) {
  3495. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3496. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3497. rconsend $1 %alias | return
  3498. }
  3499. if ($readini($gfile(gatherservers.ini),$1,alias_mr15)) {
  3500. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3501. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3502. rconsend $1 %alias | return
  3503. }
  3504. if ($readini($gfile(gatherinfo.ini),global,alias_mr15)) {
  3505. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3506. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3507. rconsend $1 %alias | return
  3508. }
  3509. rconsend $1 exec $+(%cfgfolder,mr15.cfg)
  3510. }
  3511. else {
  3512. if ($readini($gfile(gatherservers.ini),$1,alias_mr3)) {
  3513. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3514. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3515. rconsend $1 %alias | return
  3516. }
  3517. if ($readini($gfile(gatherinfo.ini),global,alias_mr3)) {
  3518. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3519. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3520. rconsend $1 %alias | return
  3521. }
  3522. rconsend $1 exec $+(%cfgfolder,mr3.cfg)
  3523. }
  3524. }
  3525. alias pregame { .score $1 reset | writeini -n $gfile(gatherservers.ini) $1 status Pregame | warmup $1 }
  3526. alias warmup {
  3527. rconsend $1 say Setting pregame..
  3528. var %cfgfolder = $cfgfolder($1)
  3529. if ($readini($gfile(gatherservers.ini),$1,alias_pregame)) {
  3530. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3531. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3532. rconsend $1 %alias | return
  3533. }
  3534. if ($readini($gfile(gatherinfo.ini),global,alias_pregame)) {
  3535. var %alias = $ifmatch, %gettok = $gettok(%alias,-1,32)
  3536. if (%cfgfolder) && (*.cfg iswm %gettok) && (%cfgfolder != $mid(%gettok,1,$len(%cfgfolder))) { var %numtok = $numtok(%alias,32), %alias = $gettok(%alias,1 - $calc(%numtok -1),32) $+(%cfgfolder,%gettok) }
  3537. rconsend $1 %alias | return
  3538. }
  3539. ;;SPECIAL;;
  3540. if (#gatherzone == $mainchan) { rconsend $1 exec test.cfg | return }
  3541. rconsend $1 exec $+(%cfgfolder,pregame.cfg)
  3542. }
  3543. alias tacs { .score $1 reset | writeini -n $gfile(gatherservers.ini) $1 status Tacs | rconsend $1 mp_freezetime 60 | rconsend $1 mp_restartgame 2 | rconsend $1 say Tacs settings loaded! }
  3544.  
  3545. alias rechecksocket {
  3546. if (!$serverinuse($1)) { return }
  3547. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3548. var %rconsocket = $+($srcon.prefix, $1), %logsocket = $+($log.prefix, $1)
  3549. if (!$sock(%rconsocket)) {
  3550. if ($sock(%logsocket)) { sockclose %logsocket }
  3551. if (!%rechecksocket. [ $+ [ $1 ] ]) { set -u5 %rechecksocket. [ $+ [ $1 ] ] 1 | .timerrecheck. [ $+ [ $1 ] ] 1 2 rechecksocket $1 | sourcercon $replace($1,$chr(58),$chr(32)) }
  3552. else { set %retry. [ $+ [ $1 ] ] 1 | .timerretry. $+ $1 1 10 rconretry $1 | sourcercon $replace($1,$chr(58),$chr(32)) }
  3553. }
  3554. elseif (!$sock(%logsocket)) { .timerlogstart. [ $+ [ $1 ] ] 1 1 rconlogstart $1 }
  3555. }
  3556. alias rconlogstart { set -u2 %logstart. [ $+ [ $1 ] ] 1 | rconlogstart2 $1 }
  3557. alias rconlogstart2 {
  3558. var %ipp = $1, %rconsocket = $+($srcon.prefix, $1), %logsocket = $+($log.prefix, $1)
  3559. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3560. if ($sock(%rconsocket)) {
  3561. if ($sock(%logsocket)) { sockclose %logsocket }
  3562. sockudp -k %logsocket
  3563. var %port = $iif($sock(%logsocket).port,$ifmatch,$+(100,$rand(1,9),$rand(1,9)))
  3564. rconsend %ipp logaddress_delall | rconsend %ipp logaddress_add $+($ip,:,%port)
  3565. if (%startup. [ $+ [ %ipp ] ]) { rconsend %ipp log on | .timer -o 1 2 rconset %ipp } | else { rconsend %ipp log }
  3566. set -u10 %check. [ $+ [ %ipp ] ] 1 | .timer -o 1 1 rconsend %ipp status
  3567. }
  3568. elseif ($sock(%logsocket)) { sockclose %logsocket }
  3569. }
  3570. alias logcheck {
  3571. var %ipp = $1, %logsocket = $+($log.prefix,%ipp), %rconsocket = $+($srcon.prefix,%ipp)
  3572. if ($readini($gfile(gatherstatus.ini),$1,error)) { return }
  3573. if ($sock(%rconsocket)) { .timerlogstart. [ $+ [ %ipp ] ] 1 0 rconlogstart %ipp } | elseif ($sock(%logsocket)) { sockclose %logsocket }
  3574. }
  3575. alias getwep { return $gettok($gettok($1-,5,34),1,60) }
  3576. alias getkill {
  3577. if (*headshot* iswm $remove($gettok($1-,2,40),$chr(41))) { return Headshot }
  3578. return Normal
  3579. }
  3580.  
  3581. alias sourcercon {
  3582. if ($2 !isnum 1-65536) { echo -ag Invalid parameters. | return }
  3583. .myip | var %ipp = $+($1,:,$2), %sockname = $+($srcon.prefix,%ipp), %rcon = $iif($3,$ifmatch,$readini($gfile(gatherservers.ini),%ipp,cs_rcon))
  3584. if ($sock(%sockname)) { sockclose %sockname | unset %rcon.id. [ $+ [ %sockname ] ] }
  3585. srcon_echo %ipp 12 CS RCON control window. Establishing the connection to server %ipp $+ $chr(44) please wait...!
  3586. sockopen %sockname $1 $2 | sockmark %sockname %rcon
  3587. }
  3588. alias -l log.prefix { return SRcon.log. }
  3589. alias -l srcon.prefix { return SRcon. }
  3590. alias -l srcon.req.execcmd { return 2 }
  3591. alias -l srcon.req.auth { return 3 }
  3592. alias -l srcon.res.cmd { return 0 }
  3593. alias -l srcon.res.auth { return 2 }
  3594. alias -l srcon.inttobytes {
  3595. tokenize 46 $longip($1)
  3596. return $4 $3 $2 $1
  3597. }
  3598. alias -l srcon.getrequest {
  3599. bunset $1
  3600. bset $1 5 $srcon.inttobytes($2)
  3601. bset $1 9 $srcon.inttobytes($3)
  3602. bset -t $1 13 $4-
  3603. bset $1 $calc($bvar($1,0) + 1) 00 00
  3604. bset $1 1 $srcon.inttobytes($calc($bvar($1, 0) - 4))
  3605. }
  3606. alias -l srcon.clear {
  3607. var %ipp = $remove($1,$srcon.prefix,$log.prefix), %srcon = $+($srcon.prefix,%ipp), %log = $+($log.prefix,%ipp)
  3608. if ($sock(%srcon)) {
  3609. if ($gatherinfo(cooldown)) { writeini -n $gfile(gatherservers.ini) %ipp cooldown $calc($ctime +90) }
  3610. if ($gatherinfo(gotv)) { rconsend %ipp tv_stoprecord }
  3611. rconsend %ipp logaddress_delall | .timer -o 1 2 sockclose %srcon | unset %rcon.id. [ $+ [ %srcon ] ]
  3612. }
  3613. if ($sock(%log)) { .timer -o 1 2 sockclose %log }
  3614. }
  3615. alias server.clear {
  3616. var %ipp = $remove($1,$srcon.prefix,$log.prefix), %srcon = $+($srcon.prefix,%ipp), %log = $+($log.prefix,%ipp)
  3617. if ($sock(%srcon)) {
  3618. if ($gatherinfo(cooldown)) { writeini -n $gfile(gatherservers.ini) %ipp cooldown $calc($ctime +90) }
  3619. if ($gatherinfo(gotv)) { rconsend %ipp tv_stoprecord }
  3620. rconsend %ipp logaddress_delall | .timer -o 1 2 sockclose %srcon | unset %rcon.id. [ $+ [ %srcon ] ]
  3621. }
  3622. if ($sock(%log)) { .timer -o 1 2 sockclose %log }
  3623. }
  3624. alias srcon_send {
  3625. var %ipp = $1, %srcon.window = $+(@,%ipp)
  3626. if (!$window(%srcon.window)) { window -aek0x %srcon.window sourcercon.execcmd }
  3627. echo %srcon.window $iif($2 isnum 1-15,$+(,$iif($len($2) > 1,$2,$+(0,$2)))) $+ $time -> $iif($2 isnum 1-15,$3-,$2-)
  3628. }
  3629. alias srcon_echo {
  3630. var %ipp = $1, %srcon.window = $+(@,%ipp)
  3631. if (!$window(%srcon.window)) { window -aek0x %srcon.window sourcercon.execcmd }
  3632. echo %srcon.window $iif($2 isnum 1-15,$+(,$iif($len($2) > 1,$2,$+(0,$2)))) $+ $time * $iif($2 isnum 1-15,$3-,$2-)
  3633. }
  3634. on *:INPUT:@: {
  3635. var %ipp = $remove($target,@), %idd = $serverid(%ipp), %sockname = $+($srcon.prefix,%ipp)
  3636. if (*.*.*:* !iswm %ipp) || (log.* iswm %ipp) { return }
  3637. if (!$sock(%sockname)) { srcon_echo %ipp 04 Error: Socket is dead. $+($chr(40),Cmd: $1-,$chr(41)) | return }
  3638. if ($sock(%sockname).status == active) {
  3639. inc %srcon.id. $+ %sockname
  3640. srcon.getrequest &srcon.cmd %srcon.id. [ $+ [ %sockname ] ] $srcon.req.execcmd $1-
  3641. srcon_send %ipp $1- | sockwrite %sockname &srcon.cmd
  3642. }
  3643. else {
  3644. srcon_echo %ipp 04 Error: Socket is $iif($sock(%srcon.socket).status,$ifmatch,dead) $+ . $+($chr(40),Cmd: $1-,$chr(41))
  3645. }
  3646. }
  3647. on *:SOCKOPEN:$($+($srcon.prefix,*)): {
  3648. var %check = $+($sock($sockname).saddr,:,$sock($sockname).sport), %ipp = $remove($sockname,$srcon.prefix)
  3649. ;;SPECIAL;;
  3650. if ($mainchan == #Gathers.NO) {
  3651. var %checkip = $sock($sockname).saddr, %checkport = $sock($sockname).sport
  3652. var %currentip = $gettok(%ipp,1,58), %currentport = $gettok(%ipp,2,58)
  3653. if (%check != :) && ($gettok(%checkip,1-3,46) != $gettok(%currentip,1-3,46)) && (%checkport != %currentport) {
  3654. echo -s $timestamp 4WARNING(SOCKOPEN): %check isnt the same as %ipp
  3655. if (!%tmp.sockopen) { whatcmd $meorsay $ownerchan $logo 4WARNING: SOCKOPEN $logo IP: %ipp $logo Check: %check $logo | set -z %tmp.sockopen 60 }
  3656. }
  3657. }
  3658. elseif (%check != :) && (%check != %ipp) {
  3659. echo -s $timestamp 4WARNING(SOCKOPEN): %check isnt the same as %ipp
  3660. if (!%tmp.sockopen) { whatcmd $meorsay $ownerchan $logo 4WARNING: SOCKOPEN $logo IP: %ipp $logo Check: %check $logo | set -z %tmp.sockopen 60 }
  3661. }
  3662. if ($sock($sockname).status == active) {
  3663. set %srcon.id. [ $+ [ $sockname ] ] 0
  3664. srcon.getrequest &srcon.auth %srcon.id. [ $+ [ $sockname ] ] $srcon.req.auth $sock($sockname).mark
  3665. sockwrite $sockname &srcon.auth
  3666. srcon_echo %ipp 12 Connection established successfully to server %ipp $+ .
  3667. .timerlogstart. [ $+ [ %ipp ] ] 1 1 rconlogstart %ipp
  3668. }
  3669. else {
  3670. srcon_echo %ipp 04 Error: Socket is dead: Connection timed out. | srcon.clear %ipp
  3671. }
  3672. }
  3673. on *:SOCKREAD:$($+($srcon.prefix, *)): {
  3674. var %check = $+($sock($sockname).saddr,:,$sock($sockname).sport), %ipp = $remove($sockname,$srcon.prefix), %logip = $remove($sockname,$srcon.prefix), %idd = $serverid(%ipp)
  3675. ;;SPECIAL;;
  3676. if ($mainchan == #Gathers.NO) {
  3677. var %checkip = $sock($sockname).saddr, %checkport = $sock($sockname).sport
  3678. var %currentip = $gettok(%ipp,1,58), %currentport = $gettok(%ipp,2,58)
  3679. if (%check != :) && ($gettok(%checkip,1-3,46) != $gettok(%currentip,1-3,46)) && (%checkport != %currentport) {
  3680. echo -s $timestamp 4WARNING(SOCKREAD): %check isnt the same as %ipp
  3681. if (!%tmp.sockopen) { whatcmd $meorsay $ownerchan $logo 4WARNING: SOCKREAD $logo IP: %ipp $logo Check: %check $logo | set -z %tmp.sockopen 60 }
  3682. }
  3683. }
  3684. elseif (%check != :) && (%check != %ipp) {
  3685. echo -s $timestamp 4WARNING(SOCKREAD): %check isnt the same as %ipp
  3686. if (!%tmp.sockread) { whatcmd $meorsay $ownerchan $logo 4WARNING: SOCKREAD $logo IP: %ipp $logo Check: %check $logo | set -z %tmp.sockread 60 }
  3687. }
  3688. if (!$sock($sockname).mark) { srcon_echo %ipp 04 NO SOCK MARK ON $sockname | sockmark $sockname $readini($gfile(gatherservers.ini),%ipp,cs_rcon) }
  3689. if ($sockerr) { srcon_echo %ipp 04 Error: Reading from socket (SockERR): $sock($sockname).wsmsg | return }
  3690. if ($hget($sockname)) {
  3691. var %srcon.pckt.size = $hget($sockname, size)
  3692. var %srcon.pckt.left = $hget($sockname, left)
  3693. var %srcon.pckt.id = $hget($sockname, id)
  3694. var %srcon.pckt.cmd = $hget($sockname, cmd)
  3695. var %noop = $hget($sockname, string1, &srcon.pckt.string1)
  3696. sockread %srcon.pckt.left &srcon.pckt.rest
  3697. dec %srcon.pckt.left $sockbr
  3698. bcopy &srcon.pckt.string1 $calc($bvar(&srcon.pckt.string1, 0) + 1) &srcon.pckt.rest 1 -1
  3699. hfree $sockname
  3700. }
  3701. else {
  3702. sockread 4 &srcon.pckt.size
  3703. var %srcon.pckt.size = $bvar(&srcon.pckt.size, 1).long
  3704. var %srcon.pckt.left = %srcon.pckt.size
  3705. sockread 4 &srcon.pckt.id
  3706. var %srcon.pckt.id = $bvar(&srcon.pckt.id, 1).long
  3707. dec %srcon.pckt.left $sockbr
  3708. if ($srcon.inttobytes(%srcon.pckt.id) == 255 255 255 255) {
  3709. srcon_echo %ipp 04 Error: Failed authentication (probably wrong rcon password).
  3710. .timermixteams 1 2 resetall %ipp | writeini -n $gfile(gatherservers.ini) %ipp error Wrong RCON PW
  3711. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Wrong RCON password, the gather is therefor stopped }
  3712. whatcmd $meorsay $mainchan $logo $col(04,Wrong RCON) on server %idd $+ , the gather is therefore stopped $logo
  3713. if ($vtset($1)) { .timer -o 1 1 delete.vt $1 }
  3714. return
  3715. }
  3716. sockread 4 &srcon.pckt.cmd
  3717. var %srcon.pckt.cmd = $bvar(&srcon.pckt.cmd, 1).long
  3718. dec %srcon.pckt.left $sockbr
  3719. sockread %srcon.pckt.left &srcon.pckt.string1
  3720. dec %srcon.pckt.left $sockbr
  3721. }
  3722. if (%srcon.pckt.left > 0) {
  3723. hmake $sockname
  3724. hadd $sockname size %srcon.pckt.size
  3725. hadd $sockname left %srcon.pckt.left
  3726. hadd $sockname id %srcon.pckt.id
  3727. hadd $sockname cmd %srcon.pckt.cmd
  3728. hadd -b $sockname string1 &srcon.pckt.string1
  3729. }
  3730. elseif (%srcon.pckt.left == 0) {
  3731. if (%srcon.pckt.cmd == $srcon.res.auth) {
  3732. if (!$sock($+($log.prefix,%ipp))) && (!%logstart. [ $+ [ %ipp ] ]) { .timerlogstart. [ $+ [ %ipp ] ] 1 1 rconlogstart %ipp }
  3733. }
  3734. elseif (%srcon.pckt.cmd == $srcon.res.cmd) {
  3735. if (!$sock($+($log.prefix,%ipp))) && (!%logstart. [ $+ [ %ipp ] ]) { .timerlogstart. [ $+ [ %ipp ] ] 1 1 rconlogstart %ipp }
  3736. var %i = 1, %next, %last | while (%i <= $bvar(&srcon.pckt.string1,0)) {
  3737. if ($bvar(&srcon.pckt.string1,%i) == $asc($lf)) {
  3738. if (*L * - *: * !iswm %next) { srcon_sockread %ipp %next }
  3739. var %next, %last
  3740. }
  3741. else { var %next = $+(%next,$iif(%last == 32,$chr(32)),$bvar(&srcon.pckt.string1,%i).text), %last = $bvar(&srcon.pckt.string1,%i) }
  3742. inc %i
  3743. }
  3744. if (%next) { srcon_sockread %ipp %next }
  3745.  
  3746. return
  3747.  
  3748. var %bytes = $bvar(&srcon.pckt.string1, 0), %bytes.max = 300, %bytes.x = 1, %bytes.now = %bytes.max, %bvar.chr = $asc($lf), %bvar.text
  3749. while (%bytes.x <= %bytes) {
  3750. var %bvar.text = $+(%bvar.text,$bvar(&srcon.pckt.string1, %bytes.x, %bytes.now).text), %bytes.x = $calc(%bytes.now +1), %bytes.send
  3751. while ($numtok(%bvar.text,%bvar.chr) > 1) {
  3752. var %bytes.send = 1, %temp = $gettok(%bvar.text,1,%bvar.chr), %bvar.text = $gettok(%bvar.text,2-,%bvar.chr) | srcon_sockread %ipp %temp
  3753. }
  3754. if (%bytes.send) { var %bytes.now = $calc(%bytes.now + %bytes.max) } | else { var %bytes.now = $calc(%bytes.now + (%bytes.max / 5)) }
  3755. }
  3756. var %i = 1 | while ($gettok(%bvar.text,%i,%bvar.chr)) { var %temp = $ifmatch | srcon_sockread %ipp %temp | inc %i }
  3757. }
  3758. }
  3759. }
  3760. on *:UDPREAD:$($+($log.prefix, *)):{
  3761. :nextread
  3762. if (!$sock($sockname)) { return }
  3763. var %check = $+($sock($sockname).saddr,:,$sock($sockname).sport), %ipp = $remove($sockname,$log.prefix), %temp. [ $+ [ %ipp ] ]
  3764. if ($sockerr) { srcon_echo %ipp 04 Error: Reading from socket (SockERR): $sock($sockname).wsmsg | return }
  3765. sockread -f %temp. [ $+ [ %ipp ] ]
  3766. %temp. [ $+ [ %ipp ] ] = $gettok(%temp. [ $+ [ %ipp ] ],5-,32)
  3767. if ($sockbr == 0) { return }
  3768. ;;SPECIAL;;
  3769. if ($mainchan == #Gathers.NO) {
  3770. var %checkip = $sock($sockname).saddr, %checkport = $sock($sockname).sport
  3771. var %currentip = $gettok(%ipp,1,58), %currentport = $gettok(%ipp,2,58)
  3772. if (%check != :) && ($gettok(%checkip,1-3,46) != $gettok(%currentip,1-3,46)) && (%checkport != %currentport) {
  3773. echo -s $timestamp 4WARNING(UDPREAD): %check isnt the same as %ipp
  3774. if (!%tmp.sockopen) { whatcmd $meorsay $ownerchan $logo 4WARNING: SOCKREAD $logo IP: %ipp $logo Check: %check $logo | set -z %tmp.sockopen 60 }
  3775. }
  3776. }
  3777. elseif (%check != :) && (%check != %ipp) {
  3778. echo -s $timestamp 4WARNING(UDPREAD): %check isnt the same as %ipp // %temp. [ $+ [ %ipp ] ]
  3779. if (!%tmp.udpread) { whatcmd $meorsay $ownerchan $logo 4WARNING: UDPREAD $logo IP: %ipp $logo Check: %check $logo %temp. [ $+ [ %ipp ] ] $logo | set -z %tmp.udpread 60 }
  3780. goto nextread
  3781. }
  3782. if (%temp. [ $+ [ %ipp ] ]) { .timerlogcheck. [ $+ [ %ipp ] ] 1 20 logcheck %ipp | srcon_sockread %ipp %temp. [ $+ [ %ipp ] ] }
  3783. goto nextread
  3784. }
  3785. alias srcon_sockread {
  3786. var %ipp = $1, %logip = %ipp, %idd = $serverid(%ipp), %temp. [ $+ [ %ipp ] ] $replace($2-,$chr(124),>|<)
  3787. if (%temp. [ $+ [ %ipp ] ]) {
  3788. tokenize 32 %temp. [ $+ [ %ipp ] ] | srcon_echo %ipp $1-
  3789. if ($readini($gfile(gatherservers.ini),%ipp,status) == Ended) { return }
  3790. if ($serverinuse(%ipp)) { logit2 %ipp $1- }
  3791. .timerkeepalive. [ $+ [ %ipp ] ] 5 5 keepalive %ipp
  3792. if (!$timer(%ipp)) { .timer $+ %ipp 0 400 rconadv %ipp }
  3793. if ($readini($gfile(gatherservers.ini),%ipp,stopped)) { remini -n $gfile(gatherservers.ini) %ipp stopped }
  3794. if (%retry. [ $+ [ %ipp ] ]) {
  3795. unset %retry. [ $+ [ %ipp ] ]
  3796. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Connection made }
  3797. }
  3798. var %gamestats = $gamestatsini(%ipp), %gatherstatus = $gatherstatus(%ipp)
  3799. if (say isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) || (say_team isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) && (*.*:* !iswm $gettok($gettok(%temp. [ $+ [ %ipp ] ],3,34),7,32)) {
  3800. tokenize 32 $gettok(%temp. [ $+ [ %ipp ] ],3,34)
  3801. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %name = $getname(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ]), %team = $iif($getteam(%temp. [ $+ [ %ipp ] ]),$ifmatch,SPECTATOR)
  3802. var %cmd = $cmd_ingame($1), %admin = $admin($+($chr(35),$gauth(%steamid))), %saytype = $gettok(%temp. [ $+ [ %ipp ] ],2,34)
  3803. if (!%steamid) && (!%name) && (!%userid) { var %say = $gettok(%temp. [ $+ [ %ipp ] ],3,34)
  3804. if (%say) {
  3805. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd say:,$col(end)) %say }
  3806. if (%gatherstatus != Free) { logit %ipp Server say: %say }
  3807. if (%say == .swapteams) { set -u3 %swapteams. [ $+ [ %ipp ] ] 1 | swapteams2 %ipp }
  3808. elseif (%say == .start) { set -u3 %spt. [ $+ [ %ipp ] ] 1 | start %ipp }
  3809. elseif (%say == .teams) { set -u5 %teams. [ $+ [ %ipp ] ] 1 | queryteams %ipp }
  3810. }
  3811. return
  3812. }
  3813. logit %ipp %name ( $+ $gauth(%steamid) $+ ) $+(%saytype,:) $1-
  3814. if (%team == Terrorists) { var %team = TERRORIST }
  3815. if (%team == Counter-Terrorists) { var %team = CT }
  3816. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) $+(%saytype,:) $1- }
  3817. if (%cmd != 0) {
  3818. if (%cmd == reg) || (%cmd == auth) {
  3819. if (!$findsid(%steamid)) && ($2) && ($tempplayers(%ipp)) {
  3820. if ($temppw(%ipp,$2)) { var %xid = $ifmatch
  3821. if ($gsteamid(%steamid)) {
  3822. if ($read($gfile(gatherusers.dat),w,* %steamid)) { var %dauth = $gettok($ifmatch,1,32) | write -ds $+ %dauth $gfile(gatherusers.dat) }
  3823. if ($read($gfile(authed.dat),w,* %steamid)) { var %dauth = $gettok($ifmatch,2,32) | write -ds $+ %dauth $gfile(authed.dat) }
  3824. }
  3825. if ($newsteamid(%xid,%steamid)) {
  3826. writeini -n $gfile(userdata.ini) %steamid reg $date $time | remini -n $gfile(tempreg.ini) %ipp %xid
  3827. writeini -n $gfile(joined.ini) %ipp %steamid %team | rconsend %ipp say %name succesfully authenticated
  3828.  
  3829. var %addr = $readini($gfile(userdata.ini),%steamid,ipaddress)
  3830. if ($readini($gfile(gatherbans.ini),%steamid,tid)) { rconsend %ipp kick $+($chr(35),%userid) Gather Banned!
  3831. if ($readini($gfile(players.ini),%ipp,%steamid)) { remini -n $gfile(players.ini) %ipp %steamid
  3832. if ($readini($gfile(counter.ini),%ipp,%steamid)) { remini -n $gfile(counter.ini) %ipp %steamid | var %team = ct } | if ($readini($gfile(terrorist.ini),%ipp,%steamid)) { remini -n $gfile(terrorist.ini) %ipp %steamid | var %team = t }
  3833. whatcmd $meorsay $mainchan $logo $anick(%steamid) is banned on steamid before authentication, use .isbanned for more info $split Gatheradmin: $anick($gatherstatus(%ipp,admin)) $logo
  3834. if (%team) { if (!$sameteam($score(%ipp,total))) { fastsub %ipp $iif(%team == ct,t,ct) 1 } | else { fastsub %ipp %team 1 } }
  3835. }
  3836. }
  3837. elseif ($ipbanned(%addr)) { var %id = $ifmatch, %team = $null, %tid = $readini($gfile(gatherbans.ini),%id,tid)
  3838. if (%id != %steamid) { rconsend %ipp kick $+($chr(35),%userid) IP Banned!
  3839. if ($readini($gfile(players.ini),%ipp,%steamid)) { remini -n $gfile(players.ini) %ipp %steamid
  3840. if ($readini($gfile(counter.ini),%ipp,%steamid)) { remini -n $gfile(counter.ini) %ipp %steamid | var %team = ct } | if ($readini($gfile(terrorist.ini),%ipp,%steamid)) { remini -n $gfile(terrorist.ini) %ipp %steamid | var %team = t }
  3841. writeini -n $gfile(gatherbans.ini) %steamid admin :gatherbot: | writeini -n $gfile(gatherbans.ini) %steamid tid %tid | writeini -n $gfile(gatherbans.ini) %steamid type IP Ban
  3842. writeini -n $gfile(gatherbans.ini) %steamid grund IP banned on another user [Steamid: %id $+ $chr(93) | writeini -n $gfile(gatherbans.ini) %steamid date $ctime
  3843. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans %steamid %steamid | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  3844. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) bans steamid %steamid | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  3845. whatcmd $meorsay $mainchan $logo $anick(%steamid) got auto banned, since he is IP banned [Steamid: %id $+ $chr(93) $split Gatheradmin: $anick($gatherstatus(%ipp,admin)) $logo
  3846. if (%team) { if (!$sameteam($score(%ipp,total))) { fastsub %ipp $iif(%team == ct,t,ct) 1 } | else { fastsub %ipp %team 1 } }
  3847. gatherbans
  3848. }
  3849. }
  3850. }
  3851.  
  3852. }
  3853. else { rconsend %ipp say Error! Report to $contact $logo }
  3854. }
  3855. }
  3856. }
  3857. elseif (%cmd == admin) && ($2 != $null) {
  3858. noticechan $privchan $logo Server $+($chr(35),$serverid(%ipp),:) %name $col(14,$chr(40)) $+ $anick(%steamid) $+ $col(14,$chr(41)) needs an admin $logo Reason: $+(,$2-,) $logo
  3859. rconsend %ipp say Message got sent to admins
  3860. }
  3861. elseif (%cmd == score) || (%cmd == status) && (!%wscore. [ $+ [ %ipp ] ]) { set -u5 %wscore. [ $+ [ %ipp ] ] 1 | rconsend %ipp say $+($chr(91),%gatherstatus,$chr(93)) CounterTerrorist: $score(%ipp,ct) - Terrorist: $score(%ipp,t) }
  3862. elseif (%cmd == time) || (%cmd == thetime) { rconsend %ipp say Date&Time: $asctime($ctime) }
  3863. elseif (%cmd == teams) && (!%teams. [ $+ [ %ipp ] ]) { set -u5 %teams. [ $+ [ %ipp ] ] 1 | queryteams %ipp }
  3864. elseif (%cmd == check) || (%cmd == checkjoin) || (%cmd == tjek) || (%cmd == tjekjoin) && (!%missing. [ $+ [ %ipp ] ]) { set -u5 %missing. [ $+ [ %ipp ] ] 1 | missing %ipp }
  3865. elseif (%cmd == ready) || (%cmd == klar) || (%cmd == go) || (%cmd == rdy) {
  3866. if (%gatherstatus != Started) && (%gatherstatus != Round_End) && (!$readini($gfile(ready.ini),%ipp,%steamid)) && (($score(%ipp,total) == 0) || ($score(%ipp,total) == 15) || ($score(%ipp,total) == $mr3.half($score(%ipp,total)))) {
  3867. if (!$sameteam($score(%ipp,total))) { var %ct = $gfile(terrorist.ini), %t = $gfile(counter.ini) } | else { var %ct = $gfile(counter.ini), %t = $gfile(terrorist.ini) }
  3868. var %ini = $iif(%team == CT,%ct,%t)
  3869. if (%team == Spectator) || (!$readini(%ini,%ipp,%steamid)) {
  3870. rconsend %ipp say $gnick(%steamid) $+ , u must be on team $iif(%team == CT,Terrorist!,CounterTerrorist!)
  3871. return
  3872. }
  3873. writeini -n $gfile(ready.ini) %ipp %steamid %steamid | if ($ini($gfile(ready.ini),%ipp,0) >= $ini($gfile(players.ini),%ipp,0)) { start %ipp }
  3874. else { rconsend %ipp say $gnick(%steamid) is ready to start ( $+ $+($ini($gfile(ready.ini),%ipp,0),$chr(47),$ini($gfile(players.ini),%ipp,0)) $+ ) }
  3875. }
  3876. }
  3877. elseif (%cmd == unready) || (%cmd == unrdy) || (%cmd == notready) || (%cmd == notrdy) {
  3878. if (%gatherstatus != Started) && (%gatherstatus != Round_End) && ($readini($gfile(ready.ini),%ipp,%steamid)) {
  3879. remini -n $gfile(ready.ini) %ipp %steamid | rconsend %ipp say $gnick(%steamid) is NOT ready to start ( $+ $+($ini($gfile(ready.ini),%ipp,0),$chr(47),$ini($gfile(players.ini),%ipp,0)) $+ )
  3880. }
  3881. }
  3882. elseif (readylist* iswm %cmd) || (rdylist* iswm %cmd) || (%cmd == checkrdy) || (%cmd == checkready) {
  3883. if (%gatherstatus != Started) && (%gatherstatus != Round_End) && (!%ready. [ $+ [ %ipp ] ]) {
  3884. set -u5 %ready. $+ %ipp 1 | var %i = 1, %x = 1, %m = $null
  3885. rconsend %ipp say Players still not ready to go: | while (%i <= $ini($gfile(players.ini),%ipp,0)) {
  3886. var %s = $ini($gfile(players.ini),%ipp,%i) | if (!$readini($gfile(ready.ini),%ipp,%s)) { var %m = $iif(%m,$+(%m,$chr(44))) $gnick(%s) | if ($len(%m) >= 18) { .timer -o 1 %x rconsend %ipp say %m | var %m = $null | inc %x } } | inc %i
  3887. }
  3888. if (%m) { .timer -o 1 %x rconsend %ipp say %m } | .timer -o 1 %x rconsend %ipp say Use: .ready -/- .unready
  3889. }
  3890. }
  3891. elseif (%cmd == whois) && ($2 != $null) && ($2 != 0) { set %whois. [ $+ [ %ipp ] ] $2- | rconsend %ipp status }
  3892. elseif (%steamid == $gatherstatus(%ipp,admin)) || (%admin >= 8) {
  3893. if (%cmd == rs) || (%cmd == restart) { rconsend %ipp mp_restartgame 1 }
  3894. elseif (%cmd == swapteams) && (!%swapteams. [ $+ [ %ipp ] ]) { set -u3 %swapteams. [ $+ [ %ipp ] ] 1 | swapteams2 %ipp }
  3895. elseif (%cmd == seeksub) && (!%needsub. [ $+ [ %ipp ] ]) { set -u5 %needsub. [ $+ [ %ipp ] ] 1 | seeksub %ipp }
  3896. elseif (%cmd == needsub) && (!%needsub. [ $+ [ %ipp ] ]) && (%admin >= 8) { set -u5 %needsub. [ $+ [ %ipp ] ] 1 | needsub %ipp }
  3897. elseif (%cmd == fastsub) || (%cmd == addsub) || (%cmd == forcesub) && (!%needsub. [ $+ [ %ipp ] ]) && ($gauth(%steamid) == $remove($scripter,$chr(35))) {
  3898. if ($3 isnum) {
  3899. if ($2 == ct) || ($2 == counter) || ($2 == counterterrorist) { set -u5 %needsub. [ $+ [ %ipp ] ] 1 | fastsub %ipp ct $iif($3 >= 1,$round($3,0),1) }
  3900. elseif ($2 == t) || ($2 == terrorist) { set -u5 %needsub. [ $+ [ %ipp ] ] 1 | fastsub %ipp t $iif($3 >= 1,$round($3,0),1) }
  3901. else { rconsend %ipp say Error. Use: .fastsub "team" $iif($3 >= 1,$round($3,0),"antalsubs") }
  3902. }
  3903. else { rconsend %ipp say Error. Use: .fastsub "team" "antalsubs" }
  3904. }
  3905. elseif ((%cmd == endsub) || (%cmd == subend)) && (%admin >= 8) { .endsub %ipp $gauth(%steamid) }
  3906. elseif (%cmd == setmap) || (%cmd == changemap) || (%cmd == changelevel) {
  3907. if ($findmap($2)) {
  3908. var %map = $ifmatch | writeini -n $gfile(gatherstatus.ini) %ipp map %map
  3909. if ($workshop(%ipp,%map)) { var %x = $remove($ifmatch,workshop/) | rconsend %ipp host_workshop_map %x } | else { rconsend %ipp changelevel %map }
  3910. }
  3911. else { rconsend %ipp say $2 is not a valid map }
  3912. }
  3913. elseif (%cmd == freeze) || (%cmd == freezetime) && ($2 isnum) { rconsend %ipp mp_freezetime $2 }
  3914. elseif (%cmd == pregame) || (%cmd == pre) && (!%spt. [ $+ [ %ipp ] ]) { set -u2 %spt. [ $+ [ %ipp ] ] 1 | pregame %ipp }
  3915. elseif (%cmd == tacs) && (!%spt. [ $+ [ %ipp ] ]) { set -u2 %spt. [ $+ [ %ipp ] ] 1 | tacs %ipp }
  3916. elseif (%cmd == start) && (!%spt. [ $+ [ %ipp ] ]) { set -u3 %spt. [ $+ [ %ipp ] ] 1 | start %ipp }
  3917. elseif (%cmd == adminstop) && (!%gatherstopped. [ $+ [ %ipp ] ]) && (%admin >= 8) { set -u10 %gatherstopped. [ $+ [ %ipp ] ] %steamid | .stop %ipp }
  3918. elseif (%cmd == setscore) || (%cmd == updatescore) || (%cmd == newscore) { setscore %ipp $2- }
  3919. elseif (%cmd == say) && ($2 != $null) { rconsend %ipp say $gnick(%steamid) $+ : $2- }
  3920. elseif (%cmd == kick) && ($2 != $null) && (%admin >= 8) { set %kick. [ $+ [ %ipp ] ] %steamid $2- | rconsend %ipp status }
  3921. elseif (%cmd == rcon) && ($2 != $null) && (%admin >= 8) { rconsend %ipp $2- | rconsend %ipp say Rcon: $2- }
  3922. elseif (%cmd == pause) { rconsend %ipp mp_pause_match }
  3923. elseif (%cmd == unpause) { rconsend %ipp mp_unpause_match }
  3924. }
  3925. }
  3926. return
  3927. }
  3928.  
  3929. if (rcon from "*": command "*" iswm %temp. [ $+ [ %ipp ] ]) {
  3930. var %cmd = $gettok(%temp. [ $+ [ %ipp ] ],4,34)
  3931. if (%cmd == .swapteams) { set -u3 %swapteams. [ $+ [ %ipp ] ] 1 | swapteams2 %ipp }
  3932. elseif (%cmd == .start) { set -u3 %spt. [ $+ [ %ipp ] ] 1 | start %ipp }
  3933. return
  3934. }
  3935.  
  3936. if ($gatherinfo(game) != CS:Promod) {
  3937. if (*Loading map "*"* iswm %temp. [ $+ [ %ipp ] ]) {
  3938. .timerrecheck. [ $+ [ $1 ] ] 1 5 rechecksocket %ipp
  3939. var %map = $gettok(%temp. [ $+ [ %ipp ] ],2,34), %true = $readini($gfile(gatherstatus.ini),%ipp,map)
  3940. var %n = $numtok(%map,47), %map = $gettok(%map,%n,47), %n = $numtok(%map,92), %map = $gettok(%map,%n,92)
  3941. if (%true) && (%map != %true) {
  3942. if ($workshop(%ipp,%true)) { var %x = $remove($ifmatch,workshop/) | .timerchange. [ $+ [ %ipp ] ] 1 8 rconsend %ipp host_workshop_map %x }
  3943. else { .timerchange. [ $+ [ %ipp ] ] 1 8 rconsend %ipp changelevel %true }
  3944. }
  3945. elseif (%gatherstatus != Started) && (%gatherstatus != Round_End) { set -z %pregame. [ $+ [ %ipp ] ] 60 }
  3946. return
  3947. }
  3948.  
  3949. if (*Started map "*"* iswm %temp. [ $+ [ %ipp ] ]) {
  3950. .timerrecheck. [ $+ [ $1 ] ] 1 3 rechecksocket %ipp
  3951. var %map = $gettok(%temp. [ $+ [ %ipp ] ],2,34), %true = $readini($gfile(gatherstatus.ini),%ipp,map)
  3952. var %n = $numtok(%map,47), %map = $gettok(%map,%n,47), %n = $numtok(%map,92), %map = $gettok(%map,%n,92)
  3953. if (%true) && (%map != %true) {
  3954. if ($workshop(%ipp,%true)) { var %x = $remove($ifmatch,workshop/) | .timerchange. [ $+ [ %ipp ] ] 1 5 rconsend %ipp host_workshop_map %x }
  3955. else { .timerchange. [ $+ [ %ipp ] ] 1 5 rconsend %ipp changelevel %true }
  3956. }
  3957. elseif (%gatherstatus != Started) && (%gatherstatus != Round_End) { set -z %pregame. [ $+ [ %ipp ] ] 60 }
  3958. return
  3959. }
  3960. }
  3961.  
  3962. if (not currently logging == %temp. [ $+ [ %ipp ] ]) { rconsend %ipp log on | return }
  3963.  
  3964. if (Log file closed isin %temp. [ $+ [ %ipp ] ]) { .timerlog. [ $+ [ %ipp ] ] 1 1 rconsend %ipp log on | return }
  3965.  
  3966. if (Log file started isin %temp. [ $+ [ %ipp ] ]) && ($timer(log. [ $+ [ %ipp ] ])) { .timerlog. [ $+ [ %ipp ] ] off | return }
  3967.  
  3968. if (*logaddress_list: no addresses in the list* iswm $1-) { rconlogstart2 %ipp | return }
  3969.  
  3970. if (%logstart. [ $+ [ %ipp ] ]) {
  3971. if (*logaddress_list: * entry* iswm $1-) { set -u10 %logadr. [ $+ [ %ipp ] ] 1 | return }
  3972. if (*?:?* iswm $1) && (%logadr. [ $+ [ %ipp ] ]) && (!$2) { rconsend %ipp logaddress_del $1 | .timer -o 1 1 rconlogstart2 %ipp }
  3973. }
  3974.  
  3975. if ("*" = "*" iswm %temp. [ $+ [ %ipp ] ]) {
  3976. var %cvar = $gettok(%temp. [ $+ [ %ipp ] ],1,34), %value = $gettok(%temp. [ $+ [ %ipp ] ],3,34), %r = $iif(%cvar == mp_logfile || %cvar == mp_logecho,1,3)
  3977. if ($istok(mp_logmessages mp_logdetail mp_logfile mp_logecho,%cvar,32)) && (%value != %r) { rconsend %ipp %cvar %r | return }
  3978. }
  3979.  
  3980. if (server_cvar: "*" "*" iswm %temp. [ $+ [ %ipp ] ]) {
  3981. var %cvar = $gettok(%temp. [ $+ [ %ipp ] ],2,34), %value = $gettok(%temp. [ $+ [ %ipp ] ],4,34), %r = $iif(%cvar == mp_logfile || %cvar == mp_logecho,1,3)
  3982. if ($istok(mp_logmessages mp_logdetail mp_logfile mp_logecho,%cvar,32)) && (%value != %r) { rconsend %ipp %cvar %r }
  3983. return
  3984. }
  3985.  
  3986. if ($gatherinfo(game) != CS:Promod) {
  3987. if (*Team "*" triggered "*"* iswm %temp. [ $+ [ %ipp ] ]) {
  3988. if (%gatherstatus == Started) {
  3989. var %team = $gettok(%temp. [ $+ [ %ipp ] ],2,34), %ct = $gettok(%temp. [ $+ [ %ipp ] ],6,34), %t = $gettok(%temp. [ $+ [ %ipp ] ],8,34)
  3990. if (%team == Terrorists) { var %team = TERRORIST }
  3991. if (%team == Counter-Terrorists) { var %team = CT }
  3992. if (%team == CT) { team_ct_won %ipp %ct %t } | else { team_t_won %ipp %t %ct }
  3993. }
  3994. return
  3995. }
  3996. if ("*" triggered "Defused_The_Bomb" iswm %temp. [ $+ [ %ipp ] ]) {
  3997. if (%gatherstatus == Started) {
  3998. .timerbombdefused. [ $+ [ %ipp ] ] -o 1 2 team_ct_won %ipp
  3999. }
  4000. return
  4001. }
  4002.  
  4003. }
  4004.  
  4005. if ($gatherinfo(game) != CS:Promod) {
  4006. if (World triggered isin $gettok(%temp. [ $+ [ %ipp ] ],1,34)) { var %ini = $assini(%ipp), %killsini = $killsini(%ipp)
  4007. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) %temp. [ $+ [ %ipp ] ] }
  4008. if (Round_Start isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4009. if ($ini(%ini,0)) { write -c %ini } | if ($ini(%killsini,0)) { write -c %killsini } | unset %gatherhold. [ $+ [ %ipp ] ] | unset %roundend. [ $+ [ %ipp ] ] | unset %lastkill. [ $+ [ %ipp ] ] | unset %firstkill. [ $+ [ %ipp ] ] | unset %teamwon. [ $+ [ %ipp ] ] | remini -n $gfile(kills.ini) %ipp | remini -n $gfile(lastkill.ini) %ipp
  4010. if ($gatherinfo(amx)) && ($gatherstatus(%ipp) != Ended) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { var %status = ok | set -u10 %forceteams. [ $+ [ %ipp ] ] 1 }
  4011. if (!%check. [ $+ [ %ipp ] ]) { var %status = ok | set -u10 %check. [ $+ [ %ipp ] ] 1 }
  4012. if (%status == ok) { rconsend %ipp status }
  4013. }
  4014. elseif (Round_End isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) && (%gatherstatus == Started) {
  4015. if (%roundend. [ $+ [ %ipp ] ]) { set -u7 %gatherhold. [ $+ [ %ipp ] ] 1 }
  4016. if (!%roundend. [ $+ [ %ipp ] ]) { return
  4017. var %team = $iif(%lastkill. [ $+ [ %ipp ] ],$ifmatch,TERRORIST)
  4018. if (%team == Terrorists) { var %team = TERRORIST }
  4019. if (%team == Counter-Terrorists) { var %team = CT }
  4020. set -u5 %teamwon. [ $+ [ %ipp ] ] %team | if (%team == TERRORIST) { team_t_won %ipp } | else { team_ct_won %ipp }
  4021. }
  4022. }
  4023. return
  4024. }
  4025. }
  4026.  
  4027. if ($gatherinfo(game) == CS:Promod) {
  4028. if (round_end == $gettok(%temp. [ $+ [ %ipp ] ],1,34)) {
  4029. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Round_End $gettok(%temp. [ $+ [ %ipp ] ],2-,34) }
  4030. if (%gatherstatus == Started) {
  4031. set -u7 %gatherhold. [ $+ [ %ipp ] ] 1
  4032. if (!%roundend. [ $+ [ %ipp ] ]) {
  4033. var %winner = $gettok(%temp. [ $+ [ %ipp ] ],3,34), %team = $iif(%winner == 3,CT,TERRORIST)
  4034. if (%winner == 2) || (%winner == 3) {
  4035. set -u5 %teamwon. [ $+ [ %ipp ] ] %team | if (%team == TERRORIST) { team_t_won %ipp } | else { team_ct_won %ipp }
  4036. }
  4037. }
  4038. }
  4039. return
  4040. }
  4041. if (round_start == $gettok(%temp. [ $+ [ %ipp ] ],1,34)) {
  4042. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Round_Start }
  4043. var %ini = $assini(%ipp), %killsini = $killsini(%ipp)
  4044. if ($ini(%ini,0)) { write -c %ini } | if ($ini(%killsini,0)) { write -c %killsini } | unset %gatherhold. [ $+ [ %ipp ] ] | unset %roundend. [ $+ [ %ipp ] ] | unset %lastkill. [ $+ [ %ipp ] ] | unset %firstkill. [ $+ [ %ipp ] ] | unset %teamwon. [ $+ [ %ipp ] ] | remini -n $gfile(kills.ini) %ipp | remini -n $gfile(lastkill.ini) %ipp
  4045. if ($gatherinfo(amx)) && ($gatherstatus(%ipp) != Ended) && ($ini($gfile(joined.ini),%ipp,0) >= 1) && (!%forceteams. [ $+ [ %ipp ] ]) { var %status = ok | set -u10 %forceteams. [ $+ [ %ipp ] ] 1 }
  4046. if (!%check. [ $+ [ %ipp ] ]) { var %status = ok | set -u10 %check. [ $+ [ %ipp ] ] 1 }
  4047. if (%status == ok) { rconsend %ipp status }
  4048. return
  4049. }
  4050. if (round_freeze_end == $gettok(%temp. [ $+ [ %ipp ] ],1,34)) {
  4051. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) Round_Freeze_End }
  4052. var %ini = $assini(%ipp), %killsini = $killsini(%ipp)
  4053. if ($ini(%ini,0)) { write -c %ini } | if ($ini(%killsini,0)) { write -c %killsini } | unset %gatherhold. [ $+ [ %ipp ] ] | unset %roundend. [ $+ [ %ipp ] ] | unset %lastkill. [ $+ [ %ipp ] ] | unset %firstkill. [ $+ [ %ipp ] ] | unset %teamwon. [ $+ [ %ipp ] ] | remini -n $gfile(kills.ini) %ipp | remini -n $gfile(lastkill.ini) %ipp
  4054. return
  4055. }
  4056. }
  4057.  
  4058. if (Planted_The_Bomb isin $gettok(%temp. [ $+ [ %ipp ] ],3,34)) && (%gatherstatus == Started) {
  4059. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %nick = $getname(%temp. [ $+ [ %ipp ] ])
  4060. if ($readini($gfile(players.ini),%ipp,%steamid)) {
  4061. if (%team == Terrorists) { var %team = TERRORIST }
  4062. if (%team == Counter-Terrorists) { var %team = CT }
  4063. writeini -n $gfile(joined.ini) %ipp %steamid %team
  4064. writeini -n %gamestats %steamid Plants $calc($readini(%gamestats,%steamid,Plants) +1)
  4065. writeini -n %gamestats %steamid Points $calc($readini(%gamestats,%steamid,Points) +0.4)
  4066. ;;SPECIAL;;
  4067. if ($network == GameSurge) {
  4068. rconsend %ipp say %nick $+($chr(40),$gnick(%steamid),$chr(41)) planted the bomb
  4069. if ($me ison $mainchan) { whatcmd $meorsay $mainchan $logo $anick(%steamid) $+($chr(40),%nick,$chr(41)) planted the bomb on server $+($chr(35),%idd) $logo }
  4070. }
  4071. }
  4072. return
  4073. }
  4074. if (Defused_The_Bomb isin $gettok(%temp. [ $+ [ %ipp ] ],3,34)) && (%gatherstatus == Started) {
  4075. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %nick = $getname(%temp. [ $+ [ %ipp ] ])
  4076. if ($readini($gfile(players.ini),%ipp,%steamid)) {
  4077. if (%team == Terrorists) { var %team = TERRORIST }
  4078. if (%team == Counter-Terrorists) { var %team = CT }
  4079. writeini -n $gfile(joined.ini) %ipp %steamid %team
  4080. writeini -n %gamestats %steamid Defs $calc($readini(%gamestats,%steamid,Defs) +1)
  4081. writeini -n %gamestats %steamid Points $calc($readini(%gamestats,%steamid,Points) +0.4)
  4082. ;;SPECIAL;;
  4083. if ($network == GameSurge) {
  4084. rconsend %ipp say %nick $+($chr(40),$gnick(%steamid),$chr(41)) defused the bomb
  4085. if ($me ison $mainchan) { whatcmd $meorsay $mainchan $logo $anick(%steamid) $+($chr(40),%nick,$chr(41)) defused the bomb on server $+($chr(35),%idd) $logo }
  4086. }
  4087. }
  4088. return
  4089. }
  4090.  
  4091. if (threw isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4092. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %nade = $gettok($gettok(%temp. [ $+ [ %ipp ] ],2,34),2,32)
  4093. if ($readini($gfile(players.ini),%ipp,%steamid)) && (%gatherstatus == Started) {
  4094. if (!$istok(flashbang hegrenade smokegrenade decoy,%nade,32)) { return }
  4095. if (%team == Terrorists) { var %team = TERRORIST }
  4096. if (%team == Counter-Terrorists) { var %team = CT }
  4097. writeini -n $gfile(joined.ini) %ipp %steamid %team
  4098. ;writeini -n %gamestats %steamid %nade $calc($readini(%gamestats,%steamid,%nade) +1)
  4099. }
  4100. return
  4101. }
  4102.  
  4103. if (*killed* iswm $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4104. var %ini = $assini(%ipp), %killsini = $killsini(%ipp), %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %nick = $getname(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ])
  4105. var %asteamid = $getsteamid(3,%temp. [ $+ [ %ipp ] ]), %ateam = $getteam(3,%temp. [ $+ [ %ipp ] ]), %anick = $getname(3,%temp. [ $+ [ %ipp ] ]), %weapon = $strip($gettok($gettok(%temp. [ $+ [ %ipp ] ],5,34),1,95)), %kill = $getkill(%temp. [ $+ [ %ipp ] ])
  4106. if ($readini($gfile(players.ini),%ipp,%steamid)) && ($readini($gfile(players.ini),%ipp,%asteamid)) {
  4107. if (%team == Terrorists) { var %team = TERRORIST }
  4108. if (%team == Counter-Terrorists) { var %team = CT }
  4109. if (%ateam == Terrorists) { var %ateam = TERRORIST }
  4110. if (%ateam == Counter-Terrorists) { var %ateam = CT }
  4111. writeini -n $gfile(joined.ini) %ipp %steamid %team | writeini -n $gfile(joined.ini) %ipp %asteamid %ateam
  4112. if (%gatherstatus == Started) { set -u5 %lastkill. [ $+ [ %ipp ] ] %team
  4113. ;;SPECIAL;;
  4114. if ($network == GameSurge) {
  4115. rconsend %ipp say %nick $+($chr(40),$gnick(%steamid),$chr(41)) killed %anick $+($chr(40),$gnick(%asteamid),$chr(41)) with %weapon
  4116. if ($me ison $mainchan) { whatcmd $meorsay $mainchan $logo $anick(%steamid) $+($chr(40),%nick,$chr(41)) killed $anick(%asteamid) $+($chr(40),%anick,$chr(41)) with %weapon on server $+($chr(35),%idd) $logo }
  4117. }
  4118. if (%team != %ateam) { var %points = $killpoints(%steamid,%asteamid)
  4119. if (!%firstkill. [ $+ [ %ipp ] ]) {
  4120. set -u300 %firstkill. [ $+ [ %ipp ] ] %steamid | writeini -n %gamestats %steamid Entrykills $calc($readini(%gamestats,%steamid,Entrykills) +1)
  4121. }
  4122. writeini -n %gamestats %steamid Points $calc($readini(%gamestats,%steamid,Points) + %points)
  4123. writeini -n %gamestats %asteamid Points $calc($readini(%gamestats,%asteamid,Points) - %points)
  4124. writeini -n %gamestats %steamid Kills $calc($readini(%gamestats,%steamid,Kills) +1)
  4125. writeini -n %gamestats %steamid %weapon $calc($readini(%gamestats,%steamid,%weapon) +1)
  4126. writeini -n %gamestats %asteamid Deaths $calc($readini(%gamestats,%asteamid,Deaths) +1)
  4127. if (%kill == Headshot) { writeini -n %gamestats %steamid Headshots $calc($readini(%gamestats,%steamid,Headshots) +1) }
  4128. writeini -n $gfile(kills.ini) %ipp %steamid $calc($readini($gfile(kills.ini),%ipp,%steamid) +1)
  4129. if ($checkclutch(%ipp,%team)) { var %clutch = $+(clutch,%steamid) | writeini -n $gfile(kills.ini) %ipp %clutch $calc($readini($gfile(kills.ini),%ipp,%clutch) +1) | writeini -n $gfile(lastkill.ini) %ipp %steamid %asteamid }
  4130. }
  4131. else {
  4132. writeini -n %gamestats %steamid Points $calc($readini(%gamestats,%steamid,Points) -1)
  4133. writeini -n %gamestats %asteamid Points $calc($readini(%gamestats,%asteamid,Points) -0.5)
  4134. writeini -n %gamestats %steamid Teamkills $calc($readini(%gamestats,%steamid,Teamkills) +1)
  4135. writeini -n %gamestats %steamid %weapon $calc($readini(%gamestats,%steamid,%weapon) +1)
  4136. writeini -n %gamestats %asteamid Deaths $calc($readini(%gamestats,%asteamid,Deaths) +1)
  4137. logit %ipp TEAMKILL: %nick ( $+ $gauth(%steamid) $+ ) -TK- %anick ( $+ $gauth(%asteamid) $+ ) with %weapon
  4138. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) (Team: $teamcolor(%team) $+ ) killed $anick(%asteamid) (Team: $teamcolor(%ateam) $+ ) with %weapon $col(04,TEAMKILL) }
  4139. if ($me ison $privchan) { whatcmd $meorsay $privchan $logo $col(04,TEAMKILL:) %nick $col(14,$chr(40)) $+ $anick(%steamid) $+ $col(14,$chr(41)) - $col(04,killed) - %anick $col(14,$chr(40)) $+ $anick(%asteamid) $+ $col(14,$chr(41)) with %weapon on server $+($chr(35),$serverid(%ipp)) $split Gatheradmin: $anick($gatherstatus(%ipp,admin)) $logo }
  4140. }
  4141. writeini -n $gfile(kills.ini) %ipp %ateam $calc($readini($gfile(kills.ini),%ipp,%ateam) +1)
  4142. writeini -n %killsini %ateam %asteamid %asteamid
  4143. if (%nick) && ($readini($gfile(userdata.ini),%steamid,ingamenick) != %nick) { writeini -n $gfile(userdata.ini) %steamid ingamenick %nick }
  4144. if (%anick) && ($readini($gfile(userdata.ini),%asteamid,ingamenick) != %anick) { writeini -n $gfile(userdata.ini) %asteamid ingamenick %anick }
  4145. return
  4146. if ($ini(%ini,%asteamid)) {
  4147. var %i = 1, %n = $ini(%ini,%asteamid,0) | while (%i <= %n) { var %x = $ini(%ini,%asteamid,%i), %dmg = $readini(%ini,%asteamid,%x)
  4148. if (%dmg >= 40) && (%x != %asteamid) && (%x != %steamid) {
  4149. writeini -n %gamestats %x Assists $calc($readini(%gamestats,%x,Assists) +1)
  4150. writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) +0.3)
  4151. echo -s %x assisted killing %asteamid with %dmg damage ( $calc($readini(%gamestats,%x,Assists) +1) )
  4152. }
  4153. inc %i
  4154. }
  4155. remini -n %ini %asteamid
  4156. }
  4157. }
  4158. elseif (%gatherstatus == Round_End) && (%team == %ateam) {
  4159. logit %ipp TEAMKILL: %nick ( $+ $gauth(%steamid) $+ ) -TK- %anick ( $+ $gauth(%asteamid) $+ ) with %weapon
  4160. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) (Team: $teamcolor(%team) $+ ) killed $anick(%asteamid) (Team: $teamcolor(%ateam) $+ ) with %weapon $col(04,TEAMKILL) }
  4161. if ($me ison $privchan) { whatcmd $meorsay $privchan $logo $col(04,TEAMKILL:) %nick $col(14,$chr(40)) $+ $anick(%steamid) $+ $col(14,$chr(41)) - $col(04,killed) - %anick $col(14,$chr(40)) $+ $anick(%asteamid) $+ $col(14,$chr(41)) with %weapon on server $+($chr(35),$serverid(%ipp)) $split Gatheradmin: $anick($gatherstatus(%ipp,admin)) $logo }
  4162. }
  4163. }
  4164. return
  4165. }
  4166.  
  4167. if (*attacked* iswm $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4168. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %asteamid = $getsteamid(3,%temp. [ $+ [ %ipp ] ]), %ateam = $getteam(3,%temp. [ $+ [ %ipp ] ])
  4169. var %nick = $getname(%temp. [ $+ [ %ipp ] ]), %anick = $getname(3,%temp. [ $+ [ %ipp ] ]), %attack = $gettok(%temp. [ $+ [ %ipp ] ],7,34), %userid = $getuserid(%temp. [ $+ [ %ipp ] ]), %weapon = $strip($gettok(%temp. [ $+ [ %ipp ] ],5,34))
  4170. if (%team == Terrorists) { var %team = TERRORIST }
  4171. if (%team == Counter-Terrorists) { var %team = CT }
  4172. if (%ateam == Terrorists) { var %ateam = TERRORIST }
  4173. if (%ateam == Counter-Terrorists) { var %ateam = CT }
  4174. if (%gatherstatus == Started) {
  4175. if ($readini($gfile(players.ini),%ipp,%steamid)) && ($readini($gfile(players.ini),%ipp,%asteamid)) {
  4176. if (%team != %ateam) {
  4177. var %ini = $assini(%ipp), %dmg = $iif($readini(%ini,%asteamid,%steamid),$ifmatch,0) | writeini -n %ini %asteamid %steamid $calc(%dmg + %attack)
  4178. }
  4179. else {
  4180. logit %ipp TEAMDAMAGE: %nick ( $+ $gauth(%steamid) $+ ) -TD- %anick ( $+ $gauth(%asteamid) $+ ) with %weapon and %attack damage
  4181. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) (Team: $teamcolor(%team) $+ ) attacked $anick(%asteamid) (Team: $teamcolor(%ateam) $+ ) with %weapon $col(04,TEAMDAMAGE:) %attack }
  4182. }
  4183. }
  4184. }
  4185. elseif (%gatherstatus == Round_End) && (%team == %ateam) {
  4186. logit %ipp TEAMDAMAGE: %nick ( $+ $gauth(%steamid) $+ ) -TD- %anick ( $+ $gauth(%asteamid) $+ ) with %weapon and %dmg damage
  4187. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) (Team: $teamcolor(%team) $+ ) attacked $anick(%asteamid) (Team: $teamcolor(%ateam) $+ ) with %weapon $col(04,TEAMDAMAGE:) %attack }
  4188. }
  4189. return
  4190. }
  4191.  
  4192. if (*assisted killing* iswm $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4193. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %asteamid = $getsteamid(3,%temp. [ $+ [ %ipp ] ]), %ateam = $getteam(3,%temp. [ $+ [ %ipp ] ])
  4194. if (%team == Terrorists) { var %team = TERRORIST }
  4195. if (%team == Counter-Terrorists) { var %team = CT }
  4196. if (%ateam == Terrorists) { var %ateam = TERRORIST }
  4197. if (%ateam == Counter-Terrorists) { var %ateam = CT }
  4198. if (%gatherstatus == Started) {
  4199. if ($readini($gfile(players.ini),%ipp,%steamid)) && ($readini($gfile(players.ini),%ipp,%asteamid)) {
  4200. if (%team != %ateam) {
  4201. writeini -n %gamestats %steamid Assists $calc($readini(%gamestats,%steamid,Assists) +1)
  4202. writeini -n %gamestats %steamid Points $calc($readini(%gamestats,%steamid,Points) +0.3)
  4203. }
  4204. }
  4205. }
  4206. return
  4207. }
  4208.  
  4209. if (switched from team isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4210. var %hltv = $remove($gettok(%temp. [ $+ [ %ipp ] ],3,60),$chr(62))
  4211. if (%hltv != HLTV) && (%hltv != BOT) {
  4212. var %name = $getname(%temp. [ $+ [ %ipp ] ]), %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ]), %var = $gettok(%temp. [ $+ [ %ipp ] ],2-,34), %team = $remove($gettok(%var,$numtok(%var,32),32),$chr(60),$chr(62))
  4213. if (%disconnected. [ $+ [ %steamid ] ]) { unset %disconnected. [ $+ [ %steamid ] ] | return }
  4214. if (%team == Terrorists) { var %team = TERRORIST }
  4215. if (%team == Counter-Terrorists) { var %team = CT }
  4216. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) joined team %team }
  4217. logit %ipp %name ( $+ $gauth(%steamid) $+ ) joined team %team
  4218. writeini -n $gfile(joined.ini) %ipp %steamid %team
  4219. if ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) {
  4220. if (!$sameteam($score(%ipp,total))) { var %ct = $gfile(terrorist.ini), %t = $gfile(counter.ini) } | else { var %ct = $gfile(counter.ini), %t = $gfile(terrorist.ini) }
  4221. if (%team == Spectator) {
  4222. rconsend %ipp say $gnick(%steamid) $+ , u are on team $iif(%team == CT,Terrorist!,CounterTerrorist!)
  4223. if ($gatherinfo(amx)) { rconsend %ipp amx_team $+($chr(35),%userid) $iif(%team == CT,T,CT) }
  4224. return
  4225. }
  4226. var %ini = $iif(%team == CT,%ct,%t)
  4227. if (!$readini(%ini,%ipp,%steamid)) {
  4228. rconsend %ipp say $gnick(%steamid) $+ , u are on team $iif(%team == CT,Terrorist!,CounterTerrorist!)
  4229. if ($gatherinfo(amx)) { rconsend %ipp amx_team $+($chr(35),%userid) $iif(%team == CT,T,CT) }
  4230. }
  4231. elseif ($ini($gfile(joined.ini),%ipp,0) >= $ini($gfile(players.ini),%ipp,0)) && (!$serverstatus(%ipp,sub)) && ($gatherstatus(%ipp) != Started) {
  4232. if ($gatherstatus(%ipp,type) != Challenge) && ($score(%ipp,total) < 15) {
  4233. if (!$readini($gfile(gatherstatus.ini),%ipp,lantjek)) && ($ini($gfile(players.ini),%ipp,0) >= 4) { .timerlantjek. $+ %ipp 1 2 tjeklan %ipp }
  4234. }
  4235. else { .timertjekteams. $+ %ipp 1 2 tjekteams %ipp }
  4236. }
  4237. }
  4238. }
  4239. return
  4240. }
  4241.  
  4242. if (joined team isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4243. var %hltv = $remove($gettok(%temp. [ $+ [ %ipp ] ],3,60),$chr(62))
  4244. if (%hltv != HLTV) && (%hltv != BOT) {
  4245. var %name = $getname(%temp. [ $+ [ %ipp ] ]), %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $gettok(%temp. [ $+ [ %ipp ] ],3,34), %userid = $getuserid(%temp. [ $+ [ %ipp ] ])
  4246. if (%disconnected. [ $+ [ %steamid ] ]) { unset %disconnected. [ $+ [ %steamid ] ] | return }
  4247. if (%team == Terrorists) { var %team = TERRORIST }
  4248. if (%team == Counter-Terrorists) { var %team = CT }
  4249. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) joined team %team }
  4250. logit %ipp %name ( $+ $gauth(%steamid) $+ ) joined team %team
  4251. writeini -n $gfile(joined.ini) %ipp %steamid %team
  4252. if ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) {
  4253. if (!$sameteam($score(%ipp,total))) { var %ct = $gfile(terrorist.ini), %t = $gfile(counter.ini) } | else { var %ct = $gfile(counter.ini), %t = $gfile(terrorist.ini) }
  4254. if (%team == Spectator) {
  4255. rconsend %ipp say $gnick(%steamid) $+ , u are on team $iif(%team == CT,Terrorist!,CounterTerrorist!)
  4256. if ($gatherinfo(amx)) { rconsend %ipp amx_team $+($chr(35),%userid) $iif(%team == CT,T,CT) }
  4257. return
  4258. }
  4259. var %ini = $iif(%team == CT,%ct,%t)
  4260. if (!$readini(%ini,%ipp,%steamid)) {
  4261. rconsend %ipp say $gnick(%steamid) $+ , u are on team $iif(%team == CT,Terrorist!,CounterTerrorist!)
  4262. if ($gatherinfo(amx)) { rconsend %ipp amx_team $+($chr(35),%userid) $iif(%team == CT,T,CT) }
  4263. }
  4264. elseif ($ini($gfile(joined.ini),%ipp,0) >= $ini($gfile(players.ini),%ipp,0)) && (!$serverstatus(%ipp,sub)) && ($gatherstatus(%ipp) != Started) {
  4265. if ($gatherstatus(%ipp,type) != Challenge) && ($score(%ipp,total) < 15) {
  4266. if (!$readini($gfile(gatherstatus.ini),%ipp,lantjek)) && ($ini($gfile(players.ini),%ipp,0) >= 4) { .timerlantjek. $+ %ipp 1 2 tjeklan %ipp }
  4267. }
  4268. else { .timertjekteams. $+ %ipp 1 2 tjekteams %ipp }
  4269. }
  4270. }
  4271. }
  4272. return
  4273. }
  4274.  
  4275. if (STEAM USERID validated isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4276. var %hltv = $remove($gettok(%temp. [ $+ [ %ipp ] ],3,60),$chr(62))
  4277. if (%hltv != HLTV) && (%hltv != BOT) {
  4278. var %name = $getname(%temp. [ $+ [ %ipp ] ]), %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ])
  4279. if ($tempplayers(%ipp)) { if (%steamid) { set -z %tempreg. [ $+ [ %steamid ] ] 60 | .timer $+ $+(%ipp,.,%steamid) 1 65 tempcheck %ipp } }
  4280. }
  4281. return
  4282. }
  4283.  
  4284. if (entered the game isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4285. var %hltv = $remove($gettok(%temp. [ $+ [ %ipp ] ],3,60),$chr(62))
  4286. if (%hltv != HLTV) && (%hltv != BOT) {
  4287. var %name = $getname(%temp. [ $+ [ %ipp ] ]), %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ]) | logit %ipp %name ( $+ $gauth(%steamid) $+ ) connected
  4288. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) joined the server }
  4289. if ($readini($gfile(kicked.ini),%ipp,%steamid)) { rconsend %ipp kickid %steamid Kicked! }
  4290. elseif ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) {
  4291. writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR
  4292. if (%startup. [ $+ [ %ipp ] ]) {
  4293. unset %startup. [ $+ [ %ipp ] ]
  4294. if ($readini($gfile(gatherstatus.ini),%ipp,map)) {
  4295. var %map = $ifmatch
  4296. if ($workshop(%ipp,%map)) { var %x = $remove($ifmatch,workshop/) | rconsend %ipp host_workshop_map %x } | else { rconsend %ipp changelevel %map }
  4297. }
  4298. .timerrecheck. [ $+ [ %ipp ] ] 1 3 rechecksocket %ipp | .timer -o 1 5 rconset %ipp | return
  4299. }
  4300. if (!$sameteam($score(%ipp,total))) { var %ct = $gfile(terrorist.ini), %t = $gfile(counter.ini) } | else { var %ct = $gfile(counter.ini), %t = $gfile(terrorist.ini) }
  4301. if ($gatherinfo(amx)) {
  4302. if ($readini(%ct,%ipp,%steamid)) { rconsend %ipp amx_team $+($chr(35),%userid) CT } | elseif ($readini(%t,%ipp,%steamid)) { rconsend %ipp amx_team $+($chr(35),%userid) T }
  4303. var %record = $recordname(%ipp,%steamid) | rconsend %ipp amx_record $+($chr(35),%userid) $+(",%record,")
  4304. }
  4305. .timer -o 1 1 rconsend %ipp say $gnick(%steamid) joined ( $+ $ini($gfile(joined.ini),%ipp,0) $+ / $+ $ini($gfile(players.ini),%ipp,0) $+ )
  4306. }
  4307. elseif ($admin($+($chr(35),$gauth(%steamid))) >= 8) {
  4308. writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR | rconsend %ipp say Admin: $gnick(%steamid) joined the server!
  4309. if ($gatherinfo(amx)) { rconsend %ipp amx_team $+($chr(35),%userid) SPEC }
  4310. }
  4311. elseif ($admin($+($chr(35),$gauth(%steamid))) >= 6) {
  4312. writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR | rconsend %ipp say VIP: $gnick(%steamid) joined the server!
  4313. if ($gatherinfo(amx)) { rconsend %ipp amx_team $+($chr(35),%userid) SPEC }
  4314. }
  4315. elseif ($tempplayers(%ipp)) { if (%steamid) { set -z %tempreg. [ $+ [ %steamid ] ] 60 | .timer $+ $+(%ipp,.,%steamid) 1 65 tempcheck %ipp } }
  4316. else { rconsend %ipp kickid %steamid Not signed to gather! | rconsend %ipp say $gnick(%steamid) ( $+ %steamid $+ ) got auto kicked }
  4317. }
  4318. return
  4319. }
  4320.  
  4321. if (connected, address isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4322. var %hltv = $remove($gettok(%temp. [ $+ [ %ipp ] ],3,60),$chr(62))
  4323. if (%hltv != HLTV) && (%hltv != BOT) {
  4324. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ]), %nick = $getname(%temp. [ $+ [ %ipp ] ]), %addr = $gettok(%temp. [ $+ [ %ipp ] ],3,34), %addr2 = $gettok(%addr,1,58)
  4325. if (%addr2) { writeini -n $gfile(userdata.ini) %steamid ipaddress %addr2 } | writeini -n $gfile(userdata.ini) %steamid ingamenick %nick
  4326. if (%addr2) && ($ipbanned(%addr2)) { var %id = $ifmatch, %team = $null, %tid = $readini($gfile(gatherbans.ini),%id,tid)
  4327. if (%id != %steamid) { rconsend %ipp kickid %steamid IP Banned!
  4328. if ($readini($gfile(players.ini),%ipp,%steamid)) { remini -n $gfile(players.ini) %ipp %steamid
  4329. if ($readini($gfile(counter.ini),%ipp,%steamid)) { remini -n $gfile(counter.ini) %ipp %steamid | var %team = ct } | if ($readini($gfile(terrorist.ini),%ipp,%steamid)) { remini -n $gfile(terrorist.ini) %ipp %steamid | var %team = t }
  4330. if (%team) { if (!$sameteam($score(%ipp,total))) { fastsub %ipp $iif(%team == ct,t,ct) 1 } | else { fastsub %ipp %team 1 } }
  4331. writeini -n $gfile(gatherbans.ini) %steamid admin :gatherbot: | writeini -n $gfile(gatherbans.ini) %steamid tid %tid | writeini -n $gfile(gatherbans.ini) %steamid type IP Ban
  4332. writeini -n $gfile(gatherbans.ini) %steamid grund IP banned on another user [Steamid: %id $+ $chr(93) | writeini -n $gfile(gatherbans.ini) %steamid date $ctime
  4333. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans %steamid %steamid | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  4334. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) bans steamid %steamid | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  4335. whatcmd $meorsay $mainchan $logo $anick($gauth(%steamid)) got auto banned, since he is IP banned [Steamid: %id $+ $chr(93) $split Gatheradmin: $anick($gauth($gatherstatus(%ipp,admin))) $logo
  4336. gatherbans
  4337. }
  4338. }
  4339. elseif ($readini($gfile(kicked.ini),%ipp,%steamid)) { rconsend %ipp kickid %steamid Kicked! }
  4340. elseif ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) { writeini -n $gfile(joined.ini) %ipp %steamid Connecting }
  4341. elseif ($tempplayers(%ipp)) && (%steamid) { set -z %tempreg. [ $+ [ %steamid ] ] 60 | .timer $+ $+(%ipp,.,%steamid) 1 65 tempcheck %ipp }
  4342. }
  4343. elseif ($readini($gfile(kicked.ini),%ipp,%steamid)) { rconsend %ipp kickid %steamid Kicked! }
  4344. elseif ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) { writeini -n $gfile(joined.ini) %ipp %steamid Connecting }
  4345. elseif ($tempplayers(%ipp)) && (%steamid) { set -z %tempreg. [ $+ [ %steamid ] ] 60 | .timer $+ $+(%ipp,.,%steamid) 1 65 tempcheck %ipp }
  4346. }
  4347. return
  4348. }
  4349.  
  4350. if (disconnected isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4351. var %hltv = $remove($gettok(%temp. [ $+ [ %ipp ] ],3,60),$chr(62))
  4352. if (%hltv != HLTV) && (%hltv != BOT) && (%gatherstatus != Ended) {
  4353. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %nick = $getname(%temp. [ $+ [ %ipp ] ]), %reason = $gettok(%temp. [ $+ [ %ipp ] ],3,34)
  4354. set -z %disconnected. [ $+ [ %steamid ] ] 3 | logit %ipp %nick ( $+ $gauth(%steamid) $+ ) left the server with reason: %reason
  4355. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) left the server with reason: %reason }
  4356. if (%nick) && ($readini($gfile(userdata.ini),%steamid,ingamenick) != %nick) { writeini -n $gfile(userdata.ini) %steamid ingamenick %nick }
  4357. if ($readini($gfile(joined.ini),%ipp,%steamid)) { remini -n $gfile(joined.ini) %ipp %steamid }
  4358. if ($readini($gfile(ready.ini),%ipp,%steamid)) { remini -n $gfile(ready.ini) %ipp %steamid }
  4359. if (%gatherstatus != Ended) && ($readini($gfile(players.ini),%ipp,%steamid)) { var %tid = $ifmatch
  4360. var %new = $calc($ctime +300) | if (%new > %tid) || (%tid !isnum) { writeini -n $gfile(players.ini) %ipp %steamid %new | gathertimeout %ipp }
  4361. if ($timer(lantjek. [ $+ [ %ipp ] ])) { .timerlantjek. [ $+ [ %ipp ] ] off }
  4362. rconsend %ipp say %nick ( $+ $gnick(%steamid) $+ ) left the server
  4363. }
  4364. }
  4365. return
  4366. }
  4367.  
  4368. if (committed suicide with isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4369. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %team = $getteam(%temp. [ $+ [ %ipp ] ]), %nick = $getname(%temp. [ $+ [ %ipp ] ])
  4370. if (%gatherstatus == Started) && ($readini($gfile(players.ini),%ipp,%steamid)) {
  4371. if (%team == Terrorists) { var %team = TERRORIST }
  4372. if (%team == Counter-Terrorists) { var %team = CT }
  4373. writeini -n %gamestats %steamid Points $calc($readini(%gamestats,%steamid,Points) -0.8)
  4374. writeini -n %gamestats %steamid Deaths $calc($readini(%gamestats,%steamid,Deaths) +1) | writeini -n $gfile(kills.ini) %ipp %team $calc($readini($gfile(kills.ini),%ipp,%team) +1)
  4375. if (%nick) && ($readini($gfile(userdata.ini),%steamid,ingamenick) != %nick) { writeini -n $gfile(userdata.ini) %steamid ingamenick %nick }
  4376. return
  4377. var %ini = $assini(%ipp)
  4378. if ($ini(%ini,%steamid)) {
  4379. var %i = 1, %n = $ini(%ini,%steamid,0) | while (%i <= %n) { var %x = $ini(%ini,%steamid,%i), %dmg = $readini(%ini,%steamid,%x)
  4380. if (%dmg >= 40) && (%x != %steamid) {
  4381. writeini -n %gamestats %x Assists $calc($readini(%gamestats,%x,Assists) +1)
  4382. writeini -n %gamestats %x Points $calc($readini(%gamestats,%x,Points) +0.3)
  4383. }
  4384. inc %i
  4385. }
  4386. remini -n %ini %steamid
  4387. }
  4388. }
  4389. return
  4390. }
  4391.  
  4392. if (changed name to isin $gettok(%temp. [ $+ [ %ipp ] ],2,34)) {
  4393. var %steamid = $getsteamid(%temp. [ $+ [ %ipp ] ]), %userid = $getuserid(%temp. [ $+ [ %ipp ] ]), %name = $gettok(%temp. [ $+ [ %ipp ] ],3,34), %aname = $getname(%temp. [ $+ [ %ipp ] ])
  4394. if ($readini($gfile(players.ini),%ipp,%steamid)) {
  4395. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) $anick(%steamid) changed name from " $+ %aname $+ " to " $+ %name $+ " }
  4396. writeini -n $gfile(userdata.ini) %steamid ingamenick %name
  4397. }
  4398. return
  4399. }
  4400. if (*userid name uniqueid connected ping loss state adr* iswm $1-) { set -u10 %consolestatus. [ $+ [ %ipp ] ] 1
  4401. if (!%kick. [ $+ [ %ipp ] ]) && (!%check. [ $+ [ %ipp ] ]) && (!%tempcheck. [ $+ [ %ipp ] ]) && (!%whois. [ $+ [ %ipp ] ]) && (!%lancheck. [ $+ [ %ipp ] ]) && (!%startkick. [ $+ [ %ipp ] ]) && (!%endkick. [ $+ [ %ipp ] ]) {
  4402. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) %temp. [ $+ [ %ipp ] ] }
  4403. }
  4404. .timerend. [ $+ [ %ipp ] ] -m 1 500 endstatus %ipp | return
  4405. }
  4406. if (*userid name uniqueid connected ping loss state rate adr* iswm $1-) { set -u10 %consolestatus. [ $+ [ %ipp ] ] 1
  4407. if ($readini($gfile(gatherstatus.ini),$1,startlink)) { remini -n $gfile(gatherstatus.ini) $1 startlink }
  4408. if (!%kick. [ $+ [ %ipp ] ]) && (!%check. [ $+ [ %ipp ] ]) && (!%tempcheck. [ $+ [ %ipp ] ]) && (!%whois. [ $+ [ %ipp ] ]) && (!%lancheck. [ $+ [ %ipp ] ]) && (!%startkick. [ $+ [ %ipp ] ]) && (!%endkick. [ $+ [ %ipp ] ]) {
  4409. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) %temp. [ $+ [ %ipp ] ] }
  4410. }
  4411. return
  4412. }
  4413. if (*STEAM_*:*:* iswm $gettok($gettok(%temp. [ $+ [ %ipp ] ],3,34),1,32)) && (%consolestatus. [ $+ [ %ipp ] ]) {
  4414. var %userid = $remove($gettok($gettok(%temp. [ $+ [ %ipp ] ],1,34),1,32),$chr(35)), %nick = $gettok(%temp. [ $+ [ %ipp ] ],2,34), %info = $gettok(%temp. [ $+ [ %ipp ] ],3,34)
  4415. var %steamid = $gettok(%info,1,32), %ipadr = $gettok($gettok(%info,7,32),1,58), %name = $remove($gnick(%steamid),$chr(35)), %auth = $gauth(%steamid)
  4416. if ($timer(end. [ $+ [ %ipp ] ])) { .timerend. [ $+ [ %ipp ] ] -m 1 500 endstatus %ipp }
  4417. if (%userid !isnum) { var %userid = $remove($gettok($gettok(%temp. [ $+ [ %ipp ] ],1,34),2,32),$chr(35)) }
  4418. if (!%ipadr) { var %ipadr = $gettok($gettok(%info,6,32),1,58) }
  4419. if (*.* iswm %ipadr) {
  4420. writeini -n $gfile(userdata.ini) %steamid ipaddress %ipadr
  4421. if ($ipbanned(%ipadr)) { var %id = $ifmatch, %team = $null, %tid = $readini($gfile(gatherbans.ini),%id,tid)
  4422. if (%id != %steamid) { rconsend %ipp kickid %steamid IP Banned!
  4423. if ($readini($gfile(joined.ini),%ipp,%steamid)) { remini -n $gfile(joined.ini) %ipp %steamid }
  4424. if ($readini($gfile(players.ini),%ipp,%steamid)) { remini -n $gfile(players.ini) %ipp %steamid
  4425. if ($readini($gfile(counter.ini),%ipp,%steamid)) { remini -n $gfile(counter.ini) %ipp %steamid | var %team = ct }
  4426. if ($readini($gfile(terrorist.ini),%ipp,%steamid)) { remini -n $gfile(terrorist.ini) %ipp %steamid | var %team = t }
  4427. if (%team) { if (!$sameteam($score(%ipp,total))) { fastsub %ipp $iif(%team == ct,t,ct) 1 } | else { fastsub %ipp %team 1 } }
  4428. writeini -n $gfile(gatherbans.ini) %steamid admin :gatherbot: | writeini -n $gfile(gatherbans.ini) %steamid tid %tid | writeini -n $gfile(gatherbans.ini) %steamid type IP Ban
  4429. writeini -n $gfile(gatherbans.ini) %steamid grund IP banned on another user [Steamid: %id $+ $chr(93) | writeini -n $gfile(gatherbans.ini) %steamid date $ctime
  4430. if ($gatherinfo(php.exe)) { writeini -n $gfile($php.ini) bans %steamid %steamid | .timerphp.exe -o 1 0 run $+(",$php.exe,") -f $+(",$mircdir,$gfile($php.file),") }
  4431. if ($gatherinfo(mysql.exe)) { writeini -n $gfile(upload.ini) bans steamid %steamid | .timer -o 1 0 run -p $+(",$mircdir,$gdir,MySQL.exe,") }
  4432. whatcmd $meorsay $mainchan $logo $anick($gauth(%steamid)) got auto banned, since he is IP banned [Steamid: %id $+ $chr(93) $split Gatheradmin: $anick($gauth($gatherstatus(%ipp,admin))) $logo
  4433. gatherbans
  4434. }
  4435. return
  4436. }
  4437. }
  4438. }
  4439. if (%tempcheck. [ $+ [ %ipp ] ]) {
  4440. if ($tempplayers(%ipp)) && (%tempreg. [ $+ [ %steamid ] ]) { rconsend %ipp say %nick got $duration(%tempreg. [ $+ [ %steamid ] ]) left to authenticate }
  4441. elseif ($readini($gfile(kicked.ini),%ipp,%steamid)) { rconsend %ipp kick $+($chr(35),%userid) Kicked! }
  4442. elseif ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) { writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR }
  4443. elseif ($admin($+($chr(35),$gauth(%steamid))) >= 8) { writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR | rconsend %ipp say Admin: $gnick(%steamid) joined the server! }
  4444. elseif ($admin($+($chr(35),$gauth(%steamid))) >= 6) { writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR | rconsend %ipp say VIP: $gnick(%steamid) joined the server! }
  4445. elseif ($tempplayers(%ipp)) && (%tempreg. [ $+ [ %steamid ] ]) { rconsend %ipp say %nick got $duration(%tempreg. [ $+ [ %steamid ] ]) left to authenticate }
  4446. else { rconsend %ipp kickid %steamid not signed to gather! | rconsend %ipp say $gnick(%steamid) ( $+ %steamid $+ ) got auto kicked }
  4447. }
  4448. if (%check. [ $+ [ %ipp ] ]) {
  4449. if ($tempplayers(%ipp)) && (%tempreg. [ $+ [ %steamid ] ]) { rconsend %ipp say %nick got $duration(%tempreg. [ $+ [ %steamid ] ]) left to authenticate }
  4450. elseif (!$readini($gfile(joined.ini),%ipp,%steamid)) {
  4451. if ($readini($gfile(kicked.ini),%ipp,%steamid)) { rconsend %ipp kick $+($chr(35),%userid) Kicked! }
  4452. elseif ($readini($gfile(players.ini),%ipp,%steamid)) || (%steamid == $gatherstatus(%ipp,admin)) { writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR }
  4453. elseif ($admin($+($chr(35),$gauth(%steamid))) >= 8) { writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR | rconsend %ipp say Admin: $gnick(%steamid) joined the server! }
  4454. elseif ($admin($+($chr(35),$gauth(%steamid))) >= 6) { writeini -n $gfile(joined.ini) %ipp %steamid SPECTATOR | rconsend %ipp say VIP: $gnick(%steamid) joined the server! }
  4455. elseif ($tempplayers(%ipp)) && (%tempreg. [ $+ [ %steamid ] ]) { rconsend %ipp say %nick got $duration(%tempreg. [ $+ [ %steamid ] ]) left to authenticate }
  4456. else { rconsend %ipp kickid %steamid not signed to gather! | rconsend %ipp say $gnick(%steamid) ( $+ %steamid $+ ) got auto kicked }
  4457. }
  4458. }
  4459. if (%forceteams. [ $+ [ %ipp ] ]) && (!%tempreg. [ $+ [ %steamid ] ]) {
  4460. var %team = $iif($readini($gfile(joined.ini),%ipp,%steamid),$ifmatch,SPECTATOR) | if (%team != Connecting) {
  4461. if (!$sameteam($score(%ipp,total))) { var %ct = $gfile(terrorist.ini), %t = $gfile(counter.ini) } | else { var %ct = $gfile(counter.ini), %t = $gfile(terrorist.ini) }
  4462. if ($readini(%ct,%ipp,%steamid)) && (%team != CT) { rconsend %ipp amx_team $+($chr(35),%userid) CT }
  4463. elseif ($readini(%t,%ipp,%steamid)) && (%team != TERRORIST) { rconsend %ipp amx_team $+($chr(35),%userid) T }
  4464. }
  4465. }
  4466. if (%kick. [ $+ [ %ipp ] ]) {
  4467. var %admin = $gettok(%kick. [ $+ [ %ipp ] ],1,32), %kicknick = $gettok(%kick. [ $+ [ %ipp ] ],2-,32), %len = $len(%kicknick), %fnick = $left(%nick,%len)
  4468. if ($+(*,%kicknick,*) iswm %nick) || (%kicknick == %fnick) || (%steamid == %kicknick) || (%userid isnum $remove(%kicknick,$chr(35))) {
  4469. writeini -n $gfile(kicked.ini) %ipp %steamid %steamid | if ($readini($gfile(joined.ini),%ipp,%steamid)) { remini -n $gfile(joined.ini) %ipp %steamid }
  4470. rconsend %ipp kickid %steamid Kicked! | unset %kick. [ $+ [ %ipp ] ] | unset %consolestatus. [ $+ [ %ipp ] ] | gatherkickban %ipp %steamid %admin
  4471. rconsend %ipp say $gnick(%steamid) got kicked by $gnick($gauth(%admin))
  4472. }
  4473. }
  4474. elseif (%startkick. [ $+ [ %ipp ] ]) && (!$readini($gfile(players.ini),%ipp,%steamid)) { rconsend %ipp kickid %steamid Gather started }
  4475. elseif (%endkick. [ $+ [ %ipp ] ]) { rconsend %ipp kickid %steamid Gather ended }
  4476. elseif (%lancheck. [ $+ [ %ipp ] ]) && (*.* iswm %ipadr) {
  4477. if (!$readini($gfile(lancheck.ini),%ipp,%ipadr)) { writeini -n $gfile(lancheck.ini) %ipp %ipadr %ipadr }
  4478. if (!$readini($gfile(lancheck.ini),%ipadr,%steamid)) { writeini -n $gfile(lancheck.ini) %ipadr %steamid %steamid }
  4479. }
  4480. elseif (%whois. [ $+ [ %ipp ] ]) {
  4481. var %len = $len(%whois. [ $+ [ %ipp ] ]), %fnick = $left(%nick,%len)
  4482. if ($+(*,%whois. [ $+ [ %ipp ] ],*) iswm %nick) || (%fnick == %whois. [ $+ [ %ipp ] ]) || (%steamid == %whois. [ $+ [ %ipp ] ]) || (%userid isnum $remove(%whois. [ $+ [ %ipp ] ],$chr(35))) {
  4483. rconsend %ipp say %nick known as $gnick(%steamid) ( $+ %steamid $+ ) | unset %whois. [ $+ [ %ipp ] ] | unset %consolestatus. [ $+ [ %ipp ] ]
  4484. }
  4485. }
  4486. elseif ($gatherinfo(schat)) && (!%check. [ $+ [ %ipp ] ]) && (!%tempcheck. [ $+ [ %ipp ] ]) && (!%forceteams. [ $+ [ %ipp ] ]) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) %temp. [ $+ [ %ipp ] ] }
  4487. return
  4488. }
  4489. if (*end iswm %temp. [ $+ [ %ipp ] ]) && (%consolestatus. [ $+ [ %ipp ] ]) {
  4490. unset %consolestatus. [ $+ [ %ipp ] ] | .timerend. [ $+ [ %ipp ] ] off
  4491. if (!%kick. [ $+ [ %ipp ] ]) && (!%check. [ $+ [ %ipp ] ]) && (!%whois. [ $+ [ %ipp ] ]) && (!%forceteams. [ $+ [ %ipp ] ]) && (!%lancheck. [ $+ [ %ipp ] ]) && (!%startkick. [ $+ [ %ipp ] ]) && (!%endkick. [ $+ [ %ipp ] ]) {
  4492. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) %temp. [ $+ [ %ipp ] ] }
  4493. }
  4494. if (%kick. [ $+ [ %ipp ] ]) { rconsend %ipp say $gettok(%kick. [ $+ [ %ipp ] ],2-,32) was not found! | unset %kick. [ $+ [ %ipp ] ] }
  4495. if (%whois. [ $+ [ %ipp ] ]) { rconsend %ipp say User was not found! | unset %whois. [ $+ [ %ipp ] ] }
  4496. if (%check. [ $+ [ %ipp ] ]) { unset %check. [ $+ [ %ipp ] ] }
  4497. if (%forceteams. [ $+ [ %ipp ] ]) { unset %forceteams. [ $+ [ %ipp ] ] }
  4498. if (%lancheck. [ $+ [ %ipp ] ]) { lancheck %ipp | unset %lancheck. [ $+ [ %ipp ] ] }
  4499. if (%startkick. [ $+ [ %ipp ] ]) { unset %startkick. [ $+ [ %ipp ] ] }
  4500. if (%endkick. [ $+ [ %ipp ] ]) { unset %endstartkick. [ $+ [ %ipp ] ] }
  4501. if (%tempcheck. [ $+ [ %ipp ] ]) { unset %tempcheck. [ $+ [ %ipp ] ] }
  4502. if (%pregame. [ $+ [ %ipp ] ]) { unset %pregame. [ $+ [ %ipp ] ] | .timer -o 1 1 pregame %ipp | .timer -o 1 2 rconsetpw %ipp }
  4503. }
  4504. }
  4505. }
  4506. alias endstatus {
  4507. var %ipp = $1, %idd = $serverid(%ipp), %temp. [ $+ [ %ipp ] ] $chr(35) end | unset %consolestatus. [ $+ [ %ipp ] ]
  4508. if (!%kick. [ $+ [ %ipp ] ]) && (!%check. [ $+ [ %ipp ] ]) && (!%tempcheck. [ $+ [ %ipp ] ]) && (!%whois. [ $+ [ %ipp ] ]) && (!%forceteams. [ $+ [ %ipp ] ]) && (!%lancheck. [ $+ [ %ipp ] ]) && (!%startkick. [ $+ [ %ipp ] ]) && (!%endkick. [ $+ [ %ipp ] ]) {
  4509. if ($gatherinfo(schat)) { schatsend $+(0,$chr(44),%idd,Server) $+($chr(35),%idd,:,$col(end)) %temp. [ $+ [ %ipp ] ] }
  4510. }
  4511. if (%kick. [ $+ [ %ipp ] ]) { rconsend %ipp say $gettok(%kick. [ $+ [ %ipp ] ],2-,32) was not found | unset %kick. [ $+ [ %ipp ] ] }
  4512. if (%whois. [ $+ [ %ipp ] ]) { rconsend %ipp say User was not found! | unset %whois. [ $+ [ %ipp ] ] }
  4513. if (%check. [ $+ [ %ipp ] ]) { unset %check. [ $+ [ %ipp ] ] }
  4514. if (%forceteams. [ $+ [ %ipp ] ]) { unset %forceteams. [ $+ [ %ipp ] ] }
  4515. if (%lancheck. [ $+ [ %ipp ] ]) { lancheck %ipp | unset %lancheck. [ $+ [ %ipp ] ] }
  4516. if (%startkick. [ $+ [ %ipp ] ]) { unset %startkick. [ $+ [ %ipp ] ] }
  4517. if (%endkick. [ $+ [ %ipp ] ]) { unset %endstartkick. [ $+ [ %ipp ] ] }
  4518. if (%tempcheck. [ $+ [ %ipp ] ]) { unset %tempcheck. [ $+ [ %ipp ] ] }
  4519. if (%pregame. [ $+ [ %ipp ] ]) { unset %pregame. [ $+ [ %ipp ] ] | .timer -o 1 1 pregame %ipp | .timer -o 1 2 rconsetpw %ipp }
  4520. }
  4521.  
  4522. alias playedup {
  4523. if ($gatherinfo(ftp)) {
  4524. var %ftp = $ifmatch, %host = $gettok(%ftp,1,32), %user = $gettok(%ftp,2,32), %pass = $gettok(%ftp,3,32), %dir = $gettok(%ftp,4,32), %url = $gettok(%ftp,5,32)
  4525.  
  4526. write playedinfo.html <div style="font-family: Arial, Helvetica, sans-serif; color: #555555; font-size: 14px;line-height: 1.5em;">I Dag: $gatherstats(chan,Today)</div>
  4527. write playedinfo.html <div style="font-family: Arial, Helvetica, sans-serif; color: #555555; font-size: 14px;line-height: 1.5em;">I G $+ &aring; $+ r: $gatherstats(chan,lastday)</div>
  4528. write playedinfo.html <div style="font-family: Arial, Helvetica, sans-serif; color: #555555; font-size: 14px;line-height: 1.5em;">Denne uge: $gatherstats(chan,Thisweek)</div>
  4529. write playedinfo.html <div style="font-family: Arial, Helvetica, sans-serif; color: #555555; font-size: 14px;line-height: 1.5em;">Denne m $+ &aring; $+ ned: $gatherstats(chan,Jan)</div>
  4530. write playedinfo.html <div style="font-family: Arial, Helvetica, sans-serif; color: #555555; font-size: 14px;line-height: 1.5em;">Total spillet: $gatherstats(chan,Played)</div>
  4531. write playedinfo.html <div style="font-family: Arial, Helvetica, sans-serif; color: #555555; font-size: 14px;line-height: 1.5em;">Antal registeret: $lines($gfile(gatherusers.dat))</div>
  4532.  
  4533. write -c upload.txt open %host | write upload.txt %user | write upload.txt %pass | write upload.txt bin | write upload.txt cd /var/www/html/stats
  4534. write upload.txt dele playedinfo.html | write upload.txt put playedinfo.html | write upload.txt quit | write -c upload.bat @echo off | write upload.bat ftp -i -s:"upload.txt"
  4535. write upload.bat del upload.txt | write upload.bat del playedinfo.html | write upload.bat del upload.bat | .timer 1 0 run upload.bat
  4536. }
  4537. }
Add Comment
Please, Sign In to add comment