HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #define PLUGINNAME "Last man bets"
  2. #define VERSION "0.9.3"
  3. #define AUTHOR "JGHG"
  4.  
  5. /*
  6. Copyleft 2004-2005
  7. AMX Mod X versions:
  8. http://www.amxmodx.org/forums/viewtopic.php?p=26590
  9.  
  10. Idea from miscstats' "Lastman" (by Olo?)
  11.  
  12.  
  13. LAST MAN BETS
  14. =============
  15. When two people remain, one on each team, the other players will have the chance to bet a sum of money on who will win the round.
  16. You have to have a minimum of $100 (adjustable through a cvar) to place a bet, but then you can raise your bet as much as your wallet performs.
  17. If your bet wins, you win the other betters money. The more you bet, the more you win. If you win. :-)
  18. Everything is completely menu driven, no need to learn any commands or anything.
  19. Bots bet automatically.
  20.  
  21. Pots: If no one bets on winning player, all failing bets will be added to the pot. The next player to win a bet (win the most money, if more win the same bet), gets the pot.
  22. If pot is not collected before map ends/server shuts down/crashes ;-) it will be there for next map.
  23.  
  24. Example: If you bet $200 on the t player, and another person bets $100 on the t player, and the t player wins, you will receive 2/3rds of the total sum of money bet by all players.
  25.  
  26. Winning over $16000: Win prizes (optional)! For the money you win over $16000, you receive something:
  27.  
  28. For each You receive
  29. ---------------------------
  30. $1000 Xtra life (respawn as long as round did not end when you died, a note to all players go out that you respawned - and how many lives you have left)
  31. $100 Health boost (+100 health when spawning)
  32. $10 Assault suit (if you don't have 100 armour when spawning, you will be given a full assault suit)
  33.  
  34.  
  35.  
  36. INSTALLATION
  37. ============
  38. Before you install as usual, you might want to go through a couple of defines below. See "Adjust below settings to your liking".
  39.  
  40.  
  41. USAGE
  42. =====
  43. No commands or anything. Betting is done through menus that pop up...
  44.  
  45. There are three cvars:
  46. - lastmanbets_overridemenus
  47. Default value is 1. You can set this to 0 so that if a player already has a menu open (amxmodmenu, wc3 menu, etc) the bet menu should not open. Note, from version 0.9 this always overrides VGUI menus due to some bug with detection of those.
  48.  
  49. - lastmanbets_defaultbet
  50. Default value is 100. This value is the amount of $ needed to be able to place the minimum bet. It also defines the base for increments when raising/lowering bets.
  51.  
  52. - lastmanbets_bettime
  53. Default value is 20 (seconds). Defines how long time the bet menu will stay open - a timer counts down in center of screen. When it reaches 0 whoever still has the bet menu open will have it closed.
  54.  
  55.  
  56. VERSIONS
  57. ========
  58. Released Version Comment
  59. 050218 0.9.3 Don't respawn as spectator if having extra lives. Thanks "peoplerpoop".
  60. 050130 0.9.2 Removed two tag mismatches...
  61. 040716 0.9.2 Made some easy-to-edit defines to change how much each prize will cost you.
  62. 040715 0.9.1 As betting progresses, a red/blue hud message displays how much money was bet on each player, and how many bets each player got so far. Hudchannels can be tweaked.
  63. 040616 0.9 Added menu timer + cvar.
  64. Fixed another bug that made the bet menu not show properly when lastmanbets_overridemenus was not set. Sometimes VGUI menu was detected as open on a player,
  65. however the player did not have any menu at all open. VGUI menus are now always overridden.
  66. 040613 0.81 Fixed override cvar - looks like it worked the opposite way.
  67. * Note that a typo in the cvar name itself was corrected: lastmanbets_overridemenus <---
  68. 040612 0.8 Betting wouldn't work at all when prizes were disabled. :-)
  69. 040611 0.7 Moved around some code, it's possible now to compile it all without prizes by commenting a define.
  70. Can now also be compiled in debugmode. Debugmode should output (to server console) what players get the menu, and who doesn't and why they didn't.
  71. Possible bugfíx (didn't see the bug in action...): when someone respawns, it should now be impossible for the bettings to start because that player just died.
  72. Pot now saves to vault, so if it's not collected when map ends it will still be there for next map.
  73. 040607 0.6.1 Another try to fix the bug people are having with the menu never showing up (removed all uses of get_players)
  74. 040604 0.6 Bots supposedly didn't bet with lastmanbets_overridemenus set to 1. Fixed.
  75. Prizes added.
  76. Got some odd behaviour suddenly from a native (get_players) when bets were about to start, decided to scrap it and do things manually :-P.
  77. 040601 0.5 After round ended (bomb exploded, defused, hostages rescued etc), bets could still be started briefly if a 1vs1 situation appeared, ie
  78. if someone killed someone after round ended. Should be fixed.
  79. Other tweaks and bug fixes.
  80. Added two new options when betting for faster "wild" betting.
  81. Made cvar lastmanbets_defaultbet.
  82. 040531 0.4.2 Added lastmanbets_overridemenus cvar.
  83. 040530 0.4.1 If a user already has a menu open, no betting menu will open for that user.
  84. 040530 0.4 Bet menu should now close by itself when rounds end and you didn't place a bet fast enough.
  85. 040528 0.3 Added pot.
  86. Small bugfix, thx to Martel.
  87. 040518 0.2 At draw, it should pay any bet money back... (when do you get draws in CS btw?)
  88. A couple fixes here and there
  89. Bots do way cooler betting now.
  90. 040517 0.1 First version
  91.  
  92.  
  93. TO DO
  94. =====
  95. - bet against the odds
  96. - redo the now IMO somewhat ugly menu
  97. - verbose output of bets, prizes, stats..? Keep history, like top-ten most rewarding wins? Ever, and for current map...? (And output who killed who etc :-)
  98. - max time, like 20 seconds, to bet, else menu closes
  99.  
  100. - Johnny got his gun
  101. */
  102.  
  103. #include <amxmodx>
  104. #include <amxmisc>
  105. #include <cstrike>
  106. #include <fun>
  107.  
  108. // ---------- Adjust below settings to your liking ---------------------------------------
  109. //#define DEBUGMODE // remove this comment to compile in debugmode
  110. #define IWANTPRIZES // comment this if you don't want prizes
  111. #define XTRA_HEALTHBOOST 100 // how much extra health a health boost prize should give
  112. // When you win money over $16000, the plugin automatically "buys" you prizes for that money until that money is all used up.
  113. // You can change these values. Ie by default an extra life costs 1000, extra health 100 and armour 10. The plugin first tries to buy you as many extra lives
  114. // it can (ie until less than $1000 remains), then goes on to buy extra health, and then extra armour. With that said, make sure extra life is still the most expensive
  115. // and extra armour the cheapest prize, or you will run into trouble.
  116. #define PRIZEPRICE_EXTRALIFE 1000
  117. #define PRIZEPRICE_EXTRAHEALTH 100
  118. #define PRIZEPRICE_EXTRAARMOUR 10
  119.  
  120. #define HUDCHANNEL_T 2 // Hud channels. You probably don't need to change these, but you can if you find that some of hud-displaying plugins are interfered
  121. #define HUDCHANNEL_CT 3 // by the red/blue messages telling how much each player was bet on.
  122. #define HUDMESSAGE_HOLDTIME 25.0 // For how many seconds (after last placed bet) should the red/blue messages stay onscreen. Must be a float (end with a decimal) value.
  123.  
  124.  
  125. // __________________Bot settings here (you don't need to touch these)__________________
  126. // A bot can be a "gambler", betting on the person with the lowest sum of HP and armour, else he's playing it "safe". To become a gambler
  127. // each bot needs to get a random value below a certain (individual) value. This value in turn is gotten by choosing a random value between BOTGAMBLERMIN and BOTGAMBLERMAX.
  128. // Ie the bot gamble value could end up as 0.3, and then it's a 30% chance that the bot will bet on the weaker remaining player.
  129. #define BOTGAMBLERMAX 0.4
  130. #define BOTGAMBLERMIN 0.1
  131. // A random float from 0.0 to 1.0 decides how much $ a bot will bet. A setting will be used if the random float ends at least this value.
  132. #define RATIO_HIGH 0.9
  133. #define RATIO_MEDIUM 0.6
  134. // Depending on ratio, this is how much of the bot's current money the bot will bet. MAXBET_LOW can at most let the bot set about one third of his total money sum.
  135. #define MAXBET_LOW 0.3 // about one third here
  136. #define MAXBET_MEDIUM 0.5 // half money maximum here
  137. #define MAXBET_HIGH 1.0 // bot could bet all of his money here
  138. // ---------- Adjust above settings to your liking ---------------------------------------
  139.  
  140. #define MENUBUTTON1 (1<<0)
  141. #define MENUBUTTON2 (1<<1)
  142. #define MENUBUTTON3 (1<<2)
  143. #define MENUBUTTON4 (1<<3)
  144. #define MENUBUTTON5 (1<<4)
  145. #define MENUBUTTON6 (1<<5)
  146. #define MENUBUTTON7 (1<<6)
  147. #define MENUBUTTON8 (1<<7)
  148. #define MENUBUTTON9 (1<<8)
  149. #define MENUBUTTON0 (1<<9)
  150. #define MENUSELECT1 0
  151. #define MENUSELECT2 1
  152. #define MENUSELECT3 2
  153. #define MENUSELECT4 3
  154. #define MENUSELECT5 4
  155. #define MENUSELECT6 5
  156. #define MENUSELECT7 6
  157. #define MENUSELECT8 7
  158. #define MENUSELECT9 8
  159. #define MENUSELECT0 9
  160. #define TEAM_T 1
  161. #define TEAM_CT 2
  162.  
  163. // Time in seconds (must be float) from 1vs1 situation appears until bettings start - if the player that died when it was 2vs1 has respawned, the betting will be called off.
  164. #define INITBETTINGSTIME 1.0
  165. // Time in seconds (must be float) from a player dies until respawn, if having any extra lives. If round ended during this time, respawn will be called off. Must be lower than INITBETTINGSTIME.
  166. #define RESPAWNTIME 0.5
  167.  
  168. #define TASKID_RESPAWN 100 // just some value. don't change
  169. #define TASKID_BETTINGS 200 // don't change
  170. #define TASKID_BETTIMER 300 // don't change
  171. #define TASKID_BETTIMERDISPLAY 400 // don't change
  172.  
  173. // Hud settings
  174. #define TRED 200
  175. #define TGREEN 0
  176. #define TBLUE 0
  177. #define TX 0.25
  178.  
  179. #define CTRED 0
  180. #define CTGREEN 0
  181. #define CTBLUE 200
  182. #define CTX 0.75
  183.  
  184. #define Y 0.35
  185. #define EFFECTS 0
  186. #define FXTIME 6.0
  187. #define FADEINTIME 0.1
  188. #define FADEOUTTIME 0.2
  189.  
  190. // Global vars below
  191. //new const CT[] = "CT"
  192. //new const T[] = "TERRORIST"
  193. new const OVERRIDEPREVIOUSMENU[] = "lastmanbets_overridemenus"
  194. new const CVAR_DEFAULTBET[] = "lastmanbets_defaultbet"
  195. new const CVAR_BETTIME[] = "lastmanbets_bettime"
  196. new const VAULTKEY_POT[] = "lastmanbets_pot"
  197. new g_names[3][33]
  198. new g_betperson[33]
  199. new g_betamount[33]
  200. new g_t
  201. new g_ct
  202. new bool:g_betting = false
  203. new g_pot = 0
  204. new g_betmenu
  205. new bool:g_round
  206. enum BETSETTING {BET_LOW, BET_MEDIUM, BET_HIGH}
  207. #if defined IWANTPRIZES
  208. new g_extralives[33] = {0, ...}
  209. new g_extrahealth[33] = {0, ...}
  210. new g_extraarmour[33] = {0, ...}
  211. new bool:g_freezenewround[33] = {false, ...} // to prevent from giving prizes several times on newround (could happen ~2 times for some reason)
  212. #endif
  213. // Global vars above
  214.  
  215. public death_event() {
  216. #if defined IWANTPRIZES
  217. new victim = read_data(2) // victim needed by IWANTPRIZES and DEBUGMODE, else not
  218. //client_print(0, print_chat, "death_event, victim: %d, g_round: %d, g_extralives[victim]: %d", victim, g_round, g_extralives[victim])
  219. if (g_extralives[victim]) {
  220. new team = get_user_team(victim)
  221. if (team == TEAM_T || team == TEAM_CT) {
  222. new idd[1]
  223. idd[0] = victim
  224. set_task(RESPAWNTIME, "respawn", TASKID_RESPAWN + victim, idd, 1)
  225.  
  226. // Return here. If victim died and can respawn, this means a 1vs1 has not happened yet. Victim will not respawn if round ended - and if round ended, bet shouldn't start anyway.
  227. //client_print(0, print_chat, "death_event, end 1")
  228. return PLUGIN_CONTINUE
  229. }
  230. }
  231. #endif // defined IWANTPRIZES
  232.  
  233. if (!g_round) {
  234. //client_print(0, print_chat, "death_event, end 2")
  235. return PLUGIN_CONTINUE
  236. }
  237.  
  238. new cts[32], ts[32], ctsnum = 0, tsnum = 0
  239. new const MAXPLAYERS = get_maxplayers()
  240.  
  241. for (new i = 1; i <= MAXPLAYERS; i++) {
  242. if (!is_user_connected(i) || !is_user_alive(i))
  243. continue
  244.  
  245. switch (cs_get_user_team(i)) {
  246. case TEAM_T: ts[tsnum++] = i
  247. case TEAM_CT: cts[ctsnum++] = i
  248. default: {
  249. // A user that is not alive but not on T _or_ CT, who is he anyway?? :-)
  250. return PLUGIN_CONTINUE
  251. }
  252. }
  253.  
  254. if (tsnum > 1 || ctsnum > 1) {
  255. //client_print(0, print_chat, "Deathevent ends in loop, not 1vs1: cts: %d, ts: %d", ctsnum, tsnum)
  256. return PLUGIN_CONTINUE
  257. }
  258.  
  259. }
  260. // (These two get_players had problems in earlier versions, they are now replaced by manual code finding players)
  261. //get_players(cts, ctsnum, "ae", CT) // match alive and team
  262. //get_players(ts, tsnum, "ae", T) // match alive and team
  263.  
  264. if (ctsnum != 1 || tsnum != 1) {
  265. //client_print(0, print_chat, "death_event, end 3, cts: %d, ts: %d", ctsnum, tsnum)
  266. return PLUGIN_CONTINUE
  267. }
  268.  
  269. get_user_name(ts[0], g_names[TEAM_T], 32)
  270. get_user_name(cts[0], g_names[TEAM_CT], 32)
  271.  
  272. g_t = ts[0]
  273. g_ct = cts[0]
  274.  
  275. #if defined DEBUGMODE
  276. new victimdebug = read_data(2) // victim needed by IWANTPRIZES and DEBUGMODE, else not
  277. new victimname[32]
  278. get_user_name(victimdebug, victimname, 31)
  279. log_amx("Betting will maybe start in %f seconds (if %s that just died does not respawn, or the round ends)", INITBETTINGSTIME, victimname)
  280. #endif
  281. set_task(INITBETTINGSTIME, "initbettings", TASKID_BETTINGS)
  282.  
  283. return PLUGIN_CONTINUE
  284. }
  285.  
  286. displaybetshud() {
  287. //client_print(0, print_chat, "%s bet $%d on %s.", name, g_betamount[id], g_names[g_betperson[id]])
  288. new const MAXPLAYERS = get_maxplayers()
  289.  
  290. // First calculate how much each player has been bet on.
  291. new betamounts[2] = {0, 0}, betcount[2] = {0, 0} // t, ct
  292.  
  293. for (new i = 1; i <= MAXPLAYERS; i++) {
  294. if (!is_user_connected(i) // no one can win money from a player that has disconnected, even though he bet...
  295. || g_betperson[i] == 0) // this player didn't bet yet
  296. continue
  297.  
  298. betamounts[g_betperson[i] - 1] += g_betamount[i] // -1 because person will be a team number, either 1 (t) or 2 (ct).
  299. betcount[g_betperson[i] - 1]++
  300. }
  301.  
  302. const MESSAGESIZE = 511
  303. new tMessage[MESSAGESIZE + 1], ctMessage[MESSAGESIZE + 1]
  304.  
  305. format(tMessage, MESSAGESIZE, "%s^n$%d from %d bets", g_names[TEAM_T], betamounts[0], betcount[0])
  306. format(ctMessage, MESSAGESIZE, "%s^n$%d from %d bets", g_names[TEAM_CT], betamounts[1], betcount[1])
  307.  
  308. for (new i = 1; i <= MAXPLAYERS; i++) {
  309. if (!is_user_connected(i) || is_user_bot(i))
  310. continue
  311.  
  312. // display hud stuff to this person
  313. set_hudmessage(TRED, TGREEN, TBLUE, TX, Y, EFFECTS, FXTIME, HUDMESSAGE_HOLDTIME, FADEINTIME, FADEOUTTIME, HUDCHANNEL_T)
  314. show_hudmessage(i, tMessage)
  315.  
  316. set_hudmessage(CTRED, CTGREEN, CTBLUE, CTX, Y, EFFECTS, FXTIME, HUDMESSAGE_HOLDTIME, FADEINTIME, FADEOUTTIME, HUDCHANNEL_CT)
  317. show_hudmessage(i, ctMessage)
  318. }
  319. }
  320.  
  321. #if defined IWANTPRIZES // keeping all prizes-only functions within this big block, don't forget to move fns out of it when they are used by nonprize compiles
  322. public respawn(idd[1]) {
  323. new team = get_user_team(idd[0])
  324. if (team != TEAM_T && team != TEAM_CT)
  325. return
  326.  
  327. // Call any bets off. If we have a respawner, a 1vs1 situation is impossible.
  328.  
  329. #if defined DEBUGMODE
  330. new name[32]
  331. get_user_name(idd[0], name, 31)
  332. log_amx("%s %s %s", name, g_round ? "respawns!" : "would've respawned if the round didn't just end... no respawn this time!", task_exists(TASKID_BETTINGS) ? "A betting was about to happen but will called off." : "A betting wasn't about to happen anyway, no action taken.")
  333. #endif
  334.  
  335. if (task_exists(TASKID_BETTINGS)) // probably not entirely necessary
  336. remove_task(TASKID_BETTINGS) // this should be necessary, though
  337.  
  338. if (!g_round)
  339. return
  340.  
  341. g_extralives[idd[0]]--
  342. spawn(idd[0])
  343. new name2[32]
  344. get_user_name(idd[0], name2, 31)
  345. client_print(0, print_chat, "%s ujraeledt, van meg neki %d elete", name2, g_extralives[idd[0]])
  346. }
  347.  
  348. public client_connect(id) {
  349. resetprizes(id)
  350.  
  351. return PLUGIN_CONTINUE
  352. }
  353.  
  354. prize(id, moneyover16k) {
  355. new lives = 0, healths = 0, armours = 0, origmoney = moneyover16k
  356.  
  357. while (moneyover16k >= PRIZEPRICE_EXTRALIFE) {
  358. g_extralives[id]++
  359. moneyover16k -= PRIZEPRICE_EXTRALIFE
  360. lives++
  361. }
  362. while (moneyover16k >= PRIZEPRICE_EXTRAHEALTH) {
  363. g_extrahealth[id]++
  364. moneyover16k -= PRIZEPRICE_EXTRAHEALTH
  365. healths++
  366. }
  367. while (moneyover16k >= PRIZEPRICE_EXTRAARMOUR) {
  368. g_extraarmour[id]++
  369. moneyover16k -= PRIZEPRICE_EXTRAARMOUR
  370. armours++
  371. }
  372. client_print(id, print_chat, "Nyeresert $%d tobb mint $16000, nyertel: %d extra elet, %d elet turbo, %d pajzs", origmoney, lives, healths, armours)
  373. }
  374.  
  375. setprizes(id) {
  376. new bool:extrahealthused = false, bool:extraarmourused = false
  377. // Add extra health
  378. if (g_extrahealth[id] > 0) {
  379. g_extrahealth[id]--
  380. new idd[1]
  381. idd[0] = id
  382. set_task(0.5, "delayedhealthboost", 0, idd, 1)
  383. extrahealthused = true
  384. }
  385.  
  386. // Add extra armour
  387. new userarmour = get_user_armor(id)
  388. if (g_extraarmour[id] > 0 && userarmour < 100) {
  389. g_extraarmour[id]--
  390.  
  391. give_item(id, "item_assaultsuit")
  392. extraarmourused = true
  393. }
  394.  
  395. if (g_extralives[id] + g_extrahealth[id] + g_extraarmour[id] != 0)
  396. client_print(id, print_chat, "Hatravan meg: %d extra elet, %d elet turbo %s, %d pajzs %s", g_extralives[id], g_extrahealth[id], extrahealthused ? " (1 eppebn elhasznalva)" : "", g_extraarmour[id], extraarmourused ? " (1 eppen elhasznalva)" : "")
  397. }
  398.  
  399. public delayedhealthboost(idd[1]) {
  400. set_user_health(idd[0], get_user_health(idd[0]) + XTRA_HEALTHBOOST)
  401. }
  402.  
  403. remove_respawntasks() {
  404. for (new i = 1; i < 33; i++)
  405. remove_task(TASKID_RESPAWN + i)
  406. }
  407.  
  408. public unsetfreeze(idd[1]) {
  409. g_freezenewround[idd[0]] = false
  410. }
  411.  
  412. public restartgame_event() {
  413. for (new i = 1; i < 33; i++)
  414. resetprizes(i)
  415.  
  416. return PLUGIN_CONTINUE
  417. }
  418.  
  419. resetprizes(id) {
  420. g_extralives[id] = 0
  421. g_extrahealth[id] = 0
  422. g_extraarmour[id] = 0
  423. g_freezenewround[id] = false
  424. }
  425.  
  426. #if defined DEBUGMODE
  427. public giveprize(id, level, cid) {
  428. if (!cmd_access(id, level, cid, 4)) {
  429. return PLUGIN_HANDLED
  430. }
  431.  
  432. new giveto, theprize, prizes
  433. new buffer[10]
  434. read_argv(1, buffer, 9)
  435. giveto = str_to_num(buffer)
  436. read_argv(2, buffer, 9)
  437. theprize = str_to_num(buffer)
  438. read_argv(3, buffer, 9)
  439. prizes = str_to_num(buffer)
  440.  
  441. switch (theprize) {
  442. case 1: {
  443. g_extralives[giveto] += prizes
  444. }
  445. case 2: {
  446. g_extrahealth[giveto] += prizes
  447. }
  448. case 3: {
  449. g_extraarmour[giveto] += prizes
  450. }
  451. default: {
  452. console_print(id, "Csak 1-3 mukodik...")
  453. return PLUGIN_HANDLED
  454. }
  455.  
  456. }
  457.  
  458. console_print(id, "Adtal %d darab %d-t %d-nek.", prizes, theprize, giveto)
  459.  
  460. return PLUGIN_HANDLED
  461. }
  462.  
  463. public giveprizeall(id, level, cid) {
  464. if (!cmd_access(id, level, cid, 3)) {
  465. return PLUGIN_HANDLED
  466. }
  467.  
  468. new theprize, prizes
  469. new buffer[10]
  470. read_argv(1, buffer, 9)
  471. theprize = str_to_num(buffer)
  472. read_argv(2, buffer, 9)
  473. prizes = str_to_num(buffer)
  474.  
  475. new const MAXCLIENTS = get_maxplayers()
  476.  
  477. for (new i = 1; i <= MAXCLIENTS; i++) {
  478. if (!is_user_connected(i))
  479. continue
  480. switch (theprize) {
  481. case 1: {
  482. g_extralives[i] = prizes
  483. }
  484. case 2: {
  485. g_extrahealth[i] = prizes
  486. }
  487. case 3: {
  488. g_extraarmour[i] = prizes
  489. }
  490. default: {
  491. console_print(id, "Only 1-3 works...")
  492. return PLUGIN_HANDLED
  493. }
  494. }
  495. }
  496.  
  497. console_print(id, "Atalitva %d darab a %d-bol mindenkinek.", prizes, theprize)
  498.  
  499. return PLUGIN_HANDLED
  500. }
  501. #endif // defined DEBUGMODE
  502. #endif // defined IWANTPRIZES
  503.  
  504. public newround_event(id) {
  505. #if defined IWANTPRIZES
  506. if (g_freezenewround[id])
  507. return PLUGIN_CONTINUE
  508. //log_amx("newround_event called for %d", id)
  509.  
  510. g_freezenewround[id] = true
  511.  
  512. new idd[1]
  513. idd[0] = id
  514. set_task(1.0, "unsetfreeze", 0, idd, 1)
  515.  
  516. setprizes(id)
  517. #endif // defined IWANTPRIZES
  518.  
  519. if (!g_round)
  520. g_round = true
  521.  
  522. return PLUGIN_CONTINUE
  523. }
  524.  
  525. hudtimerstarter() {
  526. new timeend[1]
  527. timeend[0] = get_systime() + get_cvar_num(CVAR_BETTIME)
  528. hudtimerdisplay(timeend)
  529. set_task(1.0, "hudtimerdisplay", TASKID_BETTIMERDISPLAY, timeend, 1, "b")
  530. }
  531.  
  532. public hudtimerdisplay(timeend[1]) {
  533. new const MAXPLAYERS = get_maxplayers()
  534. new secondsleft = timeend[0] - get_systime()
  535. new msg[64]
  536.  
  537. if (secondsleft > 0) {
  538. msg = "Fogado Menu Megszunik %d mp Mulva!"
  539. format(msg, 63, msg, secondsleft)
  540. }
  541. else
  542. msg = "Nem voltal eleg gyors..."
  543.  
  544. new usermenu, userkeys, bool:nooneisinmenu = true
  545. for (new i = 1; i <= MAXPLAYERS; i++) {
  546. if (!is_user_connected(i) || is_user_alive(i) || is_user_bot(i))
  547. continue
  548. else
  549. nooneisinmenu = false
  550.  
  551. get_user_menu(i, usermenu, userkeys) // get user menu
  552. if (usermenu == g_betmenu) {
  553. // Display time left here
  554. client_print(i, print_center, msg)
  555. }
  556. }
  557.  
  558. // End loops if no one is in menu...
  559. if (nooneisinmenu) {
  560. remove_task(TASKID_BETTIMER)
  561. remove_task(TASKID_BETTIMERDISPLAY)
  562. }
  563. }
  564.  
  565. public initbettings() {
  566. if (!g_round) { // if round already ended, call bets off
  567. #if defined DEBUGMODE
  568. log_amx("Bettings was about to start, but the round ended, so no bettings will occur this time.")
  569. #endif
  570. return
  571. }
  572.  
  573. // Start timer here
  574. set_task(get_cvar_float(CVAR_BETTIME), "closebetmenu", TASKID_BETTIMER)
  575. hudtimerstarter()
  576.  
  577. new const DEFAULTBET = get_cvar_num(CVAR_DEFAULTBET)
  578. g_betting = true
  579.  
  580. for (new i = 1; i < 33; i++) // Reset votes
  581. g_betperson[i] = 0
  582.  
  583. new bool:overridepreviousmenu, bool:bot, currentmenu, CsTeams:team, keys
  584. if (get_cvar_num(OVERRIDEPREVIOUSMENU))
  585. overridepreviousmenu = true
  586. else
  587. overridepreviousmenu = false
  588.  
  589. new const MAXPLAYERS = get_maxplayers()
  590. #if defined DEBUGMODE
  591. log_amx("Bettings will now start. This server supports %d players.", MAXPLAYERS)
  592. new name[32]
  593. #endif
  594. for (new i = 1; i <= MAXPLAYERS; i++) {
  595. if (!is_user_connected(i) || is_user_alive(i)) { // Online, dead players only
  596. #if defined DEBUGMODE
  597. if (!is_user_connected(i)) {
  598. //log_amx("Player #%d is not connected and will not be able to vote.", i)
  599. }
  600. else {
  601. get_user_name(i, name, 31)
  602. log_amx("Player #%d (%s) is alive and will not be able to vote.", i, name)
  603. }
  604. #endif
  605. continue
  606. }
  607.  
  608. bot = bool:is_user_bot(i)
  609. if (!bot && !overridepreviousmenu) {
  610. // If already in a menu, don't bother. This isn't that important...
  611. get_user_menu(i, currentmenu, keys) // currentmenu should be 0 when user is in no menu, only then it's ok to show a bet menu :-]
  612. if (currentmenu > 0) {
  613. #if defined DEBUGMODE
  614. get_user_name(i, name, 31)
  615. log_amx("Player #%d (%s) is already in another menu (%d) - your %s cvar is defined to not show bet menu to ppl who already have a menu open. (Bet menu has id %d)", i, name, currentmenu, OVERRIDEPREVIOUSMENU, g_betmenu)
  616. #endif
  617. continue
  618. }
  619. }
  620.  
  621. // Must be on T or CT team
  622. team = cs_get_user_team(i)
  623. if (team != CS_TEAM_T && team != CS_TEAM_CT) {
  624. #if defined DEBUGMODE
  625. get_user_name(i, name, 31)
  626. log_amx("Player #%d (%s) is not on team 1 (T) or 2 (CT). Actually the player is on team %d and thus can't bet.", i, name, int:team)
  627. #endif
  628. continue
  629. }
  630.  
  631. // Must have at least DEFAULTBET dollars to participate...
  632. if (cs_get_user_money(i) < DEFAULTBET) {
  633. #if defined DEBUGMODE
  634. get_user_name(i, name, 31)
  635. log_amx("Player #%d (%s) does only have $%d, which is below the $%d needed to be able to vote.", i, name, cs_get_user_money(i), DEFAULTBET)
  636. #endif
  637. client_print(i, print_chat, "Nincs meg a minimum $%d hogy fogadhass.", DEFAULTBET)
  638. continue
  639. }
  640.  
  641. g_betamount[i] = DEFAULTBET
  642.  
  643. if (bot) {
  644. // Bots "bet"
  645. //client_print(0, print_chat, "%d should vote and is a bot!", deadplayers[i])
  646. new botid[1]
  647. botid[0] = i
  648. set_task(random_float(1.0, 5.0), "botbet", 0, botid, 1)
  649. #if defined DEBUGMODE
  650. get_user_name(i, name, 31)
  651. log_amx("Player #%d (%s) is a bot and will bet...", i, name)
  652. #endif
  653. }
  654. else {
  655. //client_print(deadplayers[i], print_chat, "starting bet for you")
  656. #if defined DEBUGMODE
  657. get_user_name(i, name, 31)
  658. log_amx("Player #%d (%s) is a normal player and IS shown the bet menu and thus gets the chance to bet this time...", i, name)
  659. #endif
  660. startbet(i)
  661. }
  662. }
  663.  
  664. displaybetshud()
  665. }
  666.  
  667. public botbet(botid[1]) {
  668. if (!g_betting || !is_user_connected(botid[0])) // bot may have been disconnected during the time...
  669. return PLUGIN_CONTINUE
  670.  
  671. // Bot will bet.
  672. // Bot can bet any even $100 value... and should choose the player with most hp+armour, and possibly best frags/deaths ratio, and then it could turn all over to the other guy for
  673. // gambling purpose.
  674.  
  675. // Gambling ratio could be set somewhere between 0.1 and 0.5...
  676. new const Float:GAMBLER_RATIO = random_float(BOTGAMBLERMIN, BOTGAMBLERMAX)
  677. new bool:gambler = false // this bot is not a gambler... yet
  678. if (random_float(0.0, 1.0) <= GAMBLER_RATIO)
  679. gambler = true // ok, this bot wants to be a gambler :-)
  680.  
  681. new nongamblerschoice = getnongamblerschoice()
  682.  
  683. new choice = gambler ? (nongamblerschoice == TEAM_T ? TEAM_CT : TEAM_T) : nongamblerschoice
  684. /*if (gambler) {
  685. if (nongamblerschoice == TEAM_T)
  686. choice = TEAM_CT
  687. else
  688. choice = TEAM_T
  689. }*/
  690.  
  691. new money = cs_get_user_money(botid[0])
  692. money -= money % 100 // 553 - (553 % 100) would be 553 - (53) would be 500, ie even amount in hundreds...
  693. money = botbetmoney(money)
  694. if (money == 0) // Bot didn't bet this time...
  695. return PLUGIN_CONTINUE
  696.  
  697. g_betamount[botid[0]] = money
  698. placebet(botid[0], choice)
  699.  
  700. return PLUGIN_CONTINUE
  701. }
  702.  
  703. // Decides how much money the will bot bet.
  704. botbetmoney(money) {
  705. // Low (0.0 > 0.6), medium (0.6 > 0.9), high (0.9 > 1.0)
  706. // Low == max 30% of money
  707. // Medium == max 50% of money
  708. // High == max 100% of money
  709.  
  710. new const Float:RATIO = random_float(0.0, 1.0)
  711. new BETSETTING:betSetting = BET_LOW
  712. if (RATIO >= RATIO_HIGH)
  713. betSetting = BET_HIGH
  714. else if (RATIO >= RATIO_MEDIUM)
  715. betSetting = BET_MEDIUM
  716.  
  717. new Float:pctOfMoneyToBet
  718. switch (betSetting) {
  719. case BET_LOW: pctOfMoneyToBet = random_float(0.0, MAXBET_LOW) // MAXBET_LOW 0.3
  720. case BET_MEDIUM: pctOfMoneyToBet = random_float(0.0, MAXBET_MEDIUM) // MAXBET_MEDIUM 0.5
  721. //case BET_HIGH: pctOfMoneyToBet = random_float(0.0, MAXBET_HIGH) // MAXBET_HIGH 1.0
  722. default: pctOfMoneyToBet = random_float(0.0, MAXBET_HIGH) // MAXBET_HIGH 1.0
  723. }
  724.  
  725. money = floatround(money * pctOfMoneyToBet)
  726.  
  727. money -= money % 100 // to have equal 100s...
  728.  
  729. return money
  730. }
  731.  
  732. getnongamblerschoice() {
  733. new choice
  734. new t_hp = get_user_health(g_t), ct_hp = get_user_health(g_ct), t_armour = get_user_armor(g_t), ct_armour = get_user_armor(g_ct)
  735. if (t_hp + t_armour > ct_hp + ct_armour)
  736. choice = TEAM_T
  737. else if (t_hp + t_armour < ct_hp + ct_armour)
  738. choice = TEAM_CT
  739. else // They're equal
  740. choice = random_num(TEAM_T, TEAM_CT)
  741.  
  742. return choice
  743. }
  744.  
  745. startbet(id) {
  746. if (!g_betting) {
  747. client_print(id, print_center, "Elkestel a Fogadassal!")
  748. return
  749. }
  750.  
  751. new menuBody[512], flags = MENUBUTTON1|MENUBUTTON2|MENUBUTTON0, money = cs_get_user_money(id)
  752.  
  753. new t_hp = get_user_health(g_t), ct_hp = get_user_health(g_ct), t_armour = get_user_armor(g_t), ct_armour = get_user_armor(g_ct)
  754.  
  755. new len = format(menuBody, 511, "It's \y%s\w vs. \y%s\w! Helyezd el a Tetjeid! Ki fog nyerni?^n^n1. %s (HP: %d, Pajzs: %d)^n2. %s (HP: %d, Pajzs: %d)^n^nMostani Tet: $\y%d\w^n", g_names[TEAM_T], g_names[TEAM_CT], g_names[TEAM_T], t_hp, t_armour, g_names[TEAM_CT], ct_hp, ct_armour, g_betamount[id])
  756.  
  757. if (g_pot > 0)
  758. len += format(menuBody[len], 511 - len, "^nMostani Allas $\y%d\w^n", g_pot)
  759.  
  760. new const DEFAULTBET = get_cvar_num(CVAR_DEFAULTBET)
  761.  
  762. // +1x
  763. if (money >= g_betamount[id] + DEFAULTBET) {
  764. flags |= MENUBUTTON3
  765. len += format(menuBody[len], 511 - len, "\w")
  766. }
  767. else
  768. len += format(menuBody[len], 511 - len, "\d")
  769. len += format(menuBody[len], 511 - len, "3. Tet Novelese $%d-el^n", DEFAULTBET)
  770.  
  771. // +10x
  772. if (money >= g_betamount[id] + DEFAULTBET * 10) {
  773. flags |= MENUBUTTON4
  774. len += format(menuBody[len], 511 - len, "\w")
  775. }
  776. else
  777. len += format(menuBody[len], 511 - len, "\d")
  778. len += format(menuBody[len], 511 - len, "4. Tet Novelese $%d-el^n", DEFAULTBET * 10)
  779.  
  780.  
  781. // -1x
  782. if (g_betamount[id] - DEFAULTBET >= DEFAULTBET) {
  783. flags |= MENUBUTTON5
  784. len += format(menuBody[len], 511 - len, "\w")
  785. }
  786. else
  787. len += format(menuBody[len], 511 - len, "\d")
  788. len += format(menuBody[len], 511 - len, "5. Tet Csokkentese $%d-el^n", DEFAULTBET)
  789.  
  790. // -10x
  791. if (g_betamount[id] - DEFAULTBET * 10 >= DEFAULTBET) {
  792. flags |= MENUBUTTON6
  793. len += format(menuBody[len], 511 - len, "\w")
  794. }
  795. else
  796. len += format(menuBody[len], 511 - len, "\d")
  797. len += format(menuBody[len], 511 - len, "6. Tet Csokkentese $%d-el^n\w", DEFAULTBET * 10)
  798.  
  799. len += format(menuBody[len], 511 - len, "^n0. Nem Vagyok Szerencsejatekos...")
  800.  
  801. show_menu(id, flags, menuBody)
  802. //client_print(id, print_chat, "Showing menu to you")
  803. }
  804.  
  805. public menu_fn(id, key) {
  806. //client_print(id, print_chat, "You selected a menu option, key: %d", key)
  807. new bool:stayinmenu = true
  808. new const DEFAULTBET = get_cvar_num(CVAR_DEFAULTBET)
  809. switch (key) {
  810. case MENUSELECT1: {
  811. // bet on t
  812. placebet(id, TEAM_T)
  813. stayinmenu = false
  814. }
  815. case MENUSELECT2: {
  816. // bet on ct
  817. placebet(id, TEAM_CT)
  818. stayinmenu = false
  819. }
  820. case MENUSELECT3: {
  821. // raise bet
  822. alterbet(id, DEFAULTBET)
  823. }
  824. case MENUSELECT4: {
  825. // lower bet
  826. alterbet(id, DEFAULTBET * 10)
  827. }
  828. case MENUSELECT5: {
  829. // raise bet
  830. alterbet(id, -DEFAULTBET)
  831. }
  832. case MENUSELECT6: {
  833. // lower bet
  834. alterbet(id, -DEFAULTBET * 10)
  835. }
  836. case MENUSELECT0: {
  837. // no bet
  838. if (g_betting)
  839. client_print(id, print_chat, "Ha Jol Latom Nem Fogadtal!")
  840. stayinmenu = false
  841. }
  842. }
  843.  
  844. if (stayinmenu)
  845. startbet(id)
  846.  
  847. return PLUGIN_HANDLED
  848. }
  849.  
  850. placebet(id, choice) {
  851. if (!is_user_connected(id))
  852. return
  853.  
  854. if (g_betting) {
  855. g_betperson[id] = choice
  856. altermoney(id, -g_betamount[id])
  857. new name[33]
  858. get_user_name(id, name, 32)
  859. client_print(0, print_chat, "%s fogadott $%d-t %s-ra.", name, g_betamount[id], g_names[g_betperson[id]])
  860.  
  861. displaybetshud()
  862. }
  863. else
  864. client_print(id, print_center, "Elkestel a Fogadassal!")
  865. }
  866.  
  867. alterbet(id, money) {
  868. g_betamount[id] += money
  869. }
  870.  
  871. altermoney(id, money) { // calc 16000+ bonuses here?
  872. new newmoney = cs_get_user_money(id) + money
  873. #if defined IWANTPRIZES
  874. if (newmoney > 16000)
  875. prize(id, newmoney - 16000)
  876. #endif
  877.  
  878. cs_set_user_money(id, newmoney, 1)
  879. }
  880.  
  881. roundendtasks(const TEAM) {
  882. #if defined IWANTPRIZES
  883. remove_respawntasks()
  884. #endif
  885. g_round = false
  886. if (g_betting) {
  887. closebetmenu()
  888. remove_task(TASKID_BETTIMER) // stop the timer that will close the menu...
  889. remove_task(TASKID_BETTIMERDISPLAY) // stop the timer that displays the time left until menu closes...
  890. if (TEAM == TEAM_T || TEAM == TEAM_CT)
  891. calculatebets(TEAM)
  892. else // round ended in a draw... payback all bet money
  893. payback()
  894. }
  895. }
  896.  
  897. public roundend_t_event() {
  898. roundendtasks(TEAM_T)
  899. }
  900. public roundend_ct_event() {
  901. roundendtasks(TEAM_CT)
  902. }
  903. public roundend_draw_event() {
  904. roundendtasks(0)
  905. }
  906.  
  907. public closebetmenu() {
  908. new const MAXPLAYERS = get_maxplayers()
  909. new usermenu, userkeys
  910. for (new i = 1; i <= MAXPLAYERS; i++) {
  911. if (!is_user_connected(i) || is_user_alive(i) || is_user_bot(i))
  912. continue
  913.  
  914. get_user_menu(i, usermenu, userkeys) // get user menu
  915. if (usermenu == g_betmenu) // Hide it here!
  916. client_cmd(i, "slot10") // client_print(players[i], print_chat, "Hey, round's over and you didn't bet yet... close that menu!")
  917. }
  918. }
  919.  
  920. payback() {
  921. // End betting here
  922. g_betting = false
  923. for (new i = 1; i < 33; i++) {
  924. if (i == g_t || i == g_ct || !is_user_connected(i) || g_betperson[i] == 0) // the remaining players didn't bet, and don't interact with disconnected players, and don't give anything to those who didn't bet
  925. continue
  926.  
  927. altermoney(i, g_betamount[i])
  928. client_print(i, print_chat, "A kor eredmenye dontetlen. Visszakaptad a $%d-d.", g_betamount[i])
  929. }
  930. }
  931.  
  932. calculatebets(result) {
  933. // End betting here
  934. g_betting = false
  935.  
  936. // Find all who voted for right player, store how much they voted
  937. new totalrightbets = 0, overallbets = 0
  938. for (new i = 1; i < 33; i++) {
  939. if (g_betperson[i] == result)
  940. totalrightbets += g_betamount[i]
  941.  
  942. if (g_betperson[i] == TEAM_T || g_betperson[i] == TEAM_CT)
  943. overallbets += g_betamount[i]
  944. }
  945.  
  946. // Did anyone make a bet at all?
  947. if (overallbets == 0) {
  948. client_print(0, print_chat, "Senki Nem Fogadott Ebben a Korben...")
  949. return
  950. }
  951.  
  952. // Print total bets.
  953. client_print(0, print_chat, "Osszes Tet: $%d ($%d a nyero csapaton)", overallbets, totalrightbets)
  954.  
  955. // Now hand out money...
  956. new Float:wonmoney, name[33], Float:highestwonmoney = -1.0, nr_of_highestwinners = 0, highestwinners[32],CsTeams:team
  957. for (new i = 1; i < 33; i++) {
  958. if (i == g_t || i == g_ct || !is_user_connected(i)) // the remaining players didn't bet, and don't interact with disconnected players...
  959. continue
  960.  
  961. team = cs_get_user_team(i)
  962. if (team != CS_TEAM_T && team != CS_TEAM_CT) // spectators don't get anything
  963. continue
  964.  
  965. get_user_name(i, name, 32)
  966. if (totalrightbets > 0 && g_betperson[i] == result) { // Just to avoid divison by 0 (which shouldn't happen, but...)
  967. // This player should have money. How much? ((g_betamount[i] / totalrightbets) * overallbets)
  968. wonmoney = (float(g_betamount[i]) / float(totalrightbets)) * float(overallbets)
  969. client_print(i, print_chat, "Nyertel a Fogadason! Visszakapod a fogadott penzed, $%d-t, es a nyeremenyt, $%d-t!", g_betamount[i], floatround(wonmoney) - g_betamount[i])
  970. server_print("%s nyerte a fogadast es visszakapta a penzet, $%d-t, es meg hozza $%d-t!", name, g_betamount[i], floatround(wonmoney) - g_betamount[i])
  971. altermoney(i, floatround(wonmoney))
  972. if (wonmoney - g_betamount[i] > highestwonmoney) {
  973. nr_of_highestwinners = 0
  974. highestwinners[nr_of_highestwinners++] = i
  975. highestwonmoney = wonmoney - g_betamount[i]
  976. }
  977. else if (wonmoney - g_betamount[i] == highestwonmoney) {
  978. highestwinners[nr_of_highestwinners++] = i
  979. }
  980. }
  981. else if (g_betperson[i] == 0) {
  982. client_print(i, print_chat, "Te Nem Fogadtal Most.")
  983. server_print("%s nem fogadott...", name)
  984. }
  985. else {
  986. client_print(i, print_chat, "Elvesztetted a $%d-d amivel fogadtal!", g_betamount[i])
  987. server_print("%s elvesztett $%d-t a fogadason...", name, g_betamount[i])
  988. }
  989. }
  990.  
  991. //statsworker(highestwinners, nr_of_highestwinners, highestwonmoney)
  992.  
  993. if (nr_of_highestwinners == 0) { // Did anyone make the right bet? If not, move the bet money to the pot.
  994. client_print(0, print_chat, "Senki Nem Nyert. $%d hozzaadva a gyozteshez. Erteke: $%d", overallbets, g_pot += overallbets)
  995. set_vaultpot(g_pot)
  996. return
  997. }
  998. else if (nr_of_highestwinners == 1) { // Winner takes it all.
  999. get_user_name(highestwinners[0], name, 32)
  1000. if (g_pot != 0) {
  1001. client_print(0, print_chat, "%s nyert $%d-t, mert $%d-el fogadott, es megnyerte a gyozelmet, $%d-t!", name, floatround(highestwonmoney), g_betamount[highestwinners[0]], g_pot)
  1002. give_pot(nr_of_highestwinners, highestwinners)
  1003. }
  1004. else {
  1005. if (highestwonmoney >= 1.0)
  1006. client_print(0, print_chat, "%s nyert $%d-t a $%d fogadasaval, bar a tal ures volt.", name, floatround(highestwonmoney), g_betamount[highestwinners[0]])
  1007. }
  1008. }
  1009. else { // Winners share it all.
  1010. new msg[128], len = 0
  1011. if (g_pot > 0) {
  1012. len += format(msg[len], 127 - len, "Megosztva a $%d-nyi tal: ", g_pot)
  1013. give_pot(nr_of_highestwinners, highestwinners)
  1014. }
  1015. else
  1016. len += format(msg[len], 127 - len, "Legjobb Jatekosok: ")
  1017.  
  1018. for (new i = 0; i < nr_of_highestwinners; i++) {
  1019. get_user_name(highestwinners[i], name, 32)
  1020. len += format(msg[len], 127 - len, "%s ", name)
  1021. }
  1022. }
  1023. }
  1024.  
  1025. /*
  1026. statsworker(highestwinners[32], const NROFHIGHESTWINNERS, Float:highestwonmoney) {
  1027. // Build result table of last bet
  1028. }
  1029. */
  1030.  
  1031. set_vaultpot(value) {
  1032. new potstr[16]
  1033. num_to_str(value, potstr, 15)
  1034. set_vaultdata(VAULTKEY_POT, potstr)
  1035. }
  1036.  
  1037. give_pot(nr_of_winners, winners[32]) {
  1038. new pot = g_pot
  1039. g_pot = 0
  1040. set_vaultpot(0) // empty pot in vault
  1041.  
  1042. if (nr_of_winners == 1) {
  1043. altermoney(winners[0], pot)
  1044. return
  1045. }
  1046.  
  1047. if (nr_of_winners == 0) {
  1048. log_amx("%s: Error in script - division by zero error in give_pot! nr_of_winners: %d", nr_of_winners)
  1049. return
  1050. }
  1051. new share = pot/nr_of_winners
  1052. for (new i = 0; i < nr_of_winners; i++)
  1053. altermoney(winners[i], share)
  1054. }
  1055.  
  1056. /*
  1057. public killtest(id, level, cid) {
  1058. if (!cmd_access(id, level, cid, 1))
  1059. return PLUGIN_HANDLED
  1060.  
  1061. new const MAXPLAYERS = get_maxplayers()
  1062.  
  1063. new bool:tSkonad = false, bool:ctSkonad = false, team
  1064.  
  1065. for (new i = 1; i <= MAXPLAYERS; i++) {
  1066. if (!is_user_connected(i) || !is_user_alive(i))
  1067. continue
  1068.  
  1069. if (tSkonad && ctSkonad) {
  1070. user_kill(i, 1)
  1071. continue
  1072. }
  1073.  
  1074. team = cs_get_user_team(i)
  1075.  
  1076. if (team == TEAM_T) {
  1077. if (tSkonad || i == id)
  1078. user_kill(i, 1)
  1079. else
  1080. tSkonad = true
  1081. }
  1082. else if (team == TEAM_CT) {
  1083. if (ctSkonad || i == id)
  1084. user_kill(i, 1)
  1085. else
  1086. ctSkonad = true
  1087. }
  1088. else {
  1089. // Some odd team... just kill!
  1090. user_kill(i, 1)
  1091. }
  1092. }
  1093.  
  1094. return PLUGIN_HANDLED
  1095. }
  1096. */
  1097.  
  1098. public plugin_init() {
  1099. register_plugin(PLUGINNAME, VERSION, AUTHOR)
  1100.  
  1101. register_event("DeathMsg", "death_event", "a")
  1102. register_event("SendAudio", "roundend_t_event", "a", "2&%!MRAD_terwin")
  1103. register_event("SendAudio", "roundend_ct_event", "a", "2&%!MRAD_ctwin")
  1104. register_event("SendAudio", "roundend_draw_event", "a", "2&%!MRAD_rounddraw")
  1105. register_event("ResetHUD", "newround_event", "b")
  1106.  
  1107. #if defined IWANTPRIZES
  1108. register_event("TextMsg", "restartgame_event", "a", "2&#Game_C","2&#Game_w")
  1109. register_event("TextMsg", "restartgame_event", "a", "2&#Game_will_restart_in")
  1110. #if defined DEBUGMODE
  1111. register_concmd("0gp", "giveprize", ADMIN_CFG, "<id> <1-3> <#> - give # 1-3 prizes to id")
  1112. register_concmd("0gpa", "giveprizeall", ADMIN_CFG, "<1-3> <#> - give # 1-3 prizes to all")
  1113. #endif
  1114. #endif
  1115. //register_clcmd("0killtest", "killtest", ADMIN_CFG, "- kills you and leaves two people alive on each team...")
  1116. register_cvar(OVERRIDEPREVIOUSMENU, "1")
  1117. register_cvar(CVAR_DEFAULTBET, "100")
  1118. register_cvar(CVAR_BETTIME, "20")
  1119.  
  1120. g_betmenu = register_menuid("It's")
  1121. register_menucmd(g_betmenu, 1023, "menu_fn")
  1122.  
  1123. if (vaultdata_exists(VAULTKEY_POT))
  1124. g_pot = get_vaultdata(VAULTKEY_POT)
  1125.  
  1126. server_print("%s version %s initialized.", PLUGINNAME, VERSION)
  1127. }
  1128.