HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* --------------------------------------------------------------------------------------------
  2.  
  3. "Just Capture The Flag" - by Digi (aka Hunter-Digital) - fordítás by SmaCk
  4.  
  5. AlliedModders link: http://forums.alliedmods.net/showthread.php?t=132115
  6.  
  7. Változások lentebb olvashatóak.
  8.  
  9. -------------------------------------------------------------------------------------------- */
  10.  
  11. new const MOD_TITLE[] = "Just Capture the Flag" /* Kérlek ne változtasd. */
  12. new const MOD_AUTHOR[] = "Digi" /* Kérlek ne változtasd. */
  13. new const MOD_VERSION[] = "1.32c" /* Kérlek ne változtasd. */
  14.  
  15. /*
  16. Lentebb állíthatóak be a mód fõbb cvarjai.
  17. Figyelmeztetés: Minden egyes beállításnál a forráskódban kell beállítani a cvarokat és egyéb dolgokat!
  18.  
  19. -----------------------------------
  20.  
  21. Description: This uses Orpheu module to make infinite round end and trigger round end on flag captures
  22. If set to false, ophreu will not be used anymore and rounds could end if all players from one team are dead and round can't end upon flag capture.
  23. */
  24. #define FEATURE_ORPHEU true
  25.  
  26.  
  27. /*
  28. Description: This hooks the buy system of the game and changes it, allowing everybody to buy all weapons.
  29. If set to false, it will disable all buy related stuff like: buy menu, spawn weaopns, special weapons, even C4!
  30. Disable this if you want to use another plugin that manages buy or doesn't use buy at all (like GunGame)
  31. */
  32. #define FEATURE_BUY true
  33.  
  34.  
  35. /*
  36. Description: This allows players to buy and use C4 as a weapon, not an objective, it can be defused tough but the defuser gets a usable C4 back. C4 kills everything in it's radius, including teammates.
  37. If set to false, C4 usage will be completly disabled so it can't be bought.
  38.  
  39. Requirements: FEATURE_BUY must be true
  40. */
  41. #define FEATURE_BUYC4 true
  42.  
  43.  
  44. /*
  45. Description: This allows players to have an adrenaline amount and when it reaches 100, they can use combos.
  46. If set to false, it will disable all adrenaline stuff, including combos, rewards, buying with adrenaline, everything.
  47. */
  48. #define FEATURE_ADRENALINE true
  49.  
  50. /* --------------------------------------------------------------------------------------------
  51. Skip this, advanced configuration more below
  52. */
  53. #if FEATURE_BUY == true && FEATURE_BUYC4 == true
  54. #define FEATURE_C4 true
  55. #else
  56. #define FEATURE_C4 false
  57. #endif
  58.  
  59. #include <amxmodx>
  60. #include <amxmisc>
  61. #include <hamsandwich>
  62.  
  63. #if FEATURE_ORPHEU == true
  64. #include <orpheu_memory>
  65. #include <orpheu>
  66. #endif
  67.  
  68. #include <fakemeta>
  69. #include <cstrike>
  70. #include <engine>
  71. #include <fun>
  72.  
  73. /* --------------------------------------------------------------------------------------------
  74.  
  75. CVars for .cfg files:
  76.  
  77. ctf_flagreturn (default 120) - flag auto-return time
  78. ctf_weaponstay (default 30) - how long do weapons and items stay on ground
  79. ctf_itempercent (default 30) - chance that items spawn when a player is killed, values from 0 to 100
  80. ctf_sound_taken (default 1) - toggles if the "flag taken" sounds can be heard
  81. ctf_sound_dropped (default 1) - toggles if the "flag dropped" sounds can be heard
  82. ctf_sound_returned (default 1) - toggles if the "flag returned" sounds can be heard
  83. ctf_sound_score (default 1) - toggles if the "X team scores" sounds can be heard
  84. ctf_respawntime (default 10) - players respawn time (use -1 to disable respawn)
  85. ctf_spawnmoney (default 1000) - money bonus when spawning (unless it's a suicide)
  86. ctf_protection (default 5) - players spawn protection time (use -1 to disable protection)
  87. ctf_dynamiclights (default 1) - set the default dynamic lights setting, players will still be able to toggle individually using /lights
  88. ctf_glows (default 1) - set if entities can glow, like when players have flag or an adrenaline combo, weapons start to fade, etc.
  89. ctf_nospam_flash (default 20) - delay of rebuying two flashbangs in a life
  90. ctf_nospam_he (default 20) - delay of rebuying a HE grenade in a life
  91. ctf_nospam_smoke (default 20) - delay of rebuying a smoke grenade in a life
  92. ctf_spawn_prim (default "m3") - spawning primary weapon, set to "" to disable
  93. ctf_spawn_sec (default "glock") - spawning secondary weapon, set to "" to disable
  94. ctf_spawn_knife (default 1) - toggle if players spawn with knife or not
  95. ctf_sound_taken (default 1) - toggles if the "flag taken" sounds can be heard
  96. ctf_sound_dropped (default 1) - toggles if the "flag dropped" sounds can be heard
  97. ctf_sound_returned (default 1) - toggles if the "flag returned" sounds can be heard
  98. ctf_sound_score (default 1) - toggles if the "X team scores" sounds can be heard
  99.  
  100. Elsõdleges fegyverek: m3,xm1014,tmp,mac10,mp5,ump45,p90,galil,ak47,famas,m4a1,aug,sg552,awp,scout,sg550,g3sg1,m249,shield
  101. Másodlagos fegyverek: glock,usp,p228,deagle,elites,fiveseven
  102.  
  103. mp_c4timer (recommended 20) - time before the C4 devices explode
  104. mp_winlimit - first team who reaches this number wins
  105. mp_timelimit - time limit for the map (displayed in the round timer)
  106. mp_startmoney (recommended 3000) - for first spawn money and minimum amount of money
  107. mp_forcecamera - (0/1 - spectate enemies or not) mod fades to black if this is on and player is in free look (no teammates alive)
  108. mp_forcechasecam - (0/1/2 - force chase cammera all/team/firstperson) same as above
  109. mp_autoteambalance - enable/disable auto-team balance (checks at every player death)
  110.  
  111. Map configurations are made with;
  112.  
  113. ctf_moveflag red/blue at your position (even if dead/spec)
  114. ctf_save to save flag origins in maps/<mapname>.ctf
  115.  
  116. Reward configuration, 0 on all values disables reward/penalty.
  117.  
  118. [REWARD FOR] [MONEY] [FRAGS] [ADRENALINE]
  119. */
  120. #define REWARD_RETURN 500, 0, 10
  121. #define REWARD_RETURN_ASSIST 500, 0, 10
  122.  
  123. #define REWARD_CAPTURE 3000, 3, 25
  124. #define REWARD_CAPTURE_ASSIST 3000, 3, 25
  125. #define REWARD_CAPTURE_TEAM 1000, 0, 10
  126.  
  127. #define REWARD_STEAL 1000, 1, 10
  128. #define REWARD_PICKUP 500, 1, 5
  129. #define PENALTY_DROP -1500, -1, -10
  130.  
  131. #define REWARD_KILL 0, 0, 5
  132. #define REWARD_KILLCARRIER 500, 1, 10
  133.  
  134. #define PENALTY_SUICIDE 0, 0, -20
  135. #define PENALTY_TEAMKILL 0, 0, -20
  136.  
  137. /*
  138. Advanced configuration
  139. */
  140.  
  141. const ADMIN_RETURN = ADMIN_RCON // Az az admin jog amivel egy admin visszatudja tenni a zászlókat (a teljes lista includes/amxconst.inc)
  142. const ADMIN_RETURNWAIT = 15 // Az az idõ, ami után egy admin visszatudja tenni a zászlót a bázisra. (másodperc)
  143.  
  144. new const bool:CHAT_SHOW_COMMANDS = true // show commands (like /buy) in chat, true or false
  145.  
  146. const ITEM_MEDKIT_GIVE = 25 // medkit award health for picking up
  147.  
  148. new const bool:ITEM_DROP_AMMO = true // toggle if killed players drop ammo items
  149. new const bool:ITEM_DROP_MEDKIT = true // toggle if killed players drop medkit items
  150.  
  151. #if FEATURE_ADRENALINE == true
  152. new const bool:ITEM_DROP_ADRENALINE = true // toggle if killed players drop adrenaline items
  153. const ITEM_ADRENALINE_GIVE = 5 // adrenaline reaward for picking up adrenaline
  154.  
  155. const Float:SPEED_ADRENALINE = 1.3 // speed while using "speed" adrenaline combo (this and SPEED_FLAG are cumulative)
  156.  
  157. const Float:BERSERKER_SPEED1 = 0.7 // primary weapon shooting speed percent while in berserk
  158. const Float:BERSERKER_SPEED2 = 0.3 // secondary weapon shooting speed percent while in berserk
  159. const Float:BERSERKER_DAMAGE = 2.0 // weapon damage percent while in berserk
  160.  
  161. const INSTANTSPAWN_COST = 50 // Azonnali újraéledés ára (adrenalin)
  162.  
  163. #endif // FEATURE_ADRENALINE
  164.  
  165. const REGENERATE_EXTRAHP = 50 // Max extra HP regenerációnál vagy élet töltésnél
  166.  
  167. const Float:SPEED_FLAG = 0.9 // speed while carying the enemy flag
  168.  
  169. new const Float:BASE_HEAL_DISTANCE = 96.0 // healing distance for flag
  170.  
  171. #if FEATURE_C4 == true
  172.  
  173. new const C4_RADIUS[] = "600" // c4 explosion radius (must be string!)
  174. new const C4_DEFUSETIME = 3 // Bomba hatástalanítási idõ (mp)
  175.  
  176. #endif // FEATURE_C4
  177.  
  178. new const FLAG_SAVELOCATION[] = "maps/%s.ctf" // you can change where .ctf files are saved/loaded from
  179.  
  180. #define FLAG_IGNORE_BOTS true // set to true if you don't want bots to pick up flags
  181.  
  182.  
  183. /*
  184. Change log:
  185.  
  186. v1.32c:
  187. * Changed files: jctf.sma
  188. - Added ctf_dynamiclights cvar to enable server operators to disable dynamic lights by default, players can still re-enable them individually using /lights
  189. - Added ctf_glows cvar to enable server operators to disable glows on entities for performance, however it will degrade gameplay due to lack of visual information
  190.  
  191. v1.32b:
  192. * Changed files: jctf.sma
  193. - Fixed rewards beeing default to 0 for steal and capturing flags (my bad).
  194.  
  195. v1.32:
  196. * Changes files: jctf.sma
  197. - Removed forcing of CVars - if you depended on that, use amxx.cfg to store default values of cvars.
  198. - Added posibility to disable respawn using ctf_respawntime 0.
  199. - Added posibility to disable spawn protection using ctf_protection 0.
  200. - Added posibility to disable dropped weapons fading out using ctf_weaponstay 0.
  201. - Added posibility to disable flag auto-return using ctf_flagreturn 0.
  202. - Fixed GameName printing CS 1.6 for CZ too, now it detects game name, if's unknown it doesn't write anything.
  203. - Fixed player rewards still printing if all rewards are 0.
  204. - Fixed MP3 files printing WAV error messages due to incorrect precaching method.
  205.  
  206. v1.31:
  207. * Changed files: jctf.sma, jctf_resources.zip
  208. - Fixed issue where plugin wouldn't trigger "Round_End" on ctf_flagendround 1 that caused issues with other plugins.
  209. - Added new orpheu signatures: functions/EndRoundMessage and functions/CHalfLifeMultiplay/UpdateTeamScores.
  210. - Changed "TeamScore" message to emessage, that way it can be hooked by other plugins.
  211. - Added updating team scores internally too.
  212. - Some other minor changes.
  213.  
  214. v1.3:
  215. * Changed files: jctf.sma, lang/jctf.txt, jctf_resources.zip
  216. - Added CVars: ctf_flagendround, ctf_flagcaptureslay and ctf_infiniteround (see thread for descriptions)
  217. - Changed /help command, it now prints most mod settings and features (which are enabled/disabled)
  218. - Added new orpheu signatures: functions/InstallGameRules and memory/CGameRulesOffsets (they're in jctf_resources.zip)
  219. - Changed feature define FEATURE_INFROUND to FEATURE_ORPHEU because it also disables flag capture ending round
  220. - Changed contents of lang keys: JOIN_NOFEATURES
  221. - Renamed lang keys: HELP_3_* to HELP_4_* and DEAH_NOFREELOOK to DEATH_NOFREELOOK
  222. - Added lang keys: DEATH_FLAGCAPTURED, STARTING_NEWROUND, and HELP_3_*
  223. - Added so that on new round, flags are returned to base (no matter what the reason of new round)
  224.  
  225. v1.28c:
  226. * Changed files: jctf.sma
  227. - Fixed if you reload map with the plugin disabled the rounds will end normally.
  228.  
  229. v1.28b:
  230. * Changed files: jctf.sma
  231. - Fixed a compile error when switching FEATURE_ADRENALINE to false.
  232.  
  233. v1.28:
  234. * Changed files: jctf.sma, jctf.txt
  235. - Fixed buying VGUI issues, plugin now closes buy VGUI and opens custom buy menu without client changes.
  236. - Removed VGUI related ML keys from jctf.txt.
  237.  
  238. v1.27:
  239. * Changed files: jctf.sma, jctf.txt
  240. - Added FEATURE disabling, you can now toggle individual features from the sma file.
  241. - Added ctf_flagheal cvar which toggles if flag bases heal teammates.
  242. - Changed HUD message to Director HUD messages, nicer and have no channel limit
  243. - Increased char limit for "Freelook mode blocked" ML text from 32 to 48 chars.
  244. - Rearranged sma configuration variables, you can find them easier on top of the file.
  245. - Added hints and adrenaline menu to the ML support.
  246. - Decreased chance that flag gets stuck in a wall (dramatically decreased collision box and added proximity check for pickup)
  247. - Decreased C4's price from $15000 to $12000 and adrenaline cost from 100 to 80
  248. - Some minor optimizations
  249.  
  250. v1.26:
  251. * Changed files: jctf.sma, jctf.inc(jctf_api.zip), lang/jctf.txt
  252. - Fixed "ED_Alloc: No free edicts" crashes (hopefully).
  253. - Added Multilingual support, natives support it too.
  254. - Added printing of admin commands in chat that obey amx_show_activity.
  255. - Added a check of players spawning HP and Armor so Booster and flags know how much to heal.
  256. - Added configurable extra HP the booster heals.
  257. - Changed armor regeneration from Booster so it no longer sets armor to kevlar+helm if you have kevlar only.
  258. - Added option to ignore bots from taking flags, default OFF (search sma for // CONFIGURABLE).
  259. - Added checking of player's team range when touching flag in case it's a spawned spectator.
  260. - Fixed bots not buying weapons, but be warned, they buy at default prices and without adrenaline.
  261. - Changed default mp_buytime from 0 to 99999999 so bots can always buy, this doesn't affect players.
  262. - Added API natives: jctf_get_flagcarrier(id) and jctf_get_team(id)
  263. - Added FLAG_ADMINRETURN for the jctf_flag() forward, it triggers when an admin returns the flag using command
  264. - Fixed ctf_moveflag command not showing Y axis in the log
  265.  
  266. v1.25:
  267. - Changed ctf_moveflag to support red and blue inputs
  268. - Fade to black no longer affects spectators
  269. - Added "ctf_returnflag <red/blue>" admin command that returns the specified flag if it was dropped for at least 15 seconds (configurable)
  270. - Optimized some minor stuff
  271.  
  272. v1.24:
  273. - Changed ctf_weaponstay's default value from 30 to 15 (seconds)
  274. - Changed ctf_itempercent's default value from 30 to 25 (percent)
  275. - Added Scout and G3SG1 as special weapons.
  276. - Added the "configurable" flag in the source for weapon money and adrenaline costs
  277. - Added configurable weapon and zoom-in running speeds
  278. - Added cvars for controling sounds: ctf_sound_taken/dropped/returned/score
  279. - Added how much money/adrenaline you need in the "Not enough money/adrenaline" message
  280.  
  281. v1.23:
  282. - plugin no longer disables VGUI menu automatically but it notifies VGUI menu users upon spawn
  283. - added new in-source configuration: CHAT_SHOW_COMMANDS
  284.  
  285. v1.22:
  286. - fixed a bug where you'd get twice the adrenaline when using the jctf_add_adrenaline() native while using a reason
  287. - fixed adrenaline HUD not updating when using jctf_add_adrenaline()
  288.  
  289. v1.21:
  290. - added FLAG_MANUALDROP for jctf_flag() events
  291. - fixed some example issues in jctf_addon_example.sma
  292. - updated version check to 1.21 since jctf.inc was altered
  293. - added a console print upon plugin load with plugin name and version
  294. - forced to reset jctf_version to the current version if mod is updated while server is running
  295.  
  296. v1.2:
  297. - added forwards and natives that other plugins could use
  298. - added configurable spawning weapons using CVars, they're also forced to reset to prevent unwanted usage between maps
  299. - minor adjustments in the code to fit the latest modifications
  300.  
  301. v1.13:
  302. - fixed some issues with the autoteambalance
  303. - fixed spawn protection countdown not stop when prematurely disabling protection
  304. - fixed game name displaying version as number instead of string
  305. - added mod version in quick help and help console message
  306. - added checking of mp_forcechasecam too for the fade to black feature
  307. - fixed the possiblity of not beeing blinded while in freelook after a respawn
  308.  
  309. v1.12:
  310. - fixed a bug where transfered people (autoteambalance) would actually block the team they left from beeing joined, the "there are too many CTs/Ts" thing.
  311. - added fade to black when mp_fadetoblack is disabled and mp_forcecamera is enabled while player is on free view (no teammates alive)
  312.  
  313. v1.11:
  314. - fixed a rare bug where players won't respawn after beeing killed
  315. - some optimizations in code
  316.  
  317. v1.1:
  318. - removed previous round-end blocking and added new round blocking method via Orpheu module
  319. - fixed various possible crashes caused by previous round-end blocking methods
  320.  
  321. v1.06:
  322. - changed buy menu text so that items you can't afford are in red text
  323. - fixed various speed issues with player zooming, shield and flag taking
  324. - re-done player rendering system and altered some colors and values
  325. - unforced most mod cvars, only two cvars remain forced
  326.  
  327. v1.05:
  328. - fixed round-blocking player deaths's animations
  329. - changed the sounds of medkit and adrenaline item pickup
  330. - and of course, other small adjustments
  331.  
  332. v1.04:
  333. - other small adjustments here and there
  334. - removed the spectating bots, now players' deaths are blocked if they'll trigger round end, they wouldn't even notice
  335. - altered C4 plant radio message to a be compatible with client modifications and other hooks
  336.  
  337. v1.03:
  338. - added /help
  339. - minor adjustments and code moved around
  340.  
  341. v1.02:
  342. - fixed items not fading out
  343. - fixed the simple auto-team balance
  344. - fixed various possible errors
  345.  
  346. v1.01:
  347. - minor fixes of typos and checks
  348.  
  349. -------------------------------------------------------------------------------------------- */
  350.  
  351. new const INFO_TARGET[] = "info_target"
  352. new const ITEM_CLASSNAME[] = "ctf_item"
  353. new const WEAPONBOX[] = "weaponbox"
  354.  
  355. #if FEATURE_C4 == true
  356.  
  357. new const GRENADE[] = "grenade"
  358.  
  359. #endif // FEATURE_C4
  360.  
  361. new const Float:ITEM_HULL_MIN[3] = {-1.0, -1.0, 0.0}
  362. new const Float:ITEM_HULL_MAX[3] = {1.0, 1.0, 10.0}
  363.  
  364. const ITEM_AMMO = 0
  365. const ITEM_MEDKIT = 1
  366.  
  367. #if FEATURE_ADRENALINE == true
  368.  
  369. const ITEM_ADRENALINE = 2
  370.  
  371. #endif // FEATURE_ADRENALINE
  372.  
  373. new const ITEM_MODEL_AMMO[] = "models/w_chainammo.mdl"
  374. new const ITEM_MODEL_MEDKIT[] = "models/w_medkit.mdl"
  375.  
  376. #if FEATURE_ADRENALINE == true
  377.  
  378. new const ITEM_MODEL_ADRENALINE[] = "models/can.mdl"
  379.  
  380. #endif // FEATURE_ADRENALINE
  381.  
  382. new const BASE_CLASSNAME[] = "ctf_flagbase"
  383. new const Float:BASE_THINK = 0.25
  384.  
  385. new const FLAG_CLASSNAME[] = "ctf_flag"
  386. new const FLAG_MODEL[] = "models/th_jctf.mdl"
  387.  
  388. new const Float:FLAG_THINK = 0.1
  389. const FLAG_SKIPTHINK = 20 /* FLAG_THINK * FLAG_SKIPTHINK = 2.0 seconds ! */
  390.  
  391. new const Float:FLAG_HULL_MIN[3] = {-2.0, -2.0, 0.0}
  392. new const Float:FLAG_HULL_MAX[3] = {2.0, 2.0, 16.0}
  393.  
  394. new const Float:FLAG_SPAWN_VELOCITY[3] = {0.0, 0.0, -500.0}
  395. new const Float:FLAG_SPAWN_ANGLES[3] = {0.0, 0.0, 0.0}
  396.  
  397. new const Float:FLAG_DROP_VELOCITY[3] = {0.0, 0.0, 50.0}
  398.  
  399. new const Float:FLAG_PICKUPDISTANCE = 80.0
  400.  
  401. const FLAG_LIGHT_RANGE = 12
  402. const FLAG_LIGHT_LIFE = 5
  403. const FLAG_LIGHT_DECAY = 1
  404.  
  405. const FLAG_ANI_DROPPED = 0
  406. const FLAG_ANI_STAND = 1
  407. const FLAG_ANI_BASE = 2
  408.  
  409. const FLAG_HOLD_BASE = 33
  410. const FLAG_HOLD_DROPPED = 34
  411.  
  412. #if FEATURE_ADRENALINE == true
  413.  
  414. const ADRENALINE_SPEED = 1
  415. const ADRENALINE_BERSERK = 2
  416. const ADRENALINE_REGENERATE = 3
  417. const ADRENALINE_INVISIBILITY = 4
  418.  
  419. new const MENU_ADRENALINE[] = "menu_adrenaline"
  420. new const MENU_KEYS_ADRENALINE = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<9)
  421.  
  422. #endif // FEATURE_ADRENALINE
  423.  
  424. #if FEATURE_BUY == true
  425.  
  426. new const WHITESPACE[] = " "
  427. new const MENU_BUY[] = "menu_buy"
  428. new const MENU_KEYS_BUY = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
  429.  
  430. new const BUY_ITEM_DISABLED[] = "r"
  431. new const BUY_ITEM_AVAILABLE[] = "w"
  432.  
  433. #if FEATURE_ADRENALINE == true
  434.  
  435. new const BUY_ITEM_AVAILABLE2[] = "y"
  436.  
  437. #endif // FEATURE_ADRENALINE
  438.  
  439. #endif // FEATURE_BUY
  440.  
  441. new const SND_GETAMMO[] = "items/9mmclip1.wav"
  442. new const SND_GETMEDKIT[] = "items/smallmedkit1.wav"
  443.  
  444. #if FEATURE_ADRENALINE == true
  445.  
  446. new const SND_GETADRENALINE[] = "items/medshot4.wav"
  447. new const SND_ADRENALINE[] = "ambience/des_wind3.wav"
  448.  
  449. #endif // FEATURE_ADRENALINE
  450.  
  451. #if FEATURE_C4 == true
  452.  
  453. new const SND_C4DISARMED[] = "weapons/c4_disarmed.wav"
  454.  
  455. #endif // FEATURE_C4
  456.  
  457. new const CHAT_PREFIX[] = "^x03[^x04 CTF^x03 ]^x01 " // Chat prefix beállítása
  458. new const CONSOLE_PREFIX[] = "[ CTF ] " // Konzol prefix beállítása
  459.  
  460. const FADE_OUT = 0x0000
  461. const FADE_IN = 0x0001
  462. const FADE_MODULATE = 0x0002
  463. const FADE_STAY = 0x0004
  464.  
  465. const m_iUserPrefs = 510
  466. const m_flNextPrimaryAttack = 46
  467. const m_flNextSecondaryAttack = 47
  468.  
  469. new const PLAYER[] = "player"
  470. new const SEPARATOR[] = " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
  471. #define NULL ""
  472.  
  473. #define HUD_HINT 255, 255, 255, 0.15, -0.3, 0, 0.0, 10.0, 2.0, 10.0, 4
  474. #define HUD_HELP 255, 255, 0, -1.0, 0.2, 2, 0.1, 2.0, 0.01, 2.0, 2
  475. #define HUD_HELP2 255, 255, 0, -1.0, 0.25, 2, 0.1, 2.0, 0.01, 2.0, 3
  476. #define HUD_ANNOUNCE -1.0, 0.3, 0, 0.0, 3.0, 0.1, 1.0, 4
  477. #define HUD_RESPAWN 0, 255, 0, -1.0, 0.6, 2, 0.5, 0.1, 0.0, 1.0, 1
  478. #define HUD_PROTECTION 255, 255, 0, -1.0, 0.6, 2, 0.5, 0.1, 0.0, 1.0, 1
  479. #define HUD_ADRENALINE 255, 255, 255, -1.0, -0.1, 0, 0.0, 600.0, 0.0, 0.0, 1
  480.  
  481. #define entity_create(%1) create_entity(%1)
  482. #define entity_spawn(%1) DispatchSpawn(%1)
  483. #define entity_think(%1) call_think(%1)
  484. #define entity_remove(%1) remove_entity(%1)
  485. #define weapon_remove(%1) call_think(%1)
  486.  
  487. #define task_set(%1) set_task(%1)
  488. #define task_remove(%1) remove_task(%1)
  489.  
  490. #define player_hasFlag(%1) (g_iFlagHolder[TEAM_RED] == %1 || g_iFlagHolder[TEAM_BLUE] == %1)
  491.  
  492. #define player_allowChangeTeam(%1) set_pdata_int(%1, 125, get_pdata_int(%1, 125) & ~(1<<8))
  493.  
  494. #define gen_color(%1,%2) %1 == TEAM_RED ? %2 : 0, 0, %1 == TEAM_RED ? 0 : %2
  495.  
  496. #define get_opTeam(%1) (%1 == TEAM_BLUE ? TEAM_RED : (%1 == TEAM_RED ? TEAM_BLUE : 0))
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507. enum
  508. {
  509. x,
  510. y,
  511. z
  512. }
  513.  
  514. enum
  515. {
  516. pitch,
  517. yaw,
  518. roll
  519. }
  520.  
  521. enum (+= 64)
  522. {
  523. TASK_RESPAWN = 64,
  524. TASK_PROTECTION,
  525. TASK_DAMAGEPROTECTION,
  526. TASK_EQUIPAMENT,
  527. TASK_PUTINSERVER,
  528. TASK_TEAMBALANCE,
  529. TASK_ADRENALINE,
  530. TASK_DEFUSE,
  531. TASK_CHECKHP
  532. }
  533.  
  534. enum
  535. {
  536. TEAM_NONE = 0,
  537. TEAM_RED,
  538. TEAM_BLUE,
  539. TEAM_SPEC
  540. }
  541.  
  542. new const g_szCSTeams[][] =
  543. {
  544. NULL,
  545. "TERRORIST",
  546. "CT",
  547. "SPECTATOR"
  548. }
  549.  
  550. new const g_szTeamName[][] =
  551. {
  552. NULL,
  553. "Red",
  554. "Blue",
  555. "Spectator"
  556. }
  557.  
  558. new const g_szMLTeamName[][] =
  559. {
  560. NULL,
  561. "TEAM_RED",
  562. "TEAM_BLUE",
  563. "TEAM_SPEC"
  564. }
  565.  
  566. new const g_szMLFlagTeam[][] =
  567. {
  568. NULL,
  569. "FLAG_RED",
  570. "FLAG_BLUE",
  571. NULL
  572. }
  573.  
  574. enum
  575. {
  576. FLAG_STOLEN = 0,
  577. FLAG_PICKED,
  578. FLAG_DROPPED,
  579. FLAG_MANUALDROP,
  580. FLAG_RETURNED,
  581. FLAG_CAPTURED,
  582. FLAG_AUTORETURN,
  583. FLAG_ADMINRETURN
  584. }
  585.  
  586. enum
  587. {
  588. EVENT_TAKEN = 0,
  589. EVENT_DROPPED,
  590. EVENT_RETURNED,
  591. EVENT_SCORE,
  592. }
  593.  
  594. new const g_szSounds[][][] =
  595. {
  596. {NULL, "red_flag_taken", "blue_flag_taken"},
  597. {NULL, "red_flag_dropped", "blue_flag_dropped"},
  598. {NULL, "red_flag_returned", "blue_flag_returned"},
  599. {NULL, "red_team_scores", "blue_team_scores"}
  600. }
  601.  
  602. #if FEATURE_ADRENALINE == true
  603. new const g_szAdrenalineUseML[][] =
  604. {
  605. NULL,
  606. "ADR_SPEED",
  607. "ADR_BERSERK",
  608. "ADR_REGENERATE",
  609. "ADR_INVISIBILITY"
  610. }
  611. #endif // FEATURE_ADRENALINE
  612.  
  613. #if FEATURE_BUY == true
  614.  
  615. enum
  616. {
  617. no_weapon,
  618. primary,
  619. secondary,
  620. he,
  621. flash,
  622. smoke,
  623. armor,
  624. nvg
  625. }
  626.  
  627. new const g_szRebuyCommands[][] =
  628. {
  629. NULL,
  630. "PrimaryWeapon",
  631. "SecondaryWeapon",
  632. "HEGrenade",
  633. "Flashbang",
  634. "SmokeGrenade",
  635. "Armor",
  636. "NightVision"
  637. }
  638.  
  639. #endif // FEATURE_BUY
  640.  
  641. new const g_szRemoveEntities[][] =
  642. {
  643. "func_buyzone",
  644. "armoury_entity",
  645. "func_bomb_target",
  646. "info_bomb_target",
  647. "hostage_entity",
  648. "monster_scientist",
  649. "func_hostage_rescue",
  650. "info_hostage_rescue",
  651. "info_vip_start",
  652. "func_vip_safetyzone",
  653. "func_escapezone",
  654. "info_map_parameters",
  655. "player_weaponstrip",
  656. "game_player_equip"
  657. }
  658.  
  659. enum
  660. {
  661. ZERO = 0,
  662. W_P228,
  663. W_SHIELD,
  664. W_SCOUT,
  665. W_HEGRENADE,
  666. W_XM1014,
  667. W_C4,
  668. W_MAC10,
  669. W_AUG,
  670. W_SMOKEGRENADE,
  671. W_ELITE,
  672. W_FIVESEVEN,
  673. W_UMP45,
  674. W_SG550,
  675. W_GALIL,
  676. W_FAMAS,
  677. W_USP,
  678. W_GLOCK18,
  679. W_AWP,
  680. W_MP5NAVY,
  681. W_M249,
  682. W_M3,
  683. W_M4A1,
  684. W_TMP,
  685. W_G3SG1,
  686. W_FLASHBANG,
  687. W_DEAGLE,
  688. W_SG552,
  689. W_AK47,
  690. W_KNIFE,
  691. W_P90,
  692. W_VEST,
  693. W_VESTHELM,
  694. W_NVG
  695. }
  696.  
  697. new const g_iClip[] =
  698. {
  699. 0, // (unknown)
  700. 13, // P228
  701. 0, // SHIELD (not used)
  702. 10, // SCOUT
  703. 0, // HEGRENADE (not used)
  704. 7, // XM1014
  705. 0, // C4 (not used)
  706. 30, // MAC10
  707. 30, // AUG
  708. 0, // SMOKEGRENADE (not used)
  709. 30, // ELITE
  710. 20, // FIVESEVEN
  711. 25, // UMP45
  712. 30, // SG550
  713. 35, // GALIL
  714. 25, // FAMAS
  715. 12, // USP
  716. 20, // GLOCK18
  717. 10, // AWP
  718. 30, // MP5NAVY
  719. 100, // M249
  720. 8, // M3
  721. 30, // M4A1
  722. 30, // TMP
  723. 20, // G3SG1
  724. 0, // FLASHBANG (not used)
  725. 7, // DEAGLE
  726. 30, // SG552
  727. 30, // AK47
  728. 0, // KNIFE (not used)
  729. 50, // P90
  730. 0, // Kevlar (not used)
  731. 0, // Kevlar + Helm (not used)
  732. 0 // NVG (not used)
  733. }
  734.  
  735. new const g_iBPAmmo[] =
  736. {
  737. 0, // (unknown)
  738. 52, // P228
  739. 0, // SHIELD
  740. 90, // SCOUT
  741. 0, // HEGRENADE (not used)
  742. 32, // XM1014
  743. 0, // C4 (not used)
  744. 100, // MAC10
  745. 90, // AUG
  746. 0, // SMOKEGRENADE (not used)
  747. 120, // ELITE
  748. 100, // FIVESEVEN
  749. 100, // UMP45
  750. 90, // SG550
  751. 90, // GALIL
  752. 90, // FAMAS
  753. 100, // USP
  754. 120, // GLOCK18
  755. 30, // AWP
  756. 120, // MP5NAVY
  757. 200, // M249
  758. 32, // M3
  759. 90, // M4A1
  760. 120, // TMP
  761. 90, // G3SG1
  762. 0, // FLASHBANG (not used)
  763. 35, // DEAGLE
  764. 90, // SG552
  765. 90, // AK47
  766. 0, // KNIFE (not used)
  767. 100, // P90
  768. 0, // Kevlar (not used)
  769. 0, // Kevlar + Helm (not used)
  770. 0 // NVG (not used)
  771. }
  772.  
  773. #if FEATURE_BUY == true
  774.  
  775. new const g_iWeaponPrice[] =
  776. {
  777. 0, // (unknown)
  778. 600, // P228
  779. 10000, // SHIELD
  780. 6000, // SCOUT
  781. 300, // HEGRENADE
  782. 3000, // XM1014
  783. 12000, // C4
  784. 1400, // MAC10
  785. 3500, // AUG
  786. 100, // SMOKEGRENADE
  787. 1000, // ELITE
  788. 750, // FIVESEVEN
  789. 1700, // UMP45
  790. 6000, // SG550
  791. 2000, // GALIL
  792. 2250, // FAMAS
  793. 500, // USP
  794. 400, // GLOCK18
  795. 8000, // AWP
  796. 1500, // MP5NAVY
  797. 5000, // M249
  798. 1700, // M3
  799. 3100, // M4A1
  800. 1250, // TMP
  801. 7000, // G3SG1
  802. 200, // FLASHBANG
  803. 650, // DEAGLE
  804. 3500, // SG552
  805. 2500, // AK47
  806. 0, // KNIFE (not used)
  807. 2350, // P90
  808. 650, // Kevlar
  809. 1000, // Kevlar + Helm
  810. 1250 // NVG
  811. }
  812.  
  813. #endif // FEATURE_BUY
  814.  
  815. #if FEATURE_BUY == true && FEATURE_ADRENALINE == true
  816.  
  817. new const g_iWeaponAdrenaline[] =
  818. {
  819. 0, // (unknown)
  820. 0, // P228
  821. 50, // SHIELD
  822. 50, // SCOUT
  823. 0, // HEGRENADE
  824. 0, // XM1014
  825. 80, // C4
  826. 0, // MAC10
  827. 0, // AUG
  828. 0, // SMOKEGRENADE
  829. 0, // ELITE
  830. 0, // FIVESEVEN
  831. 0, // UMP45
  832. 30, // SG550
  833. 0, // GALIL
  834. 0, // FAMAS
  835. 0, // USP
  836. 0, // GLOCK18
  837. 50, // AWP
  838. 0, // MP5NAVY
  839. 10, // M249
  840. 0, // M3
  841. 0, // M4A1
  842. 0, // TMP
  843. 30, // G3SG1
  844. 0, // FLASHBANG
  845. 0, // DEAGLE
  846. 0, // SG552
  847. 0, // AK47
  848. 0, // KNIFE (not used)
  849. 0, // P90
  850. 0, // Kevlar
  851. 0, // Kevlar + Helm
  852. 0 // NVG
  853. }
  854.  
  855. #endif // FEATURE_ADRENALINE
  856.  
  857. new const Float:g_fWeaponRunSpeed[] = // Konfigurálható - A fegyverek sebessége (a számokat kell módosítani)
  858. {
  859. 150.0, // Zoomed speed with any weapon
  860. 250.0, // P228
  861. 0.0, // SHIELD (nem használt)
  862. 260.0, // SCOUT
  863. 250.0, // HEGRENADE
  864. 240.0, // XM1014
  865. 250.0, // C4
  866. 250.0, // MAC10
  867. 240.0, // AUG
  868. 250.0, // SMOKEGRENADE
  869. 250.0, // ELITE
  870. 250.0, // FIVESEVEN
  871. 250.0, // UMP45
  872. 210.0, // SG550
  873. 240.0, // GALIL
  874. 240.0, // FAMAS
  875. 250.0, // USP
  876. 250.0, // GLOCK18
  877. 210.0, // AWP
  878. 250.0, // MP5NAVY
  879. 220.0, // M249
  880. 230.0, // M3
  881. 230.0, // M4A1
  882. 250.0, // TMP
  883. 210.0, // G3SG1
  884. 250.0, // FLASHBANG
  885. 250.0, // DEAGLE
  886. 235.0, // SG552
  887. 221.0, // AK47
  888. 250.0, // KNIFE
  889. 245.0, // P90
  890. 0.0, // Kevlar (nem használt)
  891. 0.0, // Kevlar + Helm (nem használt)
  892. 0.0 // NVG (nem használt)
  893. }
  894.  
  895. #if FEATURE_BUY == true
  896.  
  897. new const g_iWeaponSlot[] =
  898. {
  899. 0, // none
  900. 2, // P228
  901. 1, // SHIELD
  902. 1, // SCOUT
  903. 4, // HEGRENADE
  904. 1, // XM1014
  905. 5, // C4
  906. 1, // MAC10
  907. 1, // AUG
  908. 4, // SMOKEGRENADE
  909. 2, // ELITE
  910. 2, // FIVESEVEN
  911. 1, // UMP45
  912. 1, // SG550
  913. 1, // GALIL
  914. 1, // FAMAS
  915. 2, // USP
  916. 2, // GLOCK18
  917. 1, // AWP
  918. 1, // MP5NAVY
  919. 1, // M249
  920. 1, // M3
  921. 1, // M4A1
  922. 1, // TMP
  923. 1, // G3SG1
  924. 4, // FLASHBANG
  925. 2, // DEAGLE
  926. 1, // SG552
  927. 1, // AK47
  928. 3, // KNIFE (not used)
  929. 1, // P90
  930. 0, // Kevlar
  931. 0, // Kevlar + Helm
  932. 0 // NVG
  933. }
  934.  
  935. #endif // FEATURE_BUY
  936.  
  937. new const g_szWeaponEntity[][24] =
  938. {
  939. NULL,
  940. "weapon_p228",
  941. "weapon_shield",
  942. "weapon_scout",
  943. "weapon_hegrenade",
  944. "weapon_xm1014",
  945. "weapon_c4",
  946. "weapon_mac10",
  947. "weapon_aug",
  948. "weapon_smokegrenade",
  949. "weapon_elite",
  950. "weapon_fiveseven",
  951. "weapon_ump45",
  952. "weapon_sg550",
  953. "weapon_galil",
  954. "weapon_famas",
  955. "weapon_usp",
  956. "weapon_glock18",
  957. "weapon_awp",
  958. "weapon_mp5navy",
  959. "weapon_m249",
  960. "weapon_m3",
  961. "weapon_m4a1",
  962. "weapon_tmp",
  963. "weapon_g3sg1",
  964. "weapon_flashbang",
  965. "weapon_deagle",
  966. "weapon_sg552",
  967. "weapon_ak47",
  968. "weapon_knife",
  969. "weapon_p90",
  970. "item_kevlar",
  971. "item_assaultsuit",
  972. NULL
  973. }
  974.  
  975. #if FEATURE_BUY == true
  976.  
  977. new const g_szWeaponCommands[][] =
  978. {
  979. {NULL, NULL},
  980. {"p228", "228compact"},
  981. {"shield", NULL},
  982. {"scout", NULL},
  983. {"hegren", NULL},
  984. {"xm1014", "autoshotgun"},
  985. {NULL, NULL},
  986. {"mac10", NULL},
  987. {"aug", "bullpup"},
  988. {"sgren", NULL},
  989. {"elites", NULL},
  990. {"fiveseven", "fn57"},
  991. {"ump45", "sm"},
  992. {"sg550", "krieg550"},
  993. {"galil", "defender"},
  994. {"famas", "clarion"},
  995. {"usp", "km45"},
  996. {"glock", "9x19mm"},
  997. {"awp", "magnum"},
  998. {"mp5", "mp"},
  999. {"m249", NULL},
  1000. {"m3", "12gauge"},
  1001. {"m4a1", NULL},
  1002. {"tmp", NULL},
  1003. {"g3sg1", "d3au1"},
  1004. {"flash", NULL},
  1005. {"deagle", "nighthawk"},
  1006. {"sg552", "krieg552"},
  1007. {"ak47", "cv47"},
  1008. {NULL, NULL},
  1009. {"p90", "c90"},
  1010. {"vest", NULL},
  1011. {"vesthelm", NULL},
  1012. {"nvgs", NULL}
  1013. }
  1014.  
  1015. #endif // FEATURE_BUY
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022. new g_iMaxPlayers
  1023. new g_szMap[32]
  1024. new g_szGame[16]
  1025. new g_iTeam[33]
  1026. new g_iScore[3]
  1027. new g_iFlagHolder[3]
  1028. new g_iFlagEntity[3]
  1029. new g_iBaseEntity[3]
  1030. new Float:g_fFlagDropped[3]
  1031.  
  1032. #if FEATURE_BUY == true
  1033.  
  1034. new g_iMenu[33]
  1035. new g_iRebuy[33][8]
  1036. new g_iAutobuy[33][64]
  1037. new g_iRebuyWeapons[33][8]
  1038.  
  1039. new pCvar_ctf_nospam_flash
  1040. new pCvar_ctf_nospam_he
  1041. new pCvar_ctf_nospam_smoke
  1042. new pCvar_ctf_spawn_prim
  1043. new pCvar_ctf_spawn_sec
  1044. new pCvar_ctf_spawn_knife
  1045.  
  1046. new gMsg_BuyClose
  1047.  
  1048. #endif // FEATURE_BUY
  1049.  
  1050. new g_iMaxArmor[33]
  1051. new g_iMaxHealth[33]
  1052. new g_iAdrenaline[33]
  1053. new g_iAdrenalineUse[33]
  1054. new bool:g_bRestarting
  1055. new bool:g_bBot[33]
  1056. new bool:g_bAlive[33]
  1057. new bool:g_bDefuse[33]
  1058. new bool:g_bLights[33]
  1059. new bool:g_bBuyZone[33]
  1060. new bool:g_bSuicide[33]
  1061. new bool:g_bFreeLook[33]
  1062. new bool:g_bAssisted[33][3]
  1063. new bool:g_bProtected[33]
  1064. new bool:g_bRestarted[33]
  1065. new bool:g_bFirstSpawn[33]
  1066.  
  1067. new Float:g_fFlagBase[3][3]
  1068. new Float:g_fFlagLocation[3][3]
  1069. new Float:g_fWeaponSpeed[33]
  1070. new Float:g_fLastDrop[33]
  1071. new Float:g_fLastBuy[33][4]
  1072.  
  1073. new pCvar_ctf_flagcaptureslay
  1074. new pCvar_ctf_flagheal
  1075. new pCvar_ctf_flagreturn
  1076. new pCvar_ctf_respawntime
  1077. new pCvar_ctf_protection
  1078. new pCvar_ctf_dynamiclights
  1079. new pCvar_ctf_glows
  1080. new pCvar_ctf_weaponstay
  1081. new pCvar_ctf_spawnmoney
  1082. new pCvar_ctf_itempercent
  1083.  
  1084. new pCvar_ctf_sound[4]
  1085. new pCvar_mp_winlimit
  1086. new pCvar_mp_startmoney
  1087. new pCvar_mp_fadetoblack
  1088. new pCvar_mp_forcecamera
  1089. new pCvar_mp_forcechasecam
  1090. new pCvar_mp_autoteambalance
  1091.  
  1092. #if FEATURE_C4 == true
  1093.  
  1094. new pCvar_mp_c4timer
  1095.  
  1096. new gMsg_BarTime
  1097. new gMsg_DeathMsg
  1098. new gMsg_SendAudio
  1099.  
  1100. #endif // FEATURE_C4
  1101.  
  1102. new gMsg_SayText
  1103. new gMsg_RoundTime
  1104. new gMsg_ScreenFade
  1105. new gMsg_HostageK
  1106. new gMsg_HostagePos
  1107. new gMsg_ScoreInfo
  1108. new gMsg_ScoreAttrib
  1109. new gMsg_TextMsg
  1110. new gMsg_TeamScore
  1111.  
  1112. new gHook_EntSpawn
  1113.  
  1114. #if FEATURE_ADRENALINE == true
  1115.  
  1116. new gSpr_trail
  1117. new gSpr_blood1
  1118. new gSpr_blood2
  1119.  
  1120. #endif // FEATURE_ADRENALINE
  1121.  
  1122. new gSpr_regeneration
  1123.  
  1124. new g_iForwardReturn
  1125. new g_iFW_flag
  1126.  
  1127.  
  1128. #if FEATURE_ORPHEU == true
  1129.  
  1130. new pCvar_ctf_infiniteround
  1131. new pCvar_ctf_flagendround
  1132.  
  1133. new g_pGameRules
  1134. new bool:g_bLinux
  1135. new OrpheuHook:g_oMapConditions
  1136. new OrpheuHook:g_oWinConditions
  1137. new OrpheuHook:g_oRoundTimeExpired
  1138. new MEMORY_ROUNDTIME[] = "roundTimeCheck"
  1139.  
  1140. #endif // FEATURE_ORPHEU
  1141.  
  1142.  
  1143.  
  1144. public plugin_precache()
  1145. {
  1146. precache_model(FLAG_MODEL)
  1147. precache_model(ITEM_MODEL_AMMO)
  1148. precache_model(ITEM_MODEL_MEDKIT)
  1149.  
  1150. #if FEATURE_ADRENALINE == true
  1151.  
  1152. precache_model(ITEM_MODEL_ADRENALINE)
  1153.  
  1154. precache_sound(SND_GETADRENALINE)
  1155. precache_sound(SND_ADRENALINE)
  1156.  
  1157. gSpr_trail = precache_model("sprites/zbeam5.spr")
  1158. gSpr_blood1 = precache_model("sprites/blood.spr")
  1159. gSpr_blood2 = precache_model("sprites/bloodspray.spr")
  1160.  
  1161. #endif // FEATURE_ADRENALINE
  1162.  
  1163. precache_sound(SND_GETAMMO)
  1164. precache_sound(SND_GETMEDKIT)
  1165.  
  1166. gSpr_regeneration = precache_model("sprites/th_jctf_heal.spr")
  1167.  
  1168. for(new szSound[64], i = 0; i < sizeof g_szSounds; i++)
  1169. {
  1170. for(new t = 1; t <= 2; t++)
  1171. {
  1172. formatex(szSound, charsmax(szSound), "sound/ctf/%s.mp3", g_szSounds[i][t])
  1173.  
  1174. precache_generic(szSound)
  1175. }
  1176. }
  1177.  
  1178. #if FEATURE_C4 == true
  1179. precache_sound(SND_C4DISARMED)
  1180.  
  1181. new ent = entity_create(g_szRemoveEntities[11])
  1182.  
  1183. if(ent)
  1184. {
  1185. DispatchKeyValue(ent, "buying", "0")
  1186. DispatchKeyValue(ent, "bombradius", C4_RADIUS)
  1187. DispatchSpawn(ent)
  1188. }
  1189. #endif // FEATURE_C4
  1190.  
  1191. gHook_EntSpawn = register_forward(FM_Spawn, "ent_spawn")
  1192.  
  1193.  
  1194. #if FEATURE_ORPHEU == true
  1195.  
  1196. OrpheuRegisterHook(OrpheuGetFunction("InstallGameRules"), "game_onInstallGameRules", OrpheuHookPost)
  1197.  
  1198. #endif // FEATURE_ORPHEU
  1199. }
  1200.  
  1201. public ent_spawn(ent)
  1202. {
  1203. if(!is_valid_ent(ent))
  1204. return FMRES_IGNORED
  1205.  
  1206. static szClass[32]
  1207.  
  1208. entity_get_string(ent, EV_SZ_classname, szClass, charsmax(szClass))
  1209.  
  1210. for(new i = 0; i < sizeof g_szRemoveEntities; i++)
  1211. {
  1212. if(equal(szClass, g_szRemoveEntities[i]))
  1213. {
  1214. entity_remove(ent)
  1215.  
  1216. return FMRES_SUPERCEDE
  1217. }
  1218. }
  1219.  
  1220. return FMRES_IGNORED
  1221. }
  1222.  
  1223. public plugin_init()
  1224. {
  1225. register_plugin(MOD_TITLE, MOD_VERSION, MOD_AUTHOR)
  1226. set_pcvar_string(register_cvar("jctf_version", MOD_VERSION, FCVAR_SERVER|FCVAR_SPONLY), MOD_VERSION)
  1227.  
  1228. register_dictionary("jctf.txt")
  1229. register_dictionary("common.txt")
  1230.  
  1231. new const SEPARATOR_TEMP[] = " - - - - - - - - - - - - - - - - -"
  1232.  
  1233. server_print(SEPARATOR_TEMP)
  1234. server_print(" %s - v%s", MOD_TITLE, MOD_VERSION)
  1235. server_print(" Mod by %s", MOD_AUTHOR)
  1236.  
  1237. #if FEATURE_ORPHEU == false
  1238. server_print("[!] Orpheu module usage is disabled! (FEATURE_ORPHEU = false)")
  1239. #endif
  1240.  
  1241. #if FEATURE_BUY == false
  1242. server_print("[!] Custom buy feature is disabled! (FEATURE_BUY = false)")
  1243. #endif
  1244.  
  1245. #if FEATURE_C4 == false
  1246. server_print("[!] C4 feature is disabled! (FEATURE_BUYC4 = false)")
  1247. #endif
  1248.  
  1249. #if FEATURE_ADRENALINE == false
  1250. server_print("[!] Adrenaline feature is disabled! (FEATURE_ADRENALINE = false)")
  1251. #endif
  1252.  
  1253. server_print(SEPARATOR_TEMP)
  1254.  
  1255. // Forwards, hooks, events, etc
  1256.  
  1257. unregister_forward(FM_Spawn, gHook_EntSpawn)
  1258.  
  1259. register_forward(FM_GetGameDescription, "game_description")
  1260.  
  1261. register_touch(FLAG_CLASSNAME, PLAYER, "flag_touch")
  1262.  
  1263. register_think(FLAG_CLASSNAME, "flag_think")
  1264. register_think(BASE_CLASSNAME, "base_think")
  1265.  
  1266. register_logevent("event_restartGame", 2, "1&Restart_Round", "1&Game_Commencing")
  1267. register_event("HLTV", "event_roundStart", "a", "1=0", "2=0")
  1268.  
  1269. register_clcmd("fullupdate", "msg_block")
  1270.  
  1271. register_event("TeamInfo", "player_joinTeam", "a")
  1272.  
  1273. RegisterHam(Ham_Spawn, PLAYER, "player_spawn", 1)
  1274. RegisterHam(Ham_Killed, PLAYER, "player_killed", 1)
  1275. RegisterHam(Ham_TakeDamage, PLAYER, "player_damage")
  1276.  
  1277. register_clcmd("say", "player_cmd_say")
  1278. register_clcmd("say_team", "player_cmd_sayTeam")
  1279.  
  1280. #if FEATURE_ADRENALINE == true
  1281.  
  1282. register_menucmd(register_menuid(MENU_ADRENALINE), MENU_KEYS_ADRENALINE, "player_key_adrenaline")
  1283.  
  1284. register_clcmd("adrenaline", "player_cmd_adrenaline")
  1285.  
  1286. #endif // FEATURE_ADRENALINE
  1287.  
  1288. #if FEATURE_BUY == true
  1289.  
  1290. register_menucmd(register_menuid(MENU_BUY), MENU_KEYS_BUY, "player_key_buy")
  1291.  
  1292. register_event("StatusIcon", "player_inBuyZone", "be", "2=buyzone")
  1293.  
  1294. register_clcmd("buy", "player_cmd_buy_main")
  1295. register_clcmd("buyammo1", "player_fillAmmo")
  1296. register_clcmd("buyammo2", "player_fillAmmo")
  1297. register_clcmd("primammo", "player_fillAmmo")
  1298. register_clcmd("secammo", "player_fillAmmo")
  1299. register_clcmd("client_buy_open", "player_cmd_buyVGUI")
  1300.  
  1301. register_clcmd("autobuy", "player_cmd_autobuy")
  1302. register_clcmd("cl_autobuy", "player_cmd_autobuy")
  1303. register_clcmd("cl_setautobuy", "player_cmd_setAutobuy")
  1304.  
  1305. register_clcmd("rebuy", "player_cmd_rebuy")
  1306. register_clcmd("cl_rebuy", "player_cmd_rebuy")
  1307. register_clcmd("cl_setrebuy", "player_cmd_setRebuy")
  1308.  
  1309. register_clcmd("buyequip", "player_cmd_buy_equipament")
  1310.  
  1311. #endif // FEATURE_BUY
  1312.  
  1313. for(new w = W_P228; w <= W_NVG; w++)
  1314. {
  1315. #if FEATURE_BUY == true
  1316. for(new i = 0; i < 2; i++)
  1317. {
  1318. if(strlen(g_szWeaponCommands[w][i]))
  1319. register_clcmd(g_szWeaponCommands[w][i], "player_cmd_buyWeapon")
  1320. }
  1321. #endif // FEATURE_BUY
  1322.  
  1323. if(w != W_SHIELD && w <= W_P90)
  1324. RegisterHam(Ham_Weapon_PrimaryAttack, g_szWeaponEntity[w], "player_useWeapon", 1)
  1325. }
  1326.  
  1327. register_clcmd("ctf_moveflag", "admin_cmd_moveFlag", ADMIN_RCON, "<red/blue> - Egy admin szabadon választott helyekre teheti a zászlókat az alaphelyrõl. RCON jog szükséges hozzá. (konfigurálható)")
  1328. register_clcmd("ctf_save", "admin_cmd_saveFlags", ADMIN_RCON)
  1329. register_clcmd("ctf_return", "admin_cmd_returnFlag", ADMIN_RETURN)
  1330.  
  1331. register_clcmd("dropflag", "player_cmd_dropFlag")
  1332.  
  1333. #if FEATURE_C4 == true
  1334.  
  1335. RegisterHam(Ham_Use, GRENADE, "c4_defuse", 1)
  1336. register_logevent("c4_planted", 3, "2=Planted_The_Bomb")
  1337. register_logevent("c4_defused", 3, "2=Defused_The_Bomb")
  1338.  
  1339. register_touch(WEAPONBOX, PLAYER, "c4_pickup")
  1340.  
  1341. #endif // FEATURE_C4
  1342.  
  1343. register_touch(ITEM_CLASSNAME, PLAYER, "item_touch")
  1344.  
  1345. register_event("CurWeapon", "player_currentWeapon", "be", "1=1")
  1346. register_event("SetFOV", "player_currentWeapon", "be", "1>1")
  1347.  
  1348. RegisterHam(Ham_Spawn, WEAPONBOX, "weapon_spawn", 1)
  1349.  
  1350. RegisterHam(Ham_Weapon_SecondaryAttack, g_szWeaponEntity[W_KNIFE], "player_useWeapon", 1) // not a typo
  1351.  
  1352. #if FEATURE_ADRENALINE == true
  1353.  
  1354. RegisterHam(Ham_Weapon_SecondaryAttack, g_szWeaponEntity[W_USP], "player_useWeaponSec", 1)
  1355. RegisterHam(Ham_Weapon_SecondaryAttack, g_szWeaponEntity[W_FAMAS], "player_useWeaponSec", 1)
  1356. RegisterHam(Ham_Weapon_SecondaryAttack, g_szWeaponEntity[W_M4A1], "player_useWeaponSec", 1)
  1357.  
  1358. #endif // FEATURE_ADRENALINE
  1359.  
  1360.  
  1361. #if FEATURE_C4 == true
  1362.  
  1363. gMsg_BarTime = get_user_msgid("BarTime")
  1364. gMsg_DeathMsg = get_user_msgid("DeathMsg")
  1365. gMsg_SendAudio = get_user_msgid("SendAudio")
  1366.  
  1367. register_message(gMsg_BarTime, "c4_used")
  1368. register_message(gMsg_SendAudio, "msg_sendAudio")
  1369.  
  1370. #endif // FEATURE_C4
  1371.  
  1372. gMsg_HostagePos = get_user_msgid("HostagePos")
  1373. gMsg_HostageK = get_user_msgid("HostageK")
  1374. gMsg_RoundTime = get_user_msgid("RoundTime")
  1375. gMsg_SayText = get_user_msgid("SayText")
  1376. gMsg_ScoreInfo = get_user_msgid("ScoreInfo")
  1377. gMsg_ScoreAttrib = get_user_msgid("ScoreAttrib")
  1378. gMsg_ScreenFade = get_user_msgid("ScreenFade")
  1379. gMsg_TextMsg = get_user_msgid("TextMsg")
  1380. gMsg_TeamScore = get_user_msgid("TeamScore")
  1381.  
  1382. register_message(gMsg_TextMsg, "msg_textMsg")
  1383. register_message(get_user_msgid("BombDrop"), "msg_block")
  1384. register_message(get_user_msgid("ClCorpse"), "msg_block")
  1385. register_message(gMsg_HostageK, "msg_block")
  1386. register_message(gMsg_HostagePos, "msg_block")
  1387. register_message(gMsg_RoundTime, "msg_roundTime")
  1388. register_message(gMsg_ScreenFade, "msg_screenFade")
  1389. register_message(gMsg_ScoreAttrib, "msg_scoreAttrib")
  1390. register_message(gMsg_TeamScore, "msg_teamScore")
  1391. register_message(gMsg_SayText, "msg_sayText")
  1392.  
  1393. // CVAROK (A cvarok jelentését lásd a leírásban.)
  1394.  
  1395. pCvar_ctf_flagcaptureslay = register_cvar("ctf_flagcaptureslay", "0")
  1396. pCvar_ctf_flagheal = register_cvar("ctf_flagheal", "1")
  1397. pCvar_ctf_flagreturn = register_cvar("ctf_flagreturn", "120")
  1398. pCvar_ctf_respawntime = register_cvar("ctf_respawntime", "10")
  1399. pCvar_ctf_protection = register_cvar("ctf_protection", "5")
  1400. pCvar_ctf_dynamiclights = register_cvar("ctf_dynamiclights", "1")
  1401. pCvar_ctf_glows = register_cvar("ctf_glows", "1")
  1402. pCvar_ctf_weaponstay = register_cvar("ctf_weaponstay", "15")
  1403. pCvar_ctf_spawnmoney = register_cvar("ctf_spawnmoney", "1000")
  1404. pCvar_ctf_itempercent = register_cvar("ctf_itempercent", "25")
  1405.  
  1406. #if FEATURE_ORPHEU == true
  1407.  
  1408. register_srvcmd("ctf_infiniteround", "server_cmd_infiniteround")
  1409.  
  1410. pCvar_ctf_infiniteround = register_cvar("_ctf_infiniteround_memory", "1")
  1411. pCvar_ctf_flagendround = register_cvar("ctf_flagendround", "0")
  1412.  
  1413. #endif // FEATURE_ORPHEU
  1414.  
  1415.  
  1416. #if FEATURE_BUY == true
  1417.  
  1418. pCvar_ctf_nospam_flash = register_cvar("ctf_nospam_flash", "20")
  1419. pCvar_ctf_nospam_he = register_cvar("ctf_nospam_he", "20")
  1420. pCvar_ctf_nospam_smoke = register_cvar("ctf_nospam_smoke", "20")
  1421. pCvar_ctf_spawn_prim = register_cvar("ctf_spawn_prim", "m3")
  1422. pCvar_ctf_spawn_sec = register_cvar("ctf_spawn_sec", "glock")
  1423. pCvar_ctf_spawn_knife = register_cvar("ctf_spawn_knife", "1")
  1424.  
  1425. gMsg_BuyClose = get_user_msgid("BuyClose")
  1426.  
  1427. #endif // FEATURE_BUY
  1428.  
  1429. pCvar_ctf_sound[EVENT_TAKEN] = register_cvar("ctf_sound_taken", "1")
  1430. pCvar_ctf_sound[EVENT_DROPPED] = register_cvar("ctf_sound_dropped", "1")
  1431. pCvar_ctf_sound[EVENT_RETURNED] = register_cvar("ctf_sound_returned", "1")
  1432. pCvar_ctf_sound[EVENT_SCORE] = register_cvar("ctf_sound_score", "1")
  1433.  
  1434. #if FEATURE_C4 == true
  1435.  
  1436. pCvar_mp_c4timer = get_cvar_pointer("mp_c4timer")
  1437.  
  1438. #endif // FEATURE_C4
  1439.  
  1440. pCvar_mp_winlimit = get_cvar_pointer("mp_winlimit")
  1441. pCvar_mp_startmoney = get_cvar_pointer("mp_startmoney")
  1442. pCvar_mp_fadetoblack = get_cvar_pointer("mp_fadetoblack")
  1443. pCvar_mp_forcecamera = get_cvar_pointer("mp_forcecamera")
  1444. pCvar_mp_forcechasecam = get_cvar_pointer("mp_forcechasecam")
  1445. pCvar_mp_autoteambalance = get_cvar_pointer("mp_autoteambalance")
  1446.  
  1447. // Plugin's forwards
  1448.  
  1449. g_iFW_flag = CreateMultiForward("jctf_flag", ET_IGNORE, FP_CELL, FP_CELL, FP_CELL, FP_CELL)
  1450.  
  1451.  
  1452. // Variables
  1453.  
  1454. new szGame[3]
  1455.  
  1456. get_modname(szGame, charsmax(szGame))
  1457.  
  1458. if(szGame[0] == 'c')
  1459. {
  1460. switch(szGame[1])
  1461. {
  1462. case 's': copy(g_szGame, charsmax(g_szGame), "CS 1.6 ") // leave the space at the end
  1463. case 'z': copy(g_szGame, charsmax(g_szGame), "CS:CZ ")
  1464. }
  1465. }
  1466.  
  1467. get_mapname(g_szMap, charsmax(g_szMap))
  1468.  
  1469. g_iMaxPlayers = get_maxplayers()
  1470.  
  1471.  
  1472. #if FEATURE_C4 == true
  1473. // fake bomb target
  1474.  
  1475. new ent = entity_create(g_szRemoveEntities[2])
  1476.  
  1477. if(ent)
  1478. {
  1479. entity_spawn(ent)
  1480. entity_set_size(ent, Float:{-8192.0, -8192.0, -8192.0}, Float:{8192.0, 8192.0, 8192.0})
  1481. }
  1482. #endif // FEATURE_C4
  1483.  
  1484. #if FEATURE_ORPHEU == true
  1485. g_bLinux = bool:is_linux_server()
  1486.  
  1487. state disabled
  1488.  
  1489. game_enableForwards()
  1490. #endif // FEATURE_ORPHEU
  1491. }
  1492.  
  1493. #if FEATURE_ORPHEU == true
  1494.  
  1495. public game_onInstallGameRules()
  1496. g_pGameRules = OrpheuGetReturn();
  1497.  
  1498. public game_enableForwards() <> {}
  1499. public game_enableForwards() <disabled>
  1500. {
  1501. g_oMapConditions = OrpheuRegisterHook(OrpheuGetFunction("CheckMapConditions", "CHalfLifeMultiplay"), "game_blockConditions")
  1502. g_oWinConditions = OrpheuRegisterHook(OrpheuGetFunction("CheckWinConditions", "CHalfLifeMultiplay"), "game_blockConditions")
  1503.  
  1504. if(g_bLinux)
  1505. g_oRoundTimeExpired = OrpheuRegisterHook(OrpheuGetFunction("HasRoundTimeExpired", "CHalfLifeMultiplay"), "game_blockConditions")
  1506. else
  1507. game_memoryReplace(MEMORY_ROUNDTIME, {0x90, 0x90, 0x90})
  1508.  
  1509. state enabled
  1510. }
  1511.  
  1512. public game_disableForwards() <> {}
  1513. public game_disableForwards() <enabled>
  1514. {
  1515. OrpheuUnregisterHook(g_oMapConditions)
  1516. OrpheuUnregisterHook(g_oWinConditions)
  1517.  
  1518. if(g_bLinux)
  1519. OrpheuUnregisterHook(g_oRoundTimeExpired)
  1520. else
  1521. game_memoryReplace(MEMORY_ROUNDTIME, {0xF6, 0xC4, 0x41})
  1522.  
  1523. state disabled
  1524. }
  1525.  
  1526. public OrpheuHookReturn:game_blockConditions() <>
  1527. return OrpheuIgnored
  1528.  
  1529. public OrpheuHookReturn:game_blockConditions() <enabled>
  1530. {
  1531. OrpheuSetReturn(false)
  1532.  
  1533. return OrpheuSupercede
  1534. }
  1535.  
  1536. game_memoryReplace(szID[], const iBytes[], const iLen = sizeof iBytes)
  1537. {
  1538. new iAddress
  1539.  
  1540. OrpheuMemoryGet(szID, iAddress)
  1541.  
  1542. for(new i; i < iLen; i++)
  1543. {
  1544. OrpheuMemorySetAtAddress(iAddress, "roundTimeCheck|dummy", 1, iBytes[i], iAddress)
  1545.  
  1546. iAddress++
  1547. }
  1548.  
  1549. server_cmd("sv_restart 1")
  1550. }
  1551.  
  1552. public server_cmd_infiniteround()
  1553. {
  1554. if(read_argc() == 2)
  1555. {
  1556. new szArg[2]
  1557.  
  1558. read_argv(1, szArg, charsmax(szArg))
  1559.  
  1560. new iSet = clamp(str_to_num(szArg), 0, 1)
  1561.  
  1562. set_pcvar_num(pCvar_ctf_infiniteround, iSet)
  1563.  
  1564. switch(iSet)
  1565. {
  1566. case 0: game_disableForwards()
  1567. case 1: game_enableForwards()
  1568. }
  1569. }
  1570. else
  1571. server_print("^"ctf_infiniteround^" is ^"%d^"", get_pcvar_num(pCvar_ctf_infiniteround))
  1572. }
  1573.  
  1574. #endif // FEATURE_ORPHEU
  1575.  
  1576. public game_description()
  1577. {
  1578. new szFormat[32]
  1579.  
  1580. formatex(szFormat, charsmax(szFormat), "%sjCTF v%s", g_szGame, MOD_VERSION)
  1581. forward_return(FMV_STRING, szFormat)
  1582.  
  1583. return FMRES_SUPERCEDE
  1584. }
  1585.  
  1586. public plugin_cfg()
  1587. {
  1588. new szFile[64]
  1589.  
  1590. formatex(szFile, charsmax(szFile), FLAG_SAVELOCATION, g_szMap)
  1591.  
  1592. new hFile = fopen(szFile, "rt")
  1593.  
  1594. if(hFile)
  1595. {
  1596. new iFlagTeam = TEAM_RED
  1597. new szData[24]
  1598. new szOrigin[3][6]
  1599.  
  1600. while(fgets(hFile, szData, charsmax(szData)))
  1601. {
  1602. if(iFlagTeam > TEAM_BLUE)
  1603. break
  1604.  
  1605. trim(szData)
  1606. parse(szData, szOrigin[x], charsmax(szOrigin[]), szOrigin[y], charsmax(szOrigin[]), szOrigin[z], charsmax(szOrigin[]))
  1607.  
  1608. g_fFlagBase[iFlagTeam][x] = str_to_float(szOrigin[x])
  1609. g_fFlagBase[iFlagTeam][y] = str_to_float(szOrigin[y])
  1610. g_fFlagBase[iFlagTeam][z] = str_to_float(szOrigin[z])
  1611.  
  1612. iFlagTeam++
  1613. }
  1614.  
  1615. fclose(hFile)
  1616. }
  1617.  
  1618. flag_spawn(TEAM_RED)
  1619. flag_spawn(TEAM_BLUE)
  1620.  
  1621. task_set(6.5, "plugin_postCfg")
  1622. }
  1623.  
  1624. public plugin_postCfg()
  1625. {
  1626. set_cvar_num("mp_freezetime", 0)
  1627. set_cvar_num("mp_limitteams", 0)
  1628. set_cvar_num("mp_buytime", 99999999)
  1629. server_cmd("sv_restart 1")
  1630. }
  1631.  
  1632. public plugin_natives()
  1633. {
  1634. register_library("jctf")
  1635.  
  1636. register_native("jctf_get_team", "native_get_team")
  1637. register_native("jctf_get_flagcarrier", "native_get_flagcarrier")
  1638. register_native("jctf_get_adrenaline", "native_get_adrenaline")
  1639. register_native("jctf_add_adrenaline", "native_add_adrenaline")
  1640. }
  1641.  
  1642. public plugin_end()
  1643. {
  1644. #if FEATURE_ORPHEU == true
  1645.  
  1646. game_disableForwards()
  1647.  
  1648. #endif // FEATURE_ORPHEU
  1649.  
  1650. DestroyForward(g_iFW_flag)
  1651. }
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660. public native_get_team(iPlugin, iParams)
  1661. {
  1662. /* jctf_get_team(id) */
  1663.  
  1664. return g_iTeam[get_param(1)]
  1665. }
  1666.  
  1667. public native_get_flagcarrier(iPlugin, iParams)
  1668. {
  1669. /* jctf_get_flagcarrier(id) */
  1670.  
  1671. new id = get_param(1)
  1672.  
  1673. return g_iFlagHolder[get_opTeam(g_iTeam[id])] == id
  1674. }
  1675.  
  1676. public native_get_adrenaline(iPlugin, iParams)
  1677. {
  1678. #if FEATURE_ADRENALINE == true
  1679.  
  1680. /* jctf_get_adrenaline(id) */
  1681.  
  1682. return g_iAdrenaline[get_param(1)]
  1683.  
  1684. #else // FEATURE_ADRENALINE
  1685.  
  1686. log_error(AMX_ERR_NATIVE, "jctf_get_adrenaline() does not work ! main jCTF plugin has FEATURE_ADRENALINE = false")
  1687.  
  1688. return 0
  1689.  
  1690. #endif // FEATURE_ADRENALINE
  1691. }
  1692.  
  1693. public native_add_adrenaline(iPlugin, iParams)
  1694. {
  1695. #if FEATURE_ADRENALINE == true
  1696.  
  1697. /* jctf_add_adrenaline(id, iAdd, szReason[]) */
  1698.  
  1699. new id = get_param(1)
  1700. new iAdd = get_param(2)
  1701. new szReason[64]
  1702.  
  1703. get_string(3, szReason, charsmax(szReason))
  1704.  
  1705. if(strlen(szReason))
  1706. player_award(id, 0, 0, iAdd, szReason)
  1707.  
  1708. else
  1709. {
  1710. g_iAdrenaline[id] = clamp(g_iAdrenaline[id] + iAdd, 0, 100)
  1711.  
  1712. player_hudAdrenaline(id)
  1713. }
  1714.  
  1715. return g_iAdrenaline[id]
  1716.  
  1717. #else // FEATURE_ADRENALINE
  1718.  
  1719. log_error(AMX_ERR_NATIVE, "jctf_add_adrenaline() does not work ! main jCTF plugin has FEATURE_ADRENALINE = false")
  1720.  
  1721. return 0
  1722.  
  1723. #endif // FEATURE_ADRENALINE
  1724. }
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736. public flag_spawn(iFlagTeam)
  1737. {
  1738. if(g_fFlagBase[iFlagTeam][x] == 0.0 && g_fFlagBase[iFlagTeam][y] == 0.0 && g_fFlagBase[iFlagTeam][z] == 0.0)
  1739. {
  1740. new iFindSpawn = find_ent_by_class(g_iMaxPlayers, iFlagTeam == TEAM_BLUE ? "info_player_start" : "info_player_deathmatch")
  1741.  
  1742. if(iFindSpawn)
  1743. {
  1744. entity_get_vector(iFindSpawn, EV_VEC_origin, g_fFlagBase[iFlagTeam])
  1745.  
  1746. server_print("[CTF] %s flag origin not defined, set on player spawn.", g_szTeamName[iFlagTeam])
  1747. log_error(AMX_ERR_NOTFOUND, "[CTF] %s flag origin not defined, set on player spawn.", g_szTeamName[iFlagTeam])
  1748. }
  1749. else
  1750. {
  1751. server_print("[CTF] WARNING: player spawn for ^"%s^" team does not exist !", g_szTeamName[iFlagTeam])
  1752. log_error(AMX_ERR_NOTFOUND, "[CTF] WARNING: player spawn for ^"%s^" team does not exist !", g_szTeamName[iFlagTeam])
  1753. set_fail_state("Player spawn unexistent!")
  1754.  
  1755. return PLUGIN_CONTINUE
  1756. }
  1757. }
  1758. else
  1759. server_print("[CTF] %s flag and base spawned at: %.1f %.1f %.1f", g_szTeamName[iFlagTeam], g_fFlagBase[iFlagTeam][x], g_fFlagBase[iFlagTeam][y], g_fFlagBase[iFlagTeam][z])
  1760.  
  1761. new ent
  1762. new Float:fGameTime = get_gametime()
  1763.  
  1764. // the FLAG
  1765.  
  1766. ent = entity_create(INFO_TARGET)
  1767.  
  1768. if(!ent)
  1769. return flag_spawn(iFlagTeam)
  1770.  
  1771. entity_set_model(ent, FLAG_MODEL)
  1772. entity_set_string(ent, EV_SZ_classname, FLAG_CLASSNAME)
  1773. entity_set_int(ent, EV_INT_body, iFlagTeam)
  1774. entity_set_int(ent, EV_INT_sequence, FLAG_ANI_STAND)
  1775. entity_spawn(ent)
  1776. entity_set_origin(ent, g_fFlagBase[iFlagTeam])
  1777. entity_set_size(ent, FLAG_HULL_MIN, FLAG_HULL_MAX)
  1778. entity_set_vector(ent, EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
  1779. entity_set_vector(ent, EV_VEC_angles, FLAG_SPAWN_ANGLES)
  1780. entity_set_edict(ent, EV_ENT_aiment, 0)
  1781. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  1782. entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
  1783. entity_set_float(ent, EV_FL_gravity, 2.0)
  1784. entity_set_float(ent, EV_FL_nextthink, fGameTime + FLAG_THINK)
  1785.  
  1786. g_iFlagEntity[iFlagTeam] = ent
  1787. g_iFlagHolder[iFlagTeam] = FLAG_HOLD_BASE
  1788.  
  1789. // flag BASE
  1790.  
  1791. ent = entity_create(INFO_TARGET)
  1792.  
  1793. if(!ent)
  1794. return flag_spawn(iFlagTeam)
  1795.  
  1796. entity_set_string(ent, EV_SZ_classname, BASE_CLASSNAME)
  1797. entity_set_model(ent, FLAG_MODEL)
  1798. entity_set_int(ent, EV_INT_body, 0)
  1799. entity_set_int(ent, EV_INT_sequence, FLAG_ANI_BASE)
  1800. entity_spawn(ent)
  1801. entity_set_origin(ent, g_fFlagBase[iFlagTeam])
  1802. entity_set_vector(ent, EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
  1803. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  1804.  
  1805. if(get_pcvar_num(pCvar_ctf_glows))
  1806. entity_set_int(ent, EV_INT_renderfx, kRenderFxGlowShell)
  1807.  
  1808. entity_set_float(ent, EV_FL_renderamt, 100.0)
  1809. entity_set_float(ent, EV_FL_nextthink, fGameTime + BASE_THINK)
  1810.  
  1811. if(iFlagTeam == TEAM_RED)
  1812. entity_set_vector(ent, EV_VEC_rendercolor, Float:{150.0, 0.0, 0.0})
  1813. else
  1814. entity_set_vector(ent, EV_VEC_rendercolor, Float:{0.0, 0.0, 150.0})
  1815.  
  1816. g_iBaseEntity[iFlagTeam] = ent
  1817.  
  1818. return PLUGIN_CONTINUE
  1819. }
  1820.  
  1821. public flag_think(ent)
  1822. {
  1823. if(!is_valid_ent(ent))
  1824. return
  1825.  
  1826. entity_set_float(ent, EV_FL_nextthink, get_gametime() + FLAG_THINK)
  1827.  
  1828. static id
  1829. static iStatus
  1830. static iFlagTeam
  1831. static iSkip[3]
  1832. static Float:fOrigin[3]
  1833. static Float:fPlayerOrigin[3]
  1834.  
  1835. iFlagTeam = (ent == g_iFlagEntity[TEAM_BLUE] ? TEAM_BLUE : TEAM_RED)
  1836.  
  1837. if(g_iFlagHolder[iFlagTeam] == FLAG_HOLD_BASE)
  1838. fOrigin = g_fFlagBase[iFlagTeam]
  1839. else
  1840. entity_get_vector(ent, EV_VEC_origin, fOrigin)
  1841.  
  1842. g_fFlagLocation[iFlagTeam] = fOrigin
  1843.  
  1844. iStatus = 0
  1845.  
  1846. if(++iSkip[iFlagTeam] >= FLAG_SKIPTHINK)
  1847. {
  1848. iSkip[iFlagTeam] = 0
  1849.  
  1850. if(1 <= g_iFlagHolder[iFlagTeam] <= g_iMaxPlayers)
  1851. {
  1852. id = g_iFlagHolder[iFlagTeam]
  1853.  
  1854. set_hudmessage(HUD_HELP)
  1855. show_hudmessage(id, "%L", id, "HUD_YOUHAVEFLAG")
  1856.  
  1857. iStatus = 1
  1858. }
  1859. else if(g_iFlagHolder[iFlagTeam] == FLAG_HOLD_DROPPED)
  1860. iStatus = 2
  1861.  
  1862. message_begin(MSG_BROADCAST, gMsg_HostagePos)
  1863. write_byte(0)
  1864. write_byte(iFlagTeam)
  1865. engfunc(EngFunc_WriteCoord, fOrigin[x])
  1866. engfunc(EngFunc_WriteCoord, fOrigin[y])
  1867. engfunc(EngFunc_WriteCoord, fOrigin[z])
  1868. message_end()
  1869.  
  1870. message_begin(MSG_BROADCAST, gMsg_HostageK)
  1871. write_byte(iFlagTeam)
  1872. message_end()
  1873.  
  1874. static iStuck[3]
  1875.  
  1876. if(g_iFlagHolder[iFlagTeam] >= FLAG_HOLD_BASE && !(entity_get_int(ent, EV_INT_flags) & FL_ONGROUND))
  1877. {
  1878. if(++iStuck[iFlagTeam] > 4)
  1879. {
  1880. flag_autoReturn(ent)
  1881.  
  1882. log_message("^"%s^" flag is outside world, auto-returned.", g_szTeamName[iFlagTeam])
  1883.  
  1884. return
  1885. }
  1886. }
  1887. else
  1888. iStuck[iFlagTeam] = 0
  1889. }
  1890.  
  1891. for(id = 1; id <= g_iMaxPlayers; id++)
  1892. {
  1893. if(g_iTeam[id] == TEAM_NONE || g_bBot[id])
  1894. continue
  1895.  
  1896. /* Check flag proximity for pickup */
  1897. if(g_iFlagHolder[iFlagTeam] >= FLAG_HOLD_BASE)
  1898. {
  1899. entity_get_vector(id, EV_VEC_origin, fPlayerOrigin)
  1900.  
  1901. if(get_distance_f(fOrigin, fPlayerOrigin) <= FLAG_PICKUPDISTANCE)
  1902. flag_touch(ent, id)
  1903. }
  1904.  
  1905. /* Send dynamic lights to players that have them enabled */
  1906. if(g_iFlagHolder[iFlagTeam] != FLAG_HOLD_BASE && g_bLights[id])
  1907. {
  1908. message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, _, id)
  1909. write_byte(TE_DLIGHT)
  1910. engfunc(EngFunc_WriteCoord, fOrigin[x])
  1911. engfunc(EngFunc_WriteCoord, fOrigin[y])
  1912. engfunc(EngFunc_WriteCoord, fOrigin[z] + (g_iFlagHolder[iFlagTeam] == FLAG_HOLD_DROPPED ? 32 : -16))
  1913. write_byte(FLAG_LIGHT_RANGE)
  1914. write_byte(iFlagTeam == TEAM_RED ? 100 : 0)
  1915. write_byte(0)
  1916. write_byte(iFlagTeam == TEAM_BLUE ? 155 : 0)
  1917. write_byte(FLAG_LIGHT_LIFE)
  1918. write_byte(FLAG_LIGHT_DECAY)
  1919. message_end()
  1920. }
  1921.  
  1922. /* If iFlagTeam's flag is stolen or dropped, constantly warn team players */
  1923. if(iStatus && g_iTeam[id] == iFlagTeam)
  1924. {
  1925. set_hudmessage(HUD_HELP2)
  1926. show_hudmessage(id, "%L", id, (iStatus == 1 ? "HUD_ENEMYHASFLAG" : "HUD_RETURNYOURFLAG"))
  1927. }
  1928. }
  1929. }
  1930.  
  1931. flag_sendHome(iFlagTeam)
  1932. {
  1933. new ent = g_iFlagEntity[iFlagTeam]
  1934.  
  1935. entity_set_edict(ent, EV_ENT_aiment, 0)
  1936. entity_set_origin(ent, g_fFlagBase[iFlagTeam])
  1937. entity_set_int(ent, EV_INT_sequence, FLAG_ANI_STAND)
  1938. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  1939. entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
  1940. entity_set_vector(ent, EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
  1941. entity_set_vector(ent, EV_VEC_angles, FLAG_SPAWN_ANGLES)
  1942.  
  1943. g_iFlagHolder[iFlagTeam] = FLAG_HOLD_BASE
  1944. }
  1945.  
  1946. flag_take(iFlagTeam, id)
  1947. {
  1948. if(g_bProtected[id])
  1949. player_removeProtection(id, "PROTECTION_TOUCHFLAG")
  1950.  
  1951. new ent = g_iFlagEntity[iFlagTeam]
  1952.  
  1953. entity_set_edict(ent, EV_ENT_aiment, id)
  1954. entity_set_int(ent, EV_INT_movetype, MOVETYPE_FOLLOW)
  1955. entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  1956.  
  1957. g_iFlagHolder[iFlagTeam] = id
  1958.  
  1959. message_begin(MSG_BROADCAST, gMsg_ScoreAttrib)
  1960. write_byte(id)
  1961. write_byte(g_iTeam[id] == TEAM_BLUE ? 4 : 2)
  1962. message_end()
  1963.  
  1964. player_updateSpeed(id)
  1965. }
  1966.  
  1967. public flag_touch(ent, id)
  1968. {
  1969. #if FLAG_IGNORE_BOTS == true
  1970.  
  1971. if(!g_bAlive[id] || g_bBot[id])
  1972. return
  1973.  
  1974. #else // FLAG_IGNORE_BOTS
  1975.  
  1976. if(!g_bAlive[id])
  1977. return
  1978.  
  1979. #endif // FLAG_IGNORE_BOTS
  1980.  
  1981. new iFlagTeam = (g_iFlagEntity[TEAM_BLUE] == ent ? TEAM_BLUE : TEAM_RED)
  1982.  
  1983. if(1 <= g_iFlagHolder[iFlagTeam] <= g_iMaxPlayers) // if flag is carried we don't care
  1984. return
  1985.  
  1986. new Float:fGameTime = get_gametime()
  1987.  
  1988. if(g_fLastDrop[id] > fGameTime)
  1989. return
  1990.  
  1991. new iTeam = g_iTeam[id]
  1992.  
  1993. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
  1994. return
  1995.  
  1996. new iFlagTeamOp = get_opTeam(iFlagTeam)
  1997. new szName[32]
  1998.  
  1999. get_user_name(id, szName, charsmax(szName))
  2000.  
  2001. if(iTeam == iFlagTeam) // If the PLAYER is on the same team as the FLAG
  2002. {
  2003. if(g_iFlagHolder[iFlagTeam] == FLAG_HOLD_DROPPED) // if the team's flag is dropped, return it to base
  2004. {
  2005. flag_sendHome(iFlagTeam)
  2006.  
  2007. task_remove(ent)
  2008.  
  2009. player_award(id, REWARD_RETURN, "%L", id, "REWARD_RETURN")
  2010.  
  2011. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_RETURNED, id, iFlagTeam, false)
  2012.  
  2013. new iAssists = 0
  2014.  
  2015. for(new i = 1; i <= g_iMaxPlayers; i++)
  2016. {
  2017. if(i != id && g_bAssisted[i][iFlagTeam] && g_iTeam[i] == iFlagTeam)
  2018. {
  2019. player_award(i, REWARD_RETURN_ASSIST, "%L", i, "REWARD_RETURN_ASSIST")
  2020.  
  2021. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_RETURNED, i, iFlagTeam, true)
  2022.  
  2023. iAssists++
  2024. }
  2025.  
  2026. g_bAssisted[i][iFlagTeam] = false
  2027. }
  2028.  
  2029. if(1 <= g_iFlagHolder[iFlagTeamOp] <= g_iMaxPlayers)
  2030. g_bAssisted[id][iFlagTeamOp] = true
  2031.  
  2032. if(iAssists)
  2033. {
  2034. new szFormat[64]
  2035.  
  2036. format(szFormat, charsmax(szFormat), "%s + %d assists", szName, iAssists)
  2037.  
  2038. game_announce(EVENT_RETURNED, iFlagTeam, szFormat)
  2039. }
  2040. else
  2041. game_announce(EVENT_RETURNED, iFlagTeam, szName)
  2042.  
  2043. log_message("<%s>%s returned the ^"%s^" flag.", g_szTeamName[iTeam], szName, g_szTeamName[iFlagTeam])
  2044.  
  2045. set_hudmessage(HUD_HELP)
  2046. show_hudmessage(id, "%L", id, "HUD_RETURNEDFLAG")
  2047.  
  2048. if(g_bProtected[id])
  2049. player_removeProtection(id, "PROTECTION_TOUCHFLAG")
  2050. }
  2051. else if(g_iFlagHolder[iFlagTeam] == FLAG_HOLD_BASE && g_iFlagHolder[iFlagTeamOp] == id) // if the PLAYER has the ENEMY FLAG and the FLAG is in the BASE make SCORE
  2052. {
  2053. message_begin(MSG_BROADCAST, gMsg_ScoreAttrib)
  2054. write_byte(id)
  2055. write_byte(0)
  2056. message_end()
  2057.  
  2058. player_award(id, REWARD_CAPTURE, "%L", id, "REWARD_CAPTURE")
  2059.  
  2060. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_CAPTURED, id, iFlagTeamOp, false)
  2061.  
  2062. new iAssists = 0
  2063.  
  2064. for(new i = 1; i <= g_iMaxPlayers; i++)
  2065. {
  2066. if(i != id && g_iTeam[i] > 0 && g_iTeam[i] == iTeam)
  2067. {
  2068. if(g_bAssisted[i][iFlagTeamOp])
  2069. {
  2070. player_award(i, REWARD_CAPTURE_ASSIST, "%L", i, "REWARD_CAPTURE_ASSIST")
  2071.  
  2072. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_CAPTURED, i, iFlagTeamOp, true)
  2073.  
  2074. iAssists++
  2075. }
  2076. else
  2077. player_award(i, REWARD_CAPTURE_TEAM, "%L", i, "REWARD_CAPTURE_TEAM")
  2078. }
  2079.  
  2080. g_bAssisted[i][iFlagTeamOp] = false
  2081. }
  2082.  
  2083. set_hudmessage(HUD_HELP)
  2084. show_hudmessage(id, "%L", id, "HUD_CAPTUREDFLAG")
  2085.  
  2086. if(iAssists)
  2087. {
  2088. new szFormat[64]
  2089.  
  2090. format(szFormat, charsmax(szFormat), "%s + %d assists", szName, iAssists)
  2091.  
  2092. game_announce(EVENT_SCORE, iFlagTeam, szFormat)
  2093. }
  2094. else
  2095. game_announce(EVENT_SCORE, iFlagTeam, szName)
  2096.  
  2097. log_message("<%s>%s captured the ^"%s^" flag. (%d assists)", g_szTeamName[iTeam], szName, g_szTeamName[iFlagTeamOp], iAssists)
  2098.  
  2099. emessage_begin(MSG_BROADCAST, gMsg_TeamScore)
  2100. ewrite_string(g_szCSTeams[iFlagTeam])
  2101. ewrite_short(++g_iScore[iFlagTeam])
  2102. emessage_end()
  2103.  
  2104. flag_sendHome(iFlagTeamOp)
  2105.  
  2106. player_updateSpeed(id)
  2107.  
  2108. g_fLastDrop[id] = fGameTime + 3.0
  2109.  
  2110. if(g_bProtected[id])
  2111. player_removeProtection(id, "PROTECTION_TOUCHFLAG")
  2112. else
  2113. player_updateRender(id)
  2114.  
  2115. if(0 < get_pcvar_num(pCvar_mp_winlimit) <= g_iScore[iFlagTeam])
  2116. {
  2117. emessage_begin(MSG_ALL, SVC_INTERMISSION) // hookable mapend
  2118. emessage_end()
  2119.  
  2120. return
  2121. }
  2122.  
  2123. #if FEATURE_ORPHEU == true
  2124.  
  2125. new iFlagRoundEnd = get_pcvar_num(pCvar_ctf_flagendround)
  2126.  
  2127. if(iFlagRoundEnd)
  2128. {
  2129. static OrpheuFunction:ofEndRoundMsg
  2130. static OrpheuFunction:ofUpdateTeamScores
  2131. static OrpheuFunction:ofCheckWinConditions
  2132.  
  2133. if(!ofEndRoundMsg)
  2134. ofEndRoundMsg = OrpheuGetFunction("EndRoundMessage")
  2135.  
  2136. if(!ofUpdateTeamScores)
  2137. ofUpdateTeamScores = OrpheuGetFunction("UpdateTeamScores", "CHalfLifeMultiplay")
  2138.  
  2139. if(!ofCheckWinConditions)
  2140. ofCheckWinConditions = OrpheuGetFunction("CheckWinConditions", "CHalfLifeMultiplay")
  2141.  
  2142. new iEvent
  2143. new iWinStatus
  2144. new szWinOffset[20]
  2145. new szWinMessage[16]
  2146.  
  2147. switch(iFlagTeam)
  2148. {
  2149. case TEAM_RED:
  2150. {
  2151. iEvent = 9
  2152. iWinStatus = 2
  2153. copy(szWinOffset, charsmax(szWinOffset), "m_iNumTerroristWins")
  2154. copy(szWinMessage, charsmax(szWinMessage), "#Terrorists_Win")
  2155. }
  2156.  
  2157. case TEAM_BLUE:
  2158. {
  2159. iEvent = 8
  2160. iWinStatus = 1
  2161. copy(szWinOffset, charsmax(szWinOffset), "m_iNumCTWins")
  2162. copy(szWinMessage, charsmax(szWinMessage), "#CTs_Win")
  2163. }
  2164. }
  2165.  
  2166. OrpheuCallSuper(ofUpdateTeamScores, g_pGameRules)
  2167. OrpheuCallSuper(ofEndRoundMsg, szWinMessage, iEvent)
  2168.  
  2169. OrpheuMemorySetAtAddress(g_pGameRules, "m_iRoundWinStatus", 1, iWinStatus)
  2170. OrpheuMemorySetAtAddress(g_pGameRules, "m_fTeamCount", 1, get_gametime() + 3.0)
  2171. OrpheuMemorySetAtAddress(g_pGameRules, "m_bRoundTerminating", 1, true)
  2172. OrpheuMemorySetAtAddress(g_pGameRules, szWinOffset, 1, g_iScore[iFlagTeam])
  2173.  
  2174. OrpheuCallSuper(ofCheckWinConditions, g_pGameRules)
  2175. }
  2176.  
  2177. #else
  2178. new iFlagRoundEnd = 1
  2179.  
  2180. #endif // FEATURE_ORPHEU
  2181.  
  2182. if(iFlagRoundEnd && get_pcvar_num(pCvar_ctf_flagcaptureslay))
  2183. {
  2184. for(new i = 1; i <= g_iMaxPlayers; i++)
  2185. {
  2186. if(g_iTeam[i] == iFlagTeamOp)
  2187. {
  2188. user_kill(i)
  2189. player_print(i, i, "%L", i, "DEATH_FLAGCAPTURED")
  2190. }
  2191. }
  2192. }
  2193. }
  2194. }
  2195. else
  2196. {
  2197. if(g_iFlagHolder[iFlagTeam] == FLAG_HOLD_BASE)
  2198. {
  2199. player_award(id, REWARD_STEAL, "%L", id, "REWARD_STEAL")
  2200.  
  2201. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_STOLEN, id, iFlagTeam, false)
  2202.  
  2203. log_message("<%s>%s stole the ^"%s^" flag.", g_szTeamName[iTeam], szName, g_szTeamName[iFlagTeam])
  2204. }
  2205. else
  2206. {
  2207. player_award(id, REWARD_PICKUP, "%L", id, "REWARD_PICKUP")
  2208.  
  2209. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_PICKED, id, iFlagTeam, false)
  2210.  
  2211. log_message("<%s>%s picked up the ^"%s^" flag.", g_szTeamName[iTeam], szName, g_szTeamName[iFlagTeam])
  2212. }
  2213.  
  2214. set_hudmessage(HUD_HELP)
  2215. show_hudmessage(id, "%L", id, "HUD_YOUHAVEFLAG")
  2216.  
  2217. flag_take(iFlagTeam, id)
  2218.  
  2219. g_bAssisted[id][iFlagTeam] = true
  2220.  
  2221. task_remove(ent)
  2222.  
  2223. if(g_bProtected[id])
  2224. player_removeProtection(id, "PROTECTION_TOUCHFLAG")
  2225. else
  2226. player_updateRender(id)
  2227.  
  2228. game_announce(EVENT_TAKEN, iFlagTeam, szName)
  2229. }
  2230. }
  2231.  
  2232. public flag_autoReturn(ent)
  2233. {
  2234. task_remove(ent)
  2235.  
  2236. new iFlagTeam = (g_iFlagEntity[TEAM_BLUE] == ent ? TEAM_BLUE : (g_iFlagEntity[TEAM_RED] == ent ? TEAM_RED : 0))
  2237.  
  2238. if(!iFlagTeam)
  2239. return
  2240.  
  2241. flag_sendHome(iFlagTeam)
  2242.  
  2243. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_AUTORETURN, 0, iFlagTeam, false)
  2244.  
  2245. game_announce(EVENT_RETURNED, iFlagTeam, NULL)
  2246.  
  2247. log_message("^"%s^" flag returned automatically", g_szTeamName[iFlagTeam])
  2248. }
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258. public base_think(ent)
  2259. {
  2260. if(!is_valid_ent(ent))
  2261. return
  2262.  
  2263. if(!get_pcvar_num(pCvar_ctf_flagheal))
  2264. {
  2265. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 10.0) /* recheck each 10s seconds */
  2266.  
  2267. return
  2268. }
  2269.  
  2270. entity_set_float(ent, EV_FL_nextthink, get_gametime() + BASE_THINK)
  2271.  
  2272. new iFlagTeam = (g_iBaseEntity[TEAM_BLUE] == ent ? TEAM_BLUE : TEAM_RED)
  2273.  
  2274. if(g_iFlagHolder[iFlagTeam] != FLAG_HOLD_BASE)
  2275. return
  2276.  
  2277. static id
  2278. static iHealth
  2279.  
  2280. id = -1
  2281.  
  2282. while((id = find_ent_in_sphere(id, g_fFlagBase[iFlagTeam], BASE_HEAL_DISTANCE)) != 0)
  2283. {
  2284. if(1 <= id <= g_iMaxPlayers && g_bAlive[id] && g_iTeam[id] == iFlagTeam)
  2285. {
  2286. iHealth = get_user_health(id)
  2287.  
  2288. if(iHealth < g_iMaxHealth[id])
  2289. {
  2290. set_user_health(id, iHealth + 1)
  2291.  
  2292. player_healingEffect(id)
  2293. }
  2294. }
  2295.  
  2296. if(id >= g_iMaxPlayers)
  2297. break
  2298. }
  2299. }
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311. public client_putinserver(id)
  2312. {
  2313. g_bBot[id] = (is_user_bot(id) ? true : false)
  2314.  
  2315. g_iTeam[id] = TEAM_SPEC
  2316. g_bFirstSpawn[id] = true
  2317. g_bRestarted[id] = false
  2318. g_bLights[id] = (g_bBot[id] ? false : (get_pcvar_num(pCvar_ctf_dynamiclights) ? true : false));
  2319.  
  2320. task_set(3.0, "client_putinserverPost", id - TASK_PUTINSERVER)
  2321. }
  2322.  
  2323. public client_putinserverPost(id)
  2324. {
  2325. id += TASK_PUTINSERVER
  2326.  
  2327. player_print(id, id, "%L", id, "JOIN_INFO", "^x04", MOD_TITLE, "^x01", "^x03", MOD_AUTHOR, "^x01")
  2328.  
  2329. client_print(id, print_console, "^n%s", SEPARATOR)
  2330. client_print(id, print_console, " %s v%s - %L", MOD_TITLE, MOD_VERSION, id, "QH_TITLE")
  2331. client_print(id, print_console, " %L %s^n%s", id, "QH_MADEBY", MOD_AUTHOR, SEPARATOR)
  2332. client_print(id, print_console, " %L", id, "QH_LINE1")
  2333. client_print(id, print_console, " %L", id, "QH_LINE2")
  2334. client_print(id, print_console, " %L", id, "QH_LINE3")
  2335. client_print(id, print_console, "^n %L", id, "QH_HELP")
  2336.  
  2337. #if FEATURE_ADRENALINE == true
  2338.  
  2339. client_print(id, print_console, "^n %L", id, "QH_ADRENALINE")
  2340.  
  2341. #endif // FEATURE_ADRENALINE
  2342.  
  2343. #if FEATURE_ORPHEU == false || FEATURE_BUY == false || FEATURE_C4 == false || FEATURE_ADRENALINE == false
  2344.  
  2345. player_print(id, id, "%L", id, "JOIN_NOFEATURES")
  2346.  
  2347. #endif // FEATURE_ORPHEU || FEATURE_BUY || FEATURE_C4 || FEATURE_ADRENALINE
  2348. }
  2349.  
  2350. public client_disconnect(id)
  2351. {
  2352. player_dropFlag(id)
  2353. task_remove(id)
  2354.  
  2355. g_iTeam[id] = TEAM_NONE
  2356. g_iAdrenaline[id] = 0
  2357. g_iAdrenalineUse[id] = 0
  2358.  
  2359. g_bAlive[id] = false
  2360. g_bLights[id] = false
  2361. g_bFreeLook[id] = false
  2362. g_bAssisted[id][TEAM_RED] = false
  2363. g_bAssisted[id][TEAM_BLUE] = false
  2364. }
  2365.  
  2366. public player_joinTeam()
  2367. {
  2368. new id = read_data(1)
  2369.  
  2370. if(g_bAlive[id])
  2371. return
  2372.  
  2373. new szTeam[2]
  2374.  
  2375. read_data(2, szTeam, charsmax(szTeam))
  2376.  
  2377. switch(szTeam[0])
  2378. {
  2379. case 'T':
  2380. {
  2381. if(g_iTeam[id] == TEAM_RED && g_bFirstSpawn[id])
  2382. {
  2383. new iRespawn = get_pcvar_num(pCvar_ctf_respawntime)
  2384.  
  2385. if(iRespawn > 0)
  2386. player_respawn(id - TASK_RESPAWN, iRespawn + 1)
  2387.  
  2388. task_remove(id - TASK_TEAMBALANCE)
  2389. task_set(1.0, "player_checkTeam", id - TASK_TEAMBALANCE)
  2390. }
  2391.  
  2392. g_iTeam[id] = TEAM_RED
  2393. }
  2394.  
  2395. case 'C':
  2396. {
  2397. if(g_iTeam[id] == TEAM_BLUE && g_bFirstSpawn[id])
  2398. {
  2399. new iRespawn = get_pcvar_num(pCvar_ctf_respawntime)
  2400.  
  2401. if(iRespawn > 0)
  2402. player_respawn(id - TASK_RESPAWN, iRespawn + 1)
  2403.  
  2404. task_remove(id - TASK_TEAMBALANCE)
  2405. task_set(1.0, "player_checkTeam", id - TASK_TEAMBALANCE)
  2406. }
  2407.  
  2408. g_iTeam[id] = TEAM_BLUE
  2409. }
  2410.  
  2411. case 'U':
  2412. {
  2413. g_iTeam[id] = TEAM_NONE
  2414. g_bFirstSpawn[id] = true
  2415. }
  2416.  
  2417. default:
  2418. {
  2419. player_screenFade(id, {0,0,0,0}, 0.0, 0.0, FADE_OUT, false)
  2420. player_allowChangeTeam(id)
  2421.  
  2422. g_iTeam[id] = TEAM_SPEC
  2423. g_bFirstSpawn[id] = true
  2424. }
  2425. }
  2426. }
  2427.  
  2428. public player_spawn(id)
  2429. {
  2430. if(!is_user_alive(id) || (!g_bRestarted[id] && g_bAlive[id]))
  2431. return
  2432.  
  2433. /* make sure we have team right */
  2434.  
  2435. switch(cs_get_user_team(id))
  2436. {
  2437. case CS_TEAM_T: g_iTeam[id] = TEAM_RED
  2438. case CS_TEAM_CT: g_iTeam[id] = TEAM_BLUE
  2439. default: return
  2440. }
  2441.  
  2442. g_bAlive[id] = true
  2443. g_bDefuse[id] = false
  2444. g_bBuyZone[id] = true
  2445. g_bFreeLook[id] = false
  2446. g_fLastBuy[id] = Float:{0.0, 0.0, 0.0, 0.0}
  2447.  
  2448. task_remove(id - TASK_PROTECTION)
  2449. task_remove(id - TASK_EQUIPAMENT)
  2450. task_remove(id - TASK_DAMAGEPROTECTION)
  2451. task_remove(id - TASK_TEAMBALANCE)
  2452. task_remove(id - TASK_ADRENALINE)
  2453. task_remove(id - TASK_DEFUSE)
  2454.  
  2455. #if FEATURE_BUY == true
  2456.  
  2457. task_set(0.1, "player_spawnEquipament", id - TASK_EQUIPAMENT)
  2458.  
  2459. #endif // FEATURE_BUY
  2460.  
  2461. task_set(0.2, "player_checkVitals", id - TASK_CHECKHP)
  2462.  
  2463. #if FEATURE_ADRENALINE == true
  2464.  
  2465. player_hudAdrenaline(id)
  2466.  
  2467. #endif // FEATURE_ADRENALINE
  2468.  
  2469. new iProtection = get_pcvar_num(pCvar_ctf_protection)
  2470.  
  2471. if(iProtection > 0)
  2472. player_protection(id - TASK_PROTECTION, iProtection)
  2473.  
  2474. message_begin(MSG_BROADCAST, gMsg_ScoreAttrib)
  2475. write_byte(id)
  2476. write_byte(0)
  2477. message_end()
  2478.  
  2479. if(g_bFirstSpawn[id] || g_bRestarted[id])
  2480. {
  2481. g_bRestarted[id] = false
  2482. g_bFirstSpawn[id] = false
  2483.  
  2484. cs_set_user_money(id, get_pcvar_num(pCvar_mp_startmoney))
  2485. }
  2486. else if(g_bSuicide[id])
  2487. {
  2488. g_bSuicide[id] = false
  2489.  
  2490. player_print(id, id, "%L", id, "SPAWN_NOMONEY")
  2491. }
  2492. else
  2493. cs_set_user_money(id, clamp((cs_get_user_money(id) + get_pcvar_num(pCvar_ctf_spawnmoney)), get_pcvar_num(pCvar_mp_startmoney), 16000))
  2494. }
  2495.  
  2496. public player_checkVitals(id)
  2497. {
  2498. id += TASK_CHECKHP
  2499.  
  2500. if(!g_bAlive[id])
  2501. return
  2502.  
  2503. /* in case player is VIP or whatever special class that sets armor */
  2504. new CsArmorType:iArmorType
  2505. new iArmor = cs_get_user_armor(id, iArmorType)
  2506.  
  2507. g_iMaxArmor[id] = (iArmor > 0 ? iArmor : 100)
  2508. g_iMaxHealth[id] = get_user_health(id)
  2509. }
  2510.  
  2511. #if FEATURE_BUY == true
  2512.  
  2513. public player_spawnEquipament(id)
  2514. {
  2515. id += TASK_EQUIPAMENT
  2516.  
  2517. if(!g_bAlive[id])
  2518. return
  2519.  
  2520. strip_user_weapons(id)
  2521.  
  2522. if(get_pcvar_num(pCvar_ctf_spawn_knife))
  2523. give_item(id, g_szWeaponEntity[W_KNIFE])
  2524.  
  2525. new szWeapon[3][24]
  2526.  
  2527. get_pcvar_string(pCvar_ctf_spawn_prim, szWeapon[1], charsmax(szWeapon[]))
  2528. get_pcvar_string(pCvar_ctf_spawn_sec, szWeapon[2], charsmax(szWeapon[]))
  2529.  
  2530. for(new iWeapon, i = 2; i >= 1; i--)
  2531. {
  2532. iWeapon = 0
  2533.  
  2534. if(strlen(szWeapon[i]))
  2535. {
  2536. for(new w = 1; w < sizeof g_szWeaponCommands; w++)
  2537. {
  2538. if(g_iWeaponSlot[w] == i && equali(szWeapon[i], g_szWeaponCommands[w][0]))
  2539. {
  2540. iWeapon = w
  2541. break
  2542. }
  2543. }
  2544.  
  2545. if(iWeapon)
  2546. {
  2547. give_item(id, g_szWeaponEntity[iWeapon])
  2548. cs_set_user_bpammo(id, iWeapon, g_iBPAmmo[iWeapon])
  2549. }
  2550. else
  2551. log_error(AMX_ERR_NOTFOUND, "Invalid %s weapon: ^"%s^", please fix ctf_spawn_%s cvar", (i == 1 ? "primary" : "secondary"), szWeapon[i], (i == 1 ? "prim" : "sec"))
  2552. }
  2553. }
  2554. }
  2555.  
  2556. #endif // FEATURE_BUY
  2557.  
  2558. public player_protection(id, iStart)
  2559. {
  2560. id += TASK_PROTECTION
  2561.  
  2562. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
  2563. return
  2564.  
  2565. static iCount[33]
  2566.  
  2567. if(iStart)
  2568. {
  2569. iCount[id] = iStart + 1
  2570.  
  2571. g_bProtected[id] = true
  2572.  
  2573. player_updateRender(id)
  2574. }
  2575.  
  2576. if(--iCount[id] > 0)
  2577. {
  2578. set_hudmessage(HUD_RESPAWN)
  2579. show_hudmessage(id, "%L", id, "PROTECTION_LEFT", iCount[id])
  2580.  
  2581. task_set(1.0, "player_protection", id - TASK_PROTECTION)
  2582. }
  2583. else
  2584. player_removeProtection(id, "PROTECTION_EXPIRED")
  2585. }
  2586.  
  2587. public player_removeProtection(id, szLang[])
  2588. {
  2589. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
  2590. return
  2591.  
  2592. g_bProtected[id] = false
  2593.  
  2594. task_remove(id - TASK_PROTECTION)
  2595. task_remove(id - TASK_DAMAGEPROTECTION)
  2596.  
  2597. set_hudmessage(HUD_PROTECTION)
  2598. show_hudmessage(id, "%L", id, szLang)
  2599.  
  2600. player_updateRender(id)
  2601. }
  2602.  
  2603. public player_currentWeapon(id)
  2604. {
  2605. if(!g_bAlive[id])
  2606. return
  2607.  
  2608. static bool:bZoom[33]
  2609.  
  2610. new iZoom = read_data(1)
  2611.  
  2612. if(1 < iZoom <= 90) /* setFOV event */
  2613. bZoom[id] = bool:(iZoom <= 40)
  2614.  
  2615. else /* CurWeapon event */
  2616. {
  2617. if(!bZoom[id]) /* if not zooming, get weapon speed */
  2618. g_fWeaponSpeed[id] = g_fWeaponRunSpeed[read_data(2)]
  2619.  
  2620. else /* if zooming, set zoom speed */
  2621. g_fWeaponSpeed[id] = g_fWeaponRunSpeed[0]
  2622.  
  2623. player_updateSpeed(id)
  2624. }
  2625. }
  2626.  
  2627. public client_PostThink(id)
  2628. {
  2629. if(!g_bAlive[id])
  2630. return
  2631.  
  2632. static iOffset
  2633. static iShield[33]
  2634.  
  2635. iOffset = get_pdata_int(id, m_iUserPrefs)
  2636.  
  2637. if(iOffset & (1<<24)) /* Shield available */
  2638. {
  2639. if(iOffset & (1<<16)) /* Uses shield */
  2640. {
  2641. if(iShield[id] < 2) /* Trigger only once */
  2642. {
  2643. iShield[id] = 2
  2644.  
  2645. g_fWeaponSpeed[id] = 180.0
  2646.  
  2647. player_updateSpeed(id)
  2648. }
  2649. }
  2650. else if(iShield[id] == 2) /* Doesn't use the shield anymore */
  2651. {
  2652. iShield[id] = 1
  2653.  
  2654. g_fWeaponSpeed[id] = 250.0
  2655.  
  2656. player_updateSpeed(id)
  2657. }
  2658. }
  2659. else if(iShield[id]) /* Shield not available anymore */
  2660. iShield[id] = 0
  2661. }
  2662.  
  2663. public player_useWeapon(ent)
  2664. {
  2665. if(!is_valid_ent(ent))
  2666. return
  2667.  
  2668. static id
  2669.  
  2670. id = entity_get_edict(ent, EV_ENT_owner)
  2671.  
  2672. if(1 <= id <= g_iMaxPlayers && g_bAlive[id])
  2673. {
  2674. if(g_bProtected[id])
  2675. player_removeProtection(id, "PROTECTION_WEAPONUSE")
  2676.  
  2677. #if FEATURE_ADRENALINE == true
  2678. else if(g_iAdrenalineUse[id] == ADRENALINE_BERSERK)
  2679. {
  2680. set_pdata_float(ent, m_flNextPrimaryAttack, get_pdata_float(ent, m_flNextPrimaryAttack, 4) * BERSERKER_SPEED1)
  2681. set_pdata_float(ent, m_flNextSecondaryAttack, get_pdata_float(ent, m_flNextSecondaryAttack, 4) * BERSERKER_SPEED2)
  2682. }
  2683. #endif // FEATURE_ADRENALINE
  2684. }
  2685. }
  2686.  
  2687. #if FEATURE_ADRENALINE == true
  2688.  
  2689. public player_useWeaponSec(ent)
  2690. {
  2691. if(!is_valid_ent(ent))
  2692. return
  2693.  
  2694. static id
  2695.  
  2696. id = entity_get_edict(ent, EV_ENT_owner)
  2697.  
  2698. if(1 <= id <= g_iMaxPlayers && g_bAlive[id] && g_iAdrenalineUse[id] == ADRENALINE_BERSERK)
  2699. {
  2700. set_pdata_float(ent, m_flNextPrimaryAttack, get_pdata_float(ent, m_flNextPrimaryAttack, 4) * BERSERKER_SPEED1)
  2701. set_pdata_float(ent, m_flNextSecondaryAttack, get_pdata_float(ent, m_flNextSecondaryAttack, 4) * BERSERKER_SPEED2)
  2702. }
  2703. }
  2704.  
  2705. #endif // FEATURE_ADRENALINE
  2706.  
  2707.  
  2708. public player_damage(id, iWeapon, iAttacker, Float:fDamage, iType)
  2709. {
  2710. if(g_bProtected[id])
  2711. {
  2712. player_updateRender(id, fDamage)
  2713.  
  2714. task_remove(id - TASK_DAMAGEPROTECTION)
  2715. task_set(0.1, "player_damageProtection", id - TASK_DAMAGEPROTECTION)
  2716.  
  2717. entity_set_vector(id, EV_VEC_punchangle, FLAG_SPAWN_ANGLES)
  2718.  
  2719. return HAM_SUPERCEDE
  2720. }
  2721.  
  2722. #if FEATURE_ADRENALINE == true
  2723.  
  2724. else if(1 <= iAttacker <= g_iMaxPlayers && g_iAdrenalineUse[iAttacker] == ADRENALINE_BERSERK && g_iTeam[iAttacker] != g_iTeam[id])
  2725. {
  2726. SetHamParamFloat(4, fDamage * BERSERKER_DAMAGE)
  2727.  
  2728. new iOrigin[3]
  2729.  
  2730. get_user_origin(id, iOrigin)
  2731.  
  2732. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  2733. write_byte(TE_BLOODSPRITE)
  2734. write_coord(iOrigin[x] + random_num(-15, 15))
  2735. write_coord(iOrigin[y] + random_num(-15, 15))
  2736. write_coord(iOrigin[z] + random_num(-15, 15))
  2737. write_short(gSpr_blood2)
  2738. write_short(gSpr_blood1)
  2739. write_byte(248)
  2740. write_byte(18)
  2741. message_end()
  2742.  
  2743. return HAM_OVERRIDE
  2744. }
  2745.  
  2746. #endif // FEATURE_ADRENALINE
  2747.  
  2748. return HAM_IGNORED
  2749. }
  2750.  
  2751. public player_damageProtection(id)
  2752. {
  2753. id += TASK_DAMAGEPROTECTION
  2754.  
  2755. if(g_bAlive[id])
  2756. player_updateRender(id)
  2757. }
  2758.  
  2759. public player_killed(id, killer)
  2760. {
  2761. g_bAlive[id] = false
  2762. g_bBuyZone[id] = false
  2763.  
  2764. task_remove(id - TASK_RESPAWN)
  2765. task_remove(id - TASK_PROTECTION)
  2766. task_remove(id - TASK_EQUIPAMENT)
  2767. task_remove(id - TASK_DAMAGEPROTECTION)
  2768. task_remove(id - TASK_TEAMBALANCE)
  2769. task_remove(id - TASK_ADRENALINE)
  2770. task_remove(id - TASK_DEFUSE)
  2771.  
  2772. new szHint[10]
  2773.  
  2774. #if FEATURE_C4 == true && FEATURE_ADRENALINE == true
  2775.  
  2776. formatex(szHint, charsmax(szHint), "HINT_%d", random_num(1, 12))
  2777.  
  2778. #else
  2779.  
  2780. new iHint
  2781.  
  2782. while((iHint = random_num(1, 12)))
  2783. {
  2784. #if FEATURE_ADRENALINE == false
  2785. if(iHint == 1 || iHint == 7 || iHint == 9)
  2786. continue
  2787. #endif // FEATURE_ADRENALINE
  2788.  
  2789.  
  2790. #if FEATURE_C4 == false
  2791. if(iHint == 4 || iHint == 8 || iHint == 10)
  2792. continue
  2793. #endif // FEATURE_C4
  2794.  
  2795. break
  2796. }
  2797.  
  2798. formatex(szHint, charsmax(szHint), "HINT_%d", iHint)
  2799.  
  2800. #endif // FEATURE_C4 || FEATURE_ADRENALINE
  2801.  
  2802. set_hudmessage(HUD_HINT)
  2803. show_hudmessage(id, "%L: %L", id, "HINT", id, szHint)
  2804. client_print(id, print_console, "%s%L: %L", CONSOLE_PREFIX, id, "HINT", id, szHint)
  2805.  
  2806. #if FEATURE_C4 == true
  2807.  
  2808. new iWeapon = entity_get_edict(id, EV_ENT_dmg_inflictor)
  2809. new szWeapon[10]
  2810. new bool:bC4 = false
  2811.  
  2812. if(iWeapon > g_iMaxPlayers && is_valid_ent(iWeapon))
  2813. {
  2814. entity_get_string(iWeapon, EV_SZ_classname, szWeapon, charsmax(szWeapon))
  2815.  
  2816. if(equal(szWeapon, GRENADE) && get_pdata_int(iWeapon, 96) & (1<<8))
  2817. {
  2818. message_begin(MSG_ALL, gMsg_DeathMsg)
  2819. write_byte(killer)
  2820. write_byte(id)
  2821. write_byte(0)
  2822. write_string("c4")
  2823. message_end()
  2824.  
  2825. bC4 = true
  2826. }
  2827. }
  2828.  
  2829. #endif // FEATURE_C4
  2830.  
  2831. if(id == killer || !(1 <= killer <= g_iMaxPlayers))
  2832. {
  2833. g_bSuicide[id] = true
  2834.  
  2835. player_award(id, PENALTY_SUICIDE, "%L", id, "PENALTY_SUICIDE")
  2836.  
  2837. #if FEATURE_C4 == true
  2838.  
  2839. if(bC4)
  2840. player_setScore(id, -1, 1)
  2841.  
  2842. #endif // FEATURE_C4
  2843.  
  2844. }
  2845. else if(1 <= killer <= g_iMaxPlayers)
  2846. {
  2847. if(g_iTeam[id] == g_iTeam[killer])
  2848. {
  2849.  
  2850. #if FEATURE_C4 == true
  2851.  
  2852. if(bC4)
  2853. {
  2854. player_setScore(killer, -1, 0)
  2855. cs_set_user_money(killer, clamp(cs_get_user_money(killer) - 3300, 0, 16000), 1)
  2856. }
  2857.  
  2858. #endif // FEATURE_C4
  2859.  
  2860. player_award(killer, PENALTY_TEAMKILL, "%L", killer, "PENALTY_TEAMKILL")
  2861. }
  2862. else
  2863. {
  2864.  
  2865. #if FEATURE_C4 == true
  2866.  
  2867. if(bC4)
  2868. {
  2869. player_setScore(killer, -1, 0)
  2870. player_setScore(id, 0, 1)
  2871.  
  2872. cs_set_user_money(killer, clamp(cs_get_user_money(killer) + 300, 0, 16000), 1)
  2873. }
  2874.  
  2875. #endif // FEATURE_C4
  2876.  
  2877. if(id == g_iFlagHolder[g_iTeam[killer]])
  2878. {
  2879. g_bAssisted[killer][g_iTeam[killer]] = true
  2880.  
  2881. player_award(killer, REWARD_KILLCARRIER, "%L", killer, "REWARD_KILLCARRIER")
  2882.  
  2883. message_begin(MSG_BROADCAST, gMsg_ScoreAttrib)
  2884. write_byte(id)
  2885. write_byte(0)
  2886. message_end()
  2887. }
  2888. else
  2889. {
  2890. player_spawnItem(id)
  2891. player_award(killer, REWARD_KILL, "%L", killer, "REWARD_KILL")
  2892. }
  2893. }
  2894. }
  2895.  
  2896. #if FEATURE_ADRENALINE == true
  2897.  
  2898. if(g_iAdrenalineUse[id])
  2899. {
  2900.  
  2901. switch(g_iAdrenalineUse[id])
  2902. {
  2903. case ADRENALINE_SPEED:
  2904. {
  2905. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  2906. write_byte(TE_KILLBEAM)
  2907. write_short(id)
  2908. message_end()
  2909. }
  2910. }
  2911.  
  2912. g_iAdrenaline[id] = 0
  2913. g_iAdrenalineUse[id] = 0
  2914.  
  2915. player_updateRender(id)
  2916. player_hudAdrenaline(id)
  2917. }
  2918.  
  2919. #endif // FEATURE_ADRENALINE
  2920.  
  2921. new iRespawn = get_pcvar_num(pCvar_ctf_respawntime)
  2922.  
  2923. if(iRespawn > 0)
  2924. player_respawn(id - TASK_RESPAWN, iRespawn)
  2925.  
  2926. player_dropFlag(id)
  2927. player_allowChangeTeam(id)
  2928.  
  2929. task_set(1.0, "player_checkTeam", id - TASK_TEAMBALANCE)
  2930. }
  2931.  
  2932. public player_checkTeam(id)
  2933. {
  2934. id += TASK_TEAMBALANCE
  2935.  
  2936. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE) || g_bAlive[id] || !get_pcvar_num(pCvar_mp_autoteambalance))
  2937. return
  2938.  
  2939. new iPlayers[3]
  2940. new iTeam = g_iTeam[id]
  2941. new iOpTeam = get_opTeam(iTeam)
  2942.  
  2943. for(new i = 1; i <= g_iMaxPlayers; i++)
  2944. {
  2945. if(TEAM_RED <= g_iTeam[i] <= TEAM_BLUE)
  2946. iPlayers[g_iTeam[i]]++
  2947. }
  2948.  
  2949. if((iPlayers[iTeam] > 1 && !iPlayers[iOpTeam]) || iPlayers[iTeam] > (iPlayers[iOpTeam] + 1))
  2950. {
  2951. player_allowChangeTeam(id)
  2952.  
  2953. engclient_cmd(id, "jointeam", (iOpTeam == TEAM_BLUE ? "2" : "1"))
  2954.  
  2955. set_task(2.0, "player_forceJoinClass", id)
  2956.  
  2957. player_print(id, id, "%L", id, "DEATH_TRANSFER", "^x04", id, g_szMLTeamName[iOpTeam], "^x01")
  2958. }
  2959. }
  2960.  
  2961. public player_forceJoinClass(id)
  2962. {
  2963. engclient_cmd(id, "joinclass", "5")
  2964. }
  2965.  
  2966. public player_respawn(id, iStart)
  2967. {
  2968. id += TASK_RESPAWN
  2969.  
  2970. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE) || g_bAlive[id])
  2971. return
  2972.  
  2973. static iCount[33]
  2974.  
  2975. if(iStart)
  2976. iCount[id] = iStart + 1
  2977.  
  2978. set_hudmessage(HUD_RESPAWN)
  2979.  
  2980. if(--iCount[id] > 0)
  2981. {
  2982. show_hudmessage(id, "%L", id, "RESPAWNING_IN", iCount[id])
  2983. client_print(id, print_console, "%L", id, "RESPAWNING_IN", iCount[id])
  2984.  
  2985. task_set(1.0, "player_respawn", id - TASK_RESPAWN)
  2986. }
  2987. else
  2988. {
  2989. show_hudmessage(id, "%L", id, "RESPAWNING")
  2990. client_print(id, print_console, "%L", id, "RESPAWNING")
  2991.  
  2992. entity_set_int(id, EV_INT_deadflag, DEAD_RESPAWNABLE)
  2993. entity_set_int(id, EV_INT_iuser1, 0)
  2994. entity_think(id)
  2995. entity_spawn(id)
  2996. set_user_health(id, 100)
  2997. }
  2998. }
  2999.  
  3000. #if FEATURE_ADRENALINE == true
  3001.  
  3002. public player_cmd_buySpawn(id)
  3003. {
  3004. if(g_bAlive[id] || !(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
  3005. player_print(id, id, "%L", id, "INSTANTSPAWN_NOTEAM")
  3006.  
  3007. else if(g_iAdrenaline[id] < INSTANTSPAWN_COST)
  3008. player_print(id, id, "%L", id, "INSTANTSPAWN_NOADRENALINE", INSTANTSPAWN_COST)
  3009.  
  3010. else
  3011. {
  3012. g_iAdrenaline[id] -= INSTANTSPAWN_COST
  3013.  
  3014. player_print(id, id, "%L", id, "INSTANTSPAWN_BOUGHT", INSTANTSPAWN_COST)
  3015.  
  3016. task_remove(id)
  3017. player_respawn(id - TASK_RESPAWN, -1)
  3018. }
  3019.  
  3020. return PLUGIN_HANDLED
  3021. }
  3022.  
  3023. #endif // FEATURE_ADRENALINE
  3024.  
  3025. public player_cmd_dropFlag(id)
  3026. {
  3027. if(!g_bAlive[id] || id != g_iFlagHolder[get_opTeam(g_iTeam[id])])
  3028. player_print(id, id, "%L", id, "DROPFLAG_NOFLAG")
  3029.  
  3030. else
  3031. {
  3032. new iOpTeam = get_opTeam(g_iTeam[id])
  3033.  
  3034. player_dropFlag(id)
  3035. player_award(id, PENALTY_DROP, "%L", id, "PENALTY_MANUALDROP")
  3036.  
  3037. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_MANUALDROP, id, iOpTeam, false)
  3038.  
  3039. g_bAssisted[id][iOpTeam] = false
  3040. }
  3041.  
  3042. return PLUGIN_HANDLED
  3043. }
  3044.  
  3045. public player_dropFlag(id)
  3046. {
  3047. new iOpTeam = get_opTeam(g_iTeam[id])
  3048.  
  3049. if(id != g_iFlagHolder[iOpTeam])
  3050. return
  3051.  
  3052. new ent = g_iFlagEntity[iOpTeam]
  3053.  
  3054. if(!is_valid_ent(ent))
  3055. return
  3056.  
  3057. g_fLastDrop[id] = get_gametime() + 2.0
  3058. g_iFlagHolder[iOpTeam] = FLAG_HOLD_DROPPED
  3059.  
  3060. entity_set_edict(ent, EV_ENT_aiment, -1)
  3061. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  3062. entity_set_int(ent, EV_INT_sequence, FLAG_ANI_DROPPED)
  3063. entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
  3064. entity_set_origin(ent, g_fFlagLocation[iOpTeam])
  3065.  
  3066. new Float:fReturn = get_pcvar_float(pCvar_ctf_flagreturn)
  3067.  
  3068. if(fReturn > 0)
  3069. task_set(fReturn, "flag_autoReturn", ent)
  3070.  
  3071. if(g_bAlive[id])
  3072. {
  3073. new Float:fVelocity[3]
  3074.  
  3075. velocity_by_aim(id, 200, fVelocity)
  3076.  
  3077. fVelocity[z] = 0.0
  3078.  
  3079. entity_set_vector(ent, EV_VEC_velocity, fVelocity)
  3080.  
  3081. player_updateSpeed(id)
  3082. player_updateRender(id)
  3083.  
  3084. message_begin(MSG_BROADCAST, gMsg_ScoreAttrib)
  3085. write_byte(id)
  3086. write_byte(0)
  3087. message_end()
  3088. }
  3089. else
  3090. entity_set_vector(ent, EV_VEC_velocity, FLAG_DROP_VELOCITY)
  3091.  
  3092. new szName[32]
  3093.  
  3094. get_user_name(id, szName, charsmax(szName))
  3095.  
  3096. game_announce(EVENT_DROPPED, iOpTeam, szName)
  3097.  
  3098. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_DROPPED, id, iOpTeam, false)
  3099.  
  3100. g_fFlagDropped[iOpTeam] = get_gametime()
  3101.  
  3102. log_message("<%s>%s dropped the ^"%s^" flag.", g_szTeamName[g_iTeam[id]], szName, g_szTeamName[iOpTeam])
  3103. }
  3104.  
  3105. public player_cmd_say(id)
  3106. {
  3107. static Float:fLastUsage[33]
  3108.  
  3109. new Float:fGameTime = get_gametime()
  3110.  
  3111. if((fLastUsage[id] + 0.5) > fGameTime)
  3112. return PLUGIN_HANDLED
  3113.  
  3114. fLastUsage[id] = fGameTime
  3115.  
  3116. new szMsg[128]
  3117.  
  3118. read_args(szMsg, charsmax(szMsg))
  3119. remove_quotes(szMsg)
  3120. trim(szMsg)
  3121.  
  3122. if(equal(szMsg, NULL))
  3123. return PLUGIN_HANDLED
  3124.  
  3125. if(equal(szMsg[0], "@"))
  3126. return PLUGIN_CONTINUE
  3127.  
  3128. new szFormat[192]
  3129. new szName[32]
  3130.  
  3131. get_user_name(id, szName, charsmax(szName))
  3132.  
  3133. switch(g_iTeam[id])
  3134. {
  3135. case TEAM_RED, TEAM_BLUE: formatex(szFormat, charsmax(szFormat), "^x01%s^x03%s ^x01: %s", (g_bAlive[id] ? NULL : "^x01*DEAD* "), szName, szMsg)
  3136. case TEAM_NONE, TEAM_SPEC: formatex(szFormat, charsmax(szFormat), "^x01*SPEC* ^x03%s ^x01: %s", szName, szMsg)
  3137. }
  3138.  
  3139. for(new i = 1; i <= g_iMaxPlayers; i++)
  3140. {
  3141. if(i == id || g_iTeam[i] == TEAM_NONE || g_bAlive[i] == g_bAlive[id] || g_bBot[id])
  3142. continue
  3143.  
  3144. message_begin(MSG_ONE, gMsg_SayText, _, i)
  3145. write_byte(id)
  3146. write_string(szFormat)
  3147. message_end()
  3148. }
  3149.  
  3150. #if FEATURE_BUY == true
  3151.  
  3152. if(equali(szMsg, "/buy"))
  3153. {
  3154. player_menu_buy(id, 0)
  3155.  
  3156. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3157. }
  3158.  
  3159. #endif // FEATURE_BUY
  3160.  
  3161. #if FEATURE_ADRENALINE == true
  3162.  
  3163. if(equali(szMsg, "/spawn"))
  3164. {
  3165. player_cmd_buySpawn(id)
  3166.  
  3167. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3168. }
  3169.  
  3170. if(equali(szMsg, "/adrenaline"))
  3171. {
  3172. player_cmd_adrenaline(id)
  3173.  
  3174. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3175. }
  3176.  
  3177. #endif // FEATURE_ADRENALINE
  3178.  
  3179. if(equali(szMsg, "/help"))
  3180. {
  3181. player_cmd_help(id)
  3182.  
  3183. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3184. }
  3185.  
  3186. if(equali(szMsg, "/dropflag"))
  3187. {
  3188. player_cmd_dropFlag(id)
  3189.  
  3190. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3191. }
  3192.  
  3193. if(equali(szMsg, "/lights", 7))
  3194. {
  3195. player_cmd_setLights(id, szMsg[8])
  3196.  
  3197. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3198. }
  3199.  
  3200. if(equali(szMsg, "/sounds", 7))
  3201. {
  3202. player_cmd_setSounds(id, szMsg[8])
  3203.  
  3204. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3205. }
  3206.  
  3207. return PLUGIN_CONTINUE
  3208. }
  3209.  
  3210. public player_cmd_sayTeam(id)
  3211. {
  3212. static Float:fLastUsage[33]
  3213.  
  3214. new Float:fGameTime = get_gametime()
  3215.  
  3216. if((fLastUsage[id] + 0.5) > fGameTime)
  3217. return PLUGIN_HANDLED
  3218.  
  3219. fLastUsage[id] = fGameTime
  3220.  
  3221. new szMsg[128]
  3222.  
  3223. read_args(szMsg, charsmax(szMsg))
  3224. remove_quotes(szMsg)
  3225. trim(szMsg)
  3226.  
  3227. if(equal(szMsg, NULL))
  3228. return PLUGIN_HANDLED
  3229.  
  3230. if(equal(szMsg[0], "@"))
  3231. return PLUGIN_CONTINUE
  3232.  
  3233. new szFormat[192]
  3234. new szName[32]
  3235.  
  3236. get_user_name(id, szName, charsmax(szName))
  3237.  
  3238. switch(g_iTeam[id])
  3239. {
  3240. case TEAM_RED, TEAM_BLUE: formatex(szFormat, charsmax(szFormat), "^x01%s(%L) ^x03%s ^x01: %s", (g_bAlive[id] ? NULL : "*DEAD* "), LANG_PLAYER, g_szMLFlagTeam[g_iTeam[id]], szName, szMsg)
  3241. case TEAM_NONE, TEAM_SPEC: formatex(szFormat, charsmax(szFormat), "^x01*SPEC*(%L) ^x03%s ^x01: %s", LANG_PLAYER, g_szMLTeamName[TEAM_SPEC], szName, szMsg)
  3242. }
  3243.  
  3244. for(new i = 1; i <= g_iMaxPlayers; i++)
  3245. {
  3246. if(i == id || g_iTeam[i] == TEAM_NONE || g_iTeam[i] != g_iTeam[id] || g_bAlive[i] == g_bAlive[id] || g_bBot[id])
  3247. continue
  3248.  
  3249. message_begin(MSG_ONE, gMsg_SayText, _, i)
  3250. write_byte(id)
  3251. write_string(szFormat)
  3252. message_end()
  3253. }
  3254.  
  3255. #if FEATURE_BUY == true
  3256.  
  3257. if(equali(szMsg, "/buy"))
  3258. {
  3259. player_menu_buy(id, 0)
  3260.  
  3261. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3262. }
  3263.  
  3264. #endif // FEATURE_BUY
  3265.  
  3266. #if FEATURE_ADRENALINE == true
  3267.  
  3268. if(equali(szMsg, "/spawn"))
  3269. {
  3270. player_cmd_buySpawn(id)
  3271.  
  3272. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3273. }
  3274.  
  3275. if(equali(szMsg, "/adrenaline"))
  3276. {
  3277. player_cmd_adrenaline(id)
  3278.  
  3279. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3280. }
  3281.  
  3282. #endif // FEATURE_ADRENALINE
  3283.  
  3284. if(equali(szMsg, "/dropflag"))
  3285. {
  3286. player_cmd_dropFlag(id)
  3287.  
  3288. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3289. }
  3290.  
  3291. if(equali(szMsg, "/help"))
  3292. {
  3293. player_cmd_help(id)
  3294.  
  3295. return CHAT_SHOW_COMMANDS ? PLUGIN_CONTINUE : PLUGIN_HANDLED
  3296. }
  3297.  
  3298. return PLUGIN_CONTINUE
  3299. }
  3300.  
  3301. public player_cmd_help(id)
  3302. {
  3303. client_cmd(id, "hideconsole;toggleconsole")
  3304.  
  3305. client_print(id, print_console, "^n^n^n^n%s", SEPARATOR)
  3306. client_print(id, print_console, " %s v%s - %L^n Mod by %s", MOD_TITLE, MOD_VERSION, id, "HELP_TITLE", MOD_AUTHOR)
  3307. client_print(id, print_console, SEPARATOR)
  3308. client_print(id, print_console, " 1. %L^n 2. %L^n 3. %L^n 4. %L", id, "HELP_1", id, "HELP_2", id, "HELP_3", id, "HELP_4")
  3309. client_print(id, print_console, "^n --- 1: %L ---^n", id, "HELP_1")
  3310. client_print(id, print_console, "%L", id, "HELP_1_LINE1")
  3311. client_print(id, print_console, "%L", id, "HELP_1_LINE2")
  3312. client_print(id, print_console, "%L", id, "HELP_1_LINE3")
  3313. client_print(id, print_console, "%L", id, "HELP_1_LINE4")
  3314. client_print(id, print_console, "^n --- 2: %L ---", id, "HELP_2")
  3315. client_print(id, print_console, "%L", id, "HELP_2_NOTE")
  3316. client_print(id, print_console, "%L", id, "HELP_2_LINE1")
  3317. client_print(id, print_console, "%L", id, "HELP_2_LINE2")
  3318.  
  3319. #if FEATURE_ADRENALINE == true
  3320. client_print(id, print_console, "%L", id, "HELP_2_LINE3", INSTANTSPAWN_COST)
  3321. #endif // FEATURE_ADRENALINE
  3322.  
  3323. client_print(id, print_console, "%L", id, "HELP_2_LINE4")
  3324.  
  3325. #if FEATURE_ADRENALINE == true
  3326. client_print(id, print_console, "%L", id, "HELP_2_LINE5")
  3327. #endif // FEATURE_ADRENALINE
  3328.  
  3329. client_print(id, print_console, "^n --- 3: %L ---", id, "HELP_3")
  3330.  
  3331. #if FEATURE_ORPHEU == false
  3332. client_print(id, print_console, " * %L", id, "HELP_3_INFROUND", id, "OFF")
  3333. client_print(id, print_console, " * %L", id, "HELP_3_ROUNDEND", id, "OFF")
  3334. #else
  3335. client_print(id, print_console, " * %L", id, "HELP_3_INFROUND", id, get_pcvar_num(pCvar_ctf_infiniteround) ? "ON" : "OFF")
  3336. client_print(id, print_console, " * %L", id, "HELP_3_ROUNDEND", id, get_pcvar_num(pCvar_ctf_flagendround) ? "ON" : "OFF")
  3337. #endif
  3338.  
  3339. client_print(id, print_console, " * %L", id, "HELP_3_CAPTURESLAY", id, get_pcvar_num(pCvar_ctf_flagcaptureslay) ? "ON" : "OFF")
  3340.  
  3341. #if FEATURE_BUY == true
  3342. client_print(id, print_console, " * %L", id, "HELP_3_BUY", id, "ON")
  3343. #else
  3344. client_print(id, print_console, " * %L", id, "HELP_3_BUY", id, "OFF")
  3345. #endif
  3346.  
  3347. #if FEATURE_C4 == true
  3348. client_print(id, print_console, " * %L", id, "HELP_3_C4", id, "ON")
  3349. #else
  3350. client_print(id, print_console, " * %L", id, "HELP_3_C4", id, "OFF")
  3351. #endif
  3352.  
  3353. #if FEATURE_ADRENALINE == true
  3354. client_print(id, print_console, " * %L", id, "HELP_3_ADRENALINE", id, "ON")
  3355. #else
  3356. client_print(id, print_console, " * %L", id, "HELP_3_ADRENALINE", id, "OFF")
  3357. #endif
  3358.  
  3359. client_print(id, print_console, " * %L", id, "HELP_3_FLAGHEAL", id, get_pcvar_num(pCvar_ctf_flagheal) ? "ON" : "OFF")
  3360. client_print(id, print_console, " * %L", id, "HELP_3_RESPAWN", get_pcvar_num(pCvar_ctf_respawntime))
  3361. client_print(id, print_console, " * %L", id, "HELP_3_PROTECTION", get_pcvar_num(pCvar_ctf_protection))
  3362. client_print(id, print_console, " * %L", id, "HELP_3_FLAGRETURN", get_pcvar_num(pCvar_ctf_flagreturn))
  3363. client_print(id, print_console, " * %L", id, "HELP_3_WEAPONSTAY", get_pcvar_num(pCvar_ctf_weaponstay))
  3364. client_print(id, print_console, " * %L", id, "HELP_3_ITEMDROP", get_pcvar_num(pCvar_ctf_itempercent))
  3365.  
  3366. client_print(id, print_console, "^n --- 4: %L ---", id, "HELP_4")
  3367. client_print(id, print_console, " %L: http://forums.alliedmods.net/showthread.php?t=132115", id, "HELP_4_LINE1")
  3368. client_print(id, print_console, " %L: http://thehunters.ro/jctf", id, "HELP_4_LINE2")
  3369. client_print(id, print_console, SEPARATOR)
  3370.  
  3371. return PLUGIN_HANDLED
  3372. }
  3373.  
  3374. public player_cmd_setLights(id, const szMsg[])
  3375. {
  3376. switch(szMsg[1])
  3377. {
  3378. case 'n':
  3379. {
  3380. g_bLights[id] = true
  3381. player_print(id, id, "%L", id, "LIGHTS_ON", "^x04", "^x01")
  3382. }
  3383.  
  3384. case 'f':
  3385. {
  3386. g_bLights[id] = false
  3387. player_print(id, id, "%L", id, "LIGHTS_OFF", "^x04", "^x01")
  3388. }
  3389.  
  3390. default: player_print(id, id, "%L", id, "LIGHTS_INVALID", "^x04", "^x01", "^x04")
  3391. }
  3392.  
  3393. return PLUGIN_HANDLED
  3394. }
  3395.  
  3396. public player_cmd_setSounds(id, const szMsg[])
  3397. {
  3398. if(equali(szMsg, "test"))
  3399. {
  3400. player_print(id, id, "%L", id, "SOUNDS_TEST", "^x04 Red Flag Taken^x01")
  3401. client_cmd(id, "mp3 play ^"sound/ctf/red_flag_taken.mp3^"")
  3402.  
  3403. return PLUGIN_HANDLED
  3404. }
  3405.  
  3406. new iVol = (strlen(szMsg) ? str_to_num(szMsg) : -1)
  3407.  
  3408. if(0 <= iVol <= 10)
  3409. {
  3410. client_cmd(id, "mp3volume %.2f", iVol == 0 ? 0.0 : iVol * 0.1)
  3411. player_print(id, id, "%L", id, "SOUNDS_SET", "^x04", iVol)
  3412. }
  3413. else
  3414. player_print(id, id, "%L", id, "SOUNDS_INVALID", "^x04 0^x01", "^x04 10^x01", "^x04 test")
  3415.  
  3416. return PLUGIN_HANDLED
  3417. }
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429. #if FEATURE_ADRENALINE == true
  3430.  
  3431. public player_cmd_adrenaline(id)
  3432. {
  3433. player_hudAdrenaline(id)
  3434.  
  3435. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE) || !g_bAlive[id])
  3436. return player_print(id, id, "%L", id, "ADR_ALIVE")
  3437.  
  3438. if(g_iAdrenalineUse[id])
  3439. return player_print(id, id, "%L", id, "ADR_USING")
  3440.  
  3441. if(g_iAdrenaline[id] < 100)
  3442. return player_print(id, id, "%L", id, "ADR_MORE", 100)
  3443.  
  3444. new szFormat[256]
  3445.  
  3446. formatex(szFormat, charsmax(szFormat), "\r%L:^n^n\w1. \y%L \d(%L)^n\w2. \y%L \d(%L)^n\w3. \y%L \d(%L)^n\w4. \y%L \d(%L)^n^n\d\w0. %L",
  3447. id, "ADR_MENU_TITLE",
  3448. id, "ADR_SPEED", id, "ADR_SPEED_DESC",
  3449. id, "ADR_BERSERK", id, "ADR_BERSERK_DESC",
  3450. id, "ADR_REGENERATE", id, "ADR_REGENERATE_DESC",
  3451. id, "ADR_INVISIBILITY", id, "ADR_INVISIBILITY_DESC",
  3452. id, "EXIT"
  3453. )
  3454.  
  3455. show_menu(id, MENU_KEYS_ADRENALINE, szFormat, -1, MENU_ADRENALINE)
  3456.  
  3457. return PLUGIN_HANDLED
  3458. }
  3459.  
  3460. public player_key_adrenaline(id, iKey)
  3461. {
  3462. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE) || !g_bAlive[id])
  3463. return player_print(id, id, "%L", id, "ADR_ALIVE")
  3464.  
  3465. if(g_iAdrenalineUse[id])
  3466. return player_print(id, id, "%L", id, "ADR_USING")
  3467.  
  3468. if(g_iAdrenaline[id] < 100)
  3469. return player_print(id, id, "%L", id, "ADR_USING", 100)
  3470.  
  3471. iKey += 1
  3472.  
  3473. if(1 <= iKey <= 4)
  3474. player_useAdrenaline(id, iKey)
  3475.  
  3476. return PLUGIN_HANDLED
  3477. }
  3478.  
  3479. public player_useAdrenaline(id, iUse)
  3480. {
  3481. if(!(1 <= iUse <= 4))
  3482. return PLUGIN_HANDLED
  3483.  
  3484. if(!(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE) || !g_bAlive[id])
  3485. return player_print(id, id, "%L", id, "ADR_ALIVE")
  3486.  
  3487. if(g_iAdrenalineUse[id])
  3488. return player_print(id, id, "%L", id, "ADR_USING")
  3489.  
  3490. if(g_iAdrenaline[id] < 100)
  3491. return player_print(id, id, "%L", id, "ADR_USING", 100)
  3492.  
  3493. if(g_bProtected[id])
  3494. player_removeProtection(id, "PROTECTION_ADRENALINE")
  3495.  
  3496. g_iAdrenalineUse[id] = iUse
  3497.  
  3498. task_set(0.25, "player_adrenalineDrain", id - TASK_ADRENALINE)
  3499.  
  3500. if(iUse == ADRENALINE_SPEED)
  3501. {
  3502. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3503. write_byte(TE_BEAMFOLLOW)
  3504. write_short(id)
  3505. write_short(gSpr_trail)
  3506. write_byte(8) // life in 0.1's
  3507. write_byte(6) // line width in 0.1's
  3508. write_byte(255)
  3509. write_byte(255)
  3510. write_byte(0)
  3511. write_byte(255) // brightness
  3512. message_end()
  3513.  
  3514. player_updateSpeed(id)
  3515. }
  3516.  
  3517. player_updateRender(id)
  3518.  
  3519. new iOrigin[3]
  3520.  
  3521. get_user_origin(id, iOrigin)
  3522.  
  3523. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  3524. write_byte(TE_IMPLOSION)
  3525. write_coord(iOrigin[x])
  3526. write_coord(iOrigin[y])
  3527. write_coord(iOrigin[z])
  3528. write_byte(128) // radius
  3529. write_byte(32) // count
  3530. write_byte(4) // life in 0.1's
  3531. message_end()
  3532.  
  3533. emit_sound(id, CHAN_ITEM, SND_ADRENALINE, VOL_NORM, ATTN_NORM, 0, 255)
  3534.  
  3535. return PLUGIN_HANDLED
  3536. }
  3537.  
  3538. public player_adrenalineDrain(id)
  3539. {
  3540. id += TASK_ADRENALINE
  3541.  
  3542. if(!g_bAlive[id] || !g_iAdrenalineUse[id] || !(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE))
  3543. {
  3544. g_iAdrenaline[id] = 0
  3545. return
  3546. }
  3547.  
  3548. if(g_iAdrenaline[id] > 0)
  3549. {
  3550. new iDrain = (player_hasFlag(id) ? 2 : 1)
  3551.  
  3552. g_iAdrenaline[id] = clamp(g_iAdrenaline[id] - (g_iAdrenalineUse[id] == ADRENALINE_REGENERATE ? iDrain : iDrain * 2), 0, 100)
  3553.  
  3554. switch(g_iAdrenalineUse[id])
  3555. {
  3556. case ADRENALINE_REGENERATE:
  3557. {
  3558. new iHealth = get_user_health(id)
  3559.  
  3560. if(iHealth < (g_iMaxHealth[id] + REGENERATE_EXTRAHP))
  3561. set_user_health(id, iHealth + 1)
  3562.  
  3563. else
  3564. {
  3565. new CsArmorType:ArmorType
  3566. new iArmor = cs_get_user_armor(id, ArmorType)
  3567.  
  3568. if(iArmor < g_iMaxArmor[id])
  3569. cs_set_user_armor(id, iArmor + 1, ArmorType)
  3570. }
  3571.  
  3572. player_healingEffect(id)
  3573. }
  3574. }
  3575.  
  3576. task_set(0.25, "player_adrenalineDrain", id - TASK_ADRENALINE)
  3577. }
  3578. else
  3579. {
  3580. new iUsed = g_iAdrenalineUse[id]
  3581.  
  3582. g_iAdrenaline[id] = 0
  3583. g_iAdrenalineUse[id] = 0 /* to allow player_updateSpeed() to work correctly */
  3584.  
  3585. switch(iUsed)
  3586. {
  3587. case ADRENALINE_SPEED:
  3588. {
  3589. player_updateSpeed(id)
  3590.  
  3591. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  3592. write_byte(TE_KILLBEAM)
  3593. write_short(id)
  3594. message_end()
  3595. }
  3596.  
  3597. case ADRENALINE_BERSERK, ADRENALINE_INVISIBILITY: player_updateRender(id)
  3598. }
  3599. }
  3600.  
  3601. player_hudAdrenaline(id)
  3602. }
  3603.  
  3604. #endif // FEATURE_ADRENALINE
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617. public admin_cmd_moveFlag(id, level, cid)
  3618. {
  3619. if(!cmd_access(id, level, cid, 2))
  3620. return PLUGIN_HANDLED
  3621.  
  3622. new szTeam[2]
  3623.  
  3624. read_argv(1, szTeam, charsmax(szTeam))
  3625.  
  3626. new iTeam = str_to_num(szTeam)
  3627.  
  3628. if(!(TEAM_RED <= iTeam <= TEAM_BLUE))
  3629. {
  3630. switch(szTeam[0])
  3631. {
  3632. case 'r', 'R': iTeam = 1
  3633. case 'b', 'B': iTeam = 2
  3634. }
  3635. }
  3636.  
  3637. if(!(TEAM_RED <= iTeam <= TEAM_BLUE))
  3638. return PLUGIN_HANDLED
  3639.  
  3640. entity_get_vector(id, EV_VEC_origin, g_fFlagBase[iTeam])
  3641.  
  3642. entity_set_origin(g_iBaseEntity[iTeam], g_fFlagBase[iTeam])
  3643. entity_set_vector(g_iBaseEntity[iTeam], EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
  3644.  
  3645. if(g_iFlagHolder[iTeam] == FLAG_HOLD_BASE)
  3646. {
  3647. entity_set_origin(g_iFlagEntity[iTeam], g_fFlagBase[iTeam])
  3648. entity_set_vector(g_iFlagEntity[iTeam], EV_VEC_velocity, FLAG_SPAWN_VELOCITY)
  3649. }
  3650.  
  3651. new szName[32]
  3652. new szSteam[48]
  3653.  
  3654. get_user_name(id, szName, charsmax(szName))
  3655. get_user_authid(id, szSteam, charsmax(szSteam))
  3656.  
  3657. log_amx("Admin %s<%s><%s> moved %s flag to %.2f %.2f %.2f", szName, szSteam, g_szTeamName[g_iTeam[id]], g_szTeamName[iTeam], g_fFlagBase[iTeam][0], g_fFlagBase[iTeam][1], g_fFlagBase[iTeam][2])
  3658.  
  3659. show_activity_key("ADMIN_MOVEBASE_1", "ADMIN_MOVEBASE_2", szName, LANG_PLAYER, g_szMLFlagTeam[iTeam])
  3660.  
  3661. client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_MOVEBASE_MOVED", id, g_szMLFlagTeam[iTeam])
  3662.  
  3663. return PLUGIN_HANDLED
  3664. }
  3665.  
  3666. public admin_cmd_saveFlags(id, level, cid)
  3667. {
  3668. if(!cmd_access(id, level, cid, 1))
  3669. return PLUGIN_HANDLED
  3670.  
  3671. new iOrigin[3][3]
  3672. new szFile[96]
  3673. new szBuffer[1024]
  3674.  
  3675. FVecIVec(g_fFlagBase[TEAM_RED], iOrigin[TEAM_RED])
  3676. FVecIVec(g_fFlagBase[TEAM_BLUE], iOrigin[TEAM_BLUE])
  3677.  
  3678. formatex(szBuffer, charsmax(szBuffer), "%d %d %d^n%d %d %d", iOrigin[TEAM_RED][x], iOrigin[TEAM_RED][y], iOrigin[TEAM_RED][z], iOrigin[TEAM_BLUE][x], iOrigin[TEAM_BLUE][y], iOrigin[TEAM_BLUE][z])
  3679. formatex(szFile, charsmax(szFile), FLAG_SAVELOCATION, g_szMap)
  3680.  
  3681. if(file_exists(szFile))
  3682. delete_file(szFile)
  3683.  
  3684. write_file(szFile, szBuffer)
  3685.  
  3686. new szName[32]
  3687. new szSteam[48]
  3688.  
  3689. get_user_name(id, szName, charsmax(szName))
  3690. get_user_authid(id, szSteam, charsmax(szSteam))
  3691.  
  3692. log_amx("Admin %s<%s><%s> saved flag positions.", szName, szSteam, g_szTeamName[g_iTeam[id]])
  3693.  
  3694. client_print(id, print_console, "%s%L %s", CONSOLE_PREFIX, id, "ADMIN_MOVEBASE_SAVED", szFile)
  3695.  
  3696. return PLUGIN_HANDLED
  3697. }
  3698.  
  3699. public admin_cmd_returnFlag(id, level, cid)
  3700. {
  3701. if(!cmd_access(id, level, cid, 2))
  3702. return PLUGIN_HANDLED
  3703.  
  3704. new szTeam[2]
  3705.  
  3706. read_argv(1, szTeam, charsmax(szTeam))
  3707.  
  3708. new iTeam = str_to_num(szTeam)
  3709.  
  3710. if(!(TEAM_RED <= iTeam <= TEAM_BLUE))
  3711. {
  3712. switch(szTeam[0])
  3713. {
  3714. case 'r', 'R': iTeam = 1
  3715. case 'b', 'B': iTeam = 2
  3716. }
  3717. }
  3718.  
  3719. if(!(TEAM_RED <= iTeam <= TEAM_BLUE))
  3720. return PLUGIN_HANDLED
  3721.  
  3722. if(g_iFlagHolder[iTeam] == FLAG_HOLD_DROPPED)
  3723. {
  3724. if(g_fFlagDropped[iTeam] < (get_gametime() - ADMIN_RETURNWAIT))
  3725. {
  3726. new szName[32]
  3727. new szSteam[48]
  3728.  
  3729. new Float:fFlagOrigin[3]
  3730.  
  3731. entity_get_vector(g_iFlagEntity[iTeam], EV_VEC_origin, fFlagOrigin)
  3732.  
  3733. flag_sendHome(iTeam)
  3734.  
  3735. ExecuteForward(g_iFW_flag, g_iForwardReturn, FLAG_ADMINRETURN, id, iTeam, false)
  3736.  
  3737. game_announce(EVENT_RETURNED, iTeam, NULL)
  3738.  
  3739. get_user_name(id, szName, charsmax(szName))
  3740. get_user_authid(id, szSteam, charsmax(szSteam))
  3741.  
  3742. log_message("^"%s^" flag returned by admin %s<%s><%s>", g_szTeamName[iTeam], szName, szSteam, g_szTeamName[g_iTeam[id]])
  3743. log_amx("Admin %s<%s><%s> returned %s flag from %.2f %.2f %.2f", szName, szSteam, g_szTeamName[g_iTeam[id]], g_szTeamName[iTeam], fFlagOrigin[0], fFlagOrigin[1], fFlagOrigin[2])
  3744.  
  3745. show_activity_key("ADMIN_RETURN_1", "ADMIN_RETURN_2", szName, LANG_PLAYER, g_szMLFlagTeam[iTeam])
  3746.  
  3747. client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_RETURN_DONE", id, g_szMLFlagTeam[iTeam])
  3748. }
  3749. else
  3750. client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_RETURN_WAIT", id, g_szMLFlagTeam[iTeam], ADMIN_RETURNWAIT)
  3751. }
  3752. else
  3753. client_print(id, print_console, "%s%L", CONSOLE_PREFIX, id, "ADMIN_RETURN_NOTDROPPED", id, g_szMLFlagTeam[iTeam])
  3754.  
  3755. return PLUGIN_HANDLED
  3756. }
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769. #if FEATURE_BUY == true
  3770.  
  3771. public player_inBuyZone(id)
  3772. {
  3773. if(!g_bAlive[id])
  3774. return
  3775.  
  3776. g_bBuyZone[id] = (read_data(1) ? true : false)
  3777.  
  3778. if(!g_bBuyZone[id])
  3779. set_pdata_int(id, 205, 0) // no "close menu upon exit buyzone" thing
  3780. }
  3781.  
  3782. public player_cmd_setAutobuy(id)
  3783. {
  3784. new iIndex
  3785. new szWeapon[24]
  3786. new szArgs[1024]
  3787.  
  3788. read_args(szArgs, charsmax(szArgs))
  3789. remove_quotes(szArgs)
  3790. trim(szArgs)
  3791.  
  3792. while(contain(szArgs, WHITESPACE) != -1)
  3793. {
  3794. strbreak(szArgs, szWeapon, charsmax(szWeapon), szArgs, charsmax(szArgs))
  3795.  
  3796. for(new bool:bFound, w = W_P228; w <= W_NVG; w++)
  3797. {
  3798. if(!bFound)
  3799. {
  3800. for(new i = 0; i < 2; i++)
  3801. {
  3802. if(!bFound && equali(g_szWeaponCommands[w][i], szWeapon))
  3803. {
  3804. bFound = true
  3805.  
  3806. g_iAutobuy[id][iIndex++] = w
  3807. }
  3808. }
  3809. }
  3810. }
  3811. }
  3812.  
  3813. player_cmd_autobuy(id)
  3814.  
  3815. return PLUGIN_HANDLED
  3816. }
  3817.  
  3818. public player_cmd_autobuy(id)
  3819. {
  3820. if(!g_bAlive[id])
  3821. return PLUGIN_HANDLED
  3822.  
  3823. if(!g_bBuyZone[id])
  3824. {
  3825. client_print(id, print_center, "%L", id, "BUY_NOTINZONE")
  3826. return PLUGIN_HANDLED
  3827. }
  3828.  
  3829. new iMoney = cs_get_user_money(id)
  3830.  
  3831. for(new bool:bBought[6], iWeapon, i = 0; i < sizeof g_iAutobuy[]; i++)
  3832. {
  3833. if(!g_iAutobuy[id][i])
  3834. return PLUGIN_HANDLED
  3835.  
  3836. iWeapon = g_iAutobuy[id][i]
  3837.  
  3838. if(bBought[g_iWeaponSlot[iWeapon]])
  3839. continue
  3840.  
  3841. #if FEATURE_ADRENALINE == true
  3842.  
  3843. if((g_iWeaponPrice[iWeapon] > 0 && g_iWeaponPrice[iWeapon] > iMoney) || (g_iWeaponAdrenaline[iWeapon] > 0 && g_iWeaponAdrenaline[iWeapon] > g_iAdrenaline[id]))
  3844. continue
  3845.  
  3846. #else // FEATURE_ADRENALINE
  3847.  
  3848. if(g_iWeaponPrice[iWeapon] > 0 && g_iWeaponPrice[iWeapon] > iMoney)
  3849. continue
  3850.  
  3851. #endif // FEATURE_ADRENALINE
  3852.  
  3853. player_buyWeapon(id, iWeapon)
  3854. bBought[g_iWeaponSlot[iWeapon]] = true
  3855. }
  3856.  
  3857. return PLUGIN_HANDLED
  3858. }
  3859.  
  3860. public player_cmd_setRebuy(id)
  3861. {
  3862. new iIndex
  3863. new szType[18]
  3864. new szArgs[256]
  3865.  
  3866. read_args(szArgs, charsmax(szArgs))
  3867. replace_all(szArgs, charsmax(szArgs), "^"", NULL)
  3868. trim(szArgs)
  3869.  
  3870. while(contain(szArgs, WHITESPACE) != -1)
  3871. {
  3872. split(szArgs, szType, charsmax(szType), szArgs, charsmax(szArgs), WHITESPACE)
  3873.  
  3874. for(new i = 1; i < sizeof g_szRebuyCommands; i++)
  3875. {
  3876. if(equali(szType, g_szRebuyCommands[i]))
  3877. g_iRebuy[id][++iIndex] = i
  3878. }
  3879. }
  3880.  
  3881. player_cmd_rebuy(id)
  3882.  
  3883. return PLUGIN_HANDLED
  3884. }
  3885.  
  3886. public player_cmd_rebuy(id)
  3887. {
  3888. if(!g_bAlive[id])
  3889. return PLUGIN_HANDLED
  3890.  
  3891. if(!g_bBuyZone[id])
  3892. {
  3893. client_print(id, print_center, "%L", id, "BUY_NOTINZONE")
  3894. return PLUGIN_HANDLED
  3895. }
  3896.  
  3897. new iBought
  3898.  
  3899. for(new iType, iBuy, i = 1; i < sizeof g_iRebuy[]; i++)
  3900. {
  3901. iType = g_iRebuy[id][i]
  3902.  
  3903. if(!iType)
  3904. continue
  3905.  
  3906. iBuy = g_iRebuyWeapons[id][iType]
  3907.  
  3908. if(!iBuy)
  3909. continue
  3910.  
  3911. switch(iType)
  3912. {
  3913. case primary, secondary: player_buyWeapon(id, iBuy)
  3914.  
  3915. case armor: player_buyWeapon(id, (iBuy == 2 ? W_VESTHELM : W_VEST))
  3916.  
  3917. case he: player_buyWeapon(id, W_HEGRENADE)
  3918.  
  3919. case flash:
  3920. {
  3921. player_buyWeapon(id, W_FLASHBANG)
  3922.  
  3923. if(iBuy == 2)
  3924. player_buyWeapon(id, W_FLASHBANG)
  3925. }
  3926.  
  3927. case smoke: player_buyWeapon(id, W_SMOKEGRENADE)
  3928.  
  3929. case nvg: player_buyWeapon(id, W_NVG)
  3930. }
  3931.  
  3932. iBought++
  3933.  
  3934. if(iType == flash && iBuy == 2)
  3935. iBought++
  3936. }
  3937.  
  3938. if(iBought)
  3939. client_print(id, print_center, "%L", id, "BUY_REBOUGHT", iBought)
  3940.  
  3941. return PLUGIN_HANDLED
  3942. }
  3943.  
  3944. public player_addRebuy(id, iWeapon)
  3945. {
  3946. if(!g_bAlive[id])
  3947. return
  3948.  
  3949. switch(g_iWeaponSlot[iWeapon])
  3950. {
  3951. case 1: g_iRebuyWeapons[id][primary] = iWeapon
  3952. case 2: g_iRebuyWeapons[id][secondary] = iWeapon
  3953.  
  3954. default:
  3955. {
  3956. switch(iWeapon)
  3957. {
  3958. case W_VEST: g_iRebuyWeapons[id][armor] = (g_iRebuyWeapons[id][armor] == 2 ? 2 : 1)
  3959. case W_VESTHELM: g_iRebuyWeapons[id][armor] = 2
  3960. case W_FLASHBANG: g_iRebuyWeapons[id][flash] = clamp(g_iRebuyWeapons[id][flash] + 1, 0, 2)
  3961. case W_HEGRENADE: g_iRebuyWeapons[id][he] = 1
  3962. case W_SMOKEGRENADE: g_iRebuyWeapons[id][smoke] = 1
  3963. case W_NVG: g_iRebuyWeapons[id][nvg] = 1
  3964. }
  3965. }
  3966. }
  3967. }
  3968.  
  3969. public player_cmd_buy_main(id)
  3970. return player_menu_buy(id, 0)
  3971.  
  3972. public player_cmd_buy_equipament(id)
  3973. return player_menu_buy(id, 8)
  3974.  
  3975. public player_cmd_buyVGUI(id)
  3976. {
  3977. message_begin(MSG_ONE, gMsg_BuyClose, _, id)
  3978. message_end()
  3979.  
  3980. return player_menu_buy(id, 0)
  3981. }
  3982.  
  3983. public player_menu_buy(id, iMenu)
  3984. {
  3985. if(!g_bAlive[id])
  3986. return PLUGIN_HANDLED
  3987.  
  3988. if(!g_bBuyZone[id])
  3989. {
  3990. client_print(id, print_center, "%L", id, "BUY_NOTINZONE")
  3991. return PLUGIN_HANDLED
  3992. }
  3993.  
  3994. static szMenu[1024]
  3995.  
  3996. new iMoney = cs_get_user_money(id)
  3997.  
  3998. switch(iMenu)
  3999. {
  4000. case 1:
  4001. {
  4002. formatex(szMenu, charsmax(szMenu),
  4003. "\y%L: %L^n^n\d1. \%sGlock 18\R$%d^n\d2. \%sUSP\R$%d^n\d3. \%sP228\R$%d^n\d4. \%sDesert Eagle\R$%d^n\d5. \%sFiveseven\R$%d^n\d6. \%sDual Elites\R$%d^n^n\d0. \w%L",
  4004. id, "BUYMENU_TITLE", id, "BUYMENU_PISTOLS",
  4005. (iMoney >= g_iWeaponPrice[W_GLOCK18] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_GLOCK18],
  4006. (iMoney >= g_iWeaponPrice[W_USP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_USP],
  4007. (iMoney >= g_iWeaponPrice[W_P228] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_P228],
  4008. (iMoney >= g_iWeaponPrice[W_DEAGLE] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_DEAGLE],
  4009. (iMoney >= g_iWeaponPrice[W_FIVESEVEN] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_FIVESEVEN],
  4010. (iMoney >= g_iWeaponPrice[W_ELITE] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_ELITE],
  4011. id, "EXIT"
  4012. )
  4013. }
  4014.  
  4015. case 2:
  4016. {
  4017. formatex(szMenu, charsmax(szMenu),
  4018. "\y%L: %L^n^n\d1. \%sM3 Super90\R$%d^n\d2. \%sXM1014\R$%d^n^n\d0. \w%L",
  4019. id, "BUYMENU_TITLE", id, "BUYMENU_SHOTGUNS",
  4020. (iMoney >= g_iWeaponPrice[W_M3] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_M3],
  4021. (iMoney >= g_iWeaponPrice[W_XM1014] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_XM1014],
  4022. id, "EXIT"
  4023. )
  4024. }
  4025.  
  4026. case 3:
  4027. {
  4028. formatex(szMenu, charsmax(szMenu),
  4029. "\y%L: %L^n^n\d1. \%sTMP\R$%d^n\d2. \%sMac-10\R$%d^n\d3. \%sMP5 Navy\R$%d^n\d4. \%sUMP-45\R$%d^n\d5. \%sP90\R$%d^n^n\d0. \w%L",
  4030. id, "BUYMENU_TITLE", id, "BUYMENU_SMGS",
  4031. (iMoney >= g_iWeaponPrice[W_TMP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_TMP],
  4032. (iMoney >= g_iWeaponPrice[W_MAC10] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_MAC10],
  4033. (iMoney >= g_iWeaponPrice[W_MP5NAVY] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_MP5NAVY],
  4034. (iMoney >= g_iWeaponPrice[W_UMP45] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_UMP45],
  4035. (iMoney >= g_iWeaponPrice[W_P90] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_P90],
  4036. id, "EXIT"
  4037. )
  4038. }
  4039.  
  4040. case 4:
  4041. {
  4042. formatex(szMenu, charsmax(szMenu),
  4043. "\y%L: %L^n^n\d1. \%sGalil\R$%d^n\d2. \%sFamas\R$%d^n\d3. \%sAK-47\R$%d^n\d4. \%sM4A1\R$%d^n\d5. \%sAUG\R$%d^n\d6. \%sSG552\R$%d^n^n\d0. \w%L",
  4044. id, "BUYMENU_TITLE", id, "BUYMENU_RIFLES",
  4045. (iMoney >= g_iWeaponPrice[W_GALIL] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_GALIL],
  4046. (iMoney >= g_iWeaponPrice[W_FAMAS] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_FAMAS],
  4047. (iMoney >= g_iWeaponPrice[W_AK47] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_AK47],
  4048. (iMoney >= g_iWeaponPrice[W_M4A1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_M4A1],
  4049. (iMoney >= g_iWeaponPrice[W_AUG] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_AUG],
  4050. (iMoney >= g_iWeaponPrice[W_SG552] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SG552],
  4051. id, "EXIT"
  4052. )
  4053. }
  4054.  
  4055. case 5:
  4056. {
  4057.  
  4058. #if FEATURE_ADRENALINE == true
  4059.  
  4060. #if FEATURE_C4 == true
  4061.  
  4062. formatex(szMenu, charsmax(szMenu),
  4063. "\y%L: %L^n^n\d1. \%sM249 \w(\%s%d %L\w)\R\%s$%d^n\d3. \%sSG550 \w(\%s%d %L\w)\R\%s$%d^n\d3. \%sG3SG1 \w(\%s%d %L\w)\R\%s$%d^n\d4. \%sScout \w(\%s%d %L\w)\R\%s$%d^n\d5. \%sAWP \w(\%s%d %L\w)\R\%s$%d^n\d6. \%s%L \w(\%s%d %L\w)\R\%s$%d^n\d7. \%s%L \w(\%s%d %L\w)\R\%s$%d^n^n\d0. \w%L",
  4064. id, "BUYMENU_TITLE", id, "BUYMENU_SPECIAL",
  4065. (iMoney >= g_iWeaponPrice[W_M249] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_M249] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_M249], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_M249],
  4066. (iMoney >= g_iWeaponPrice[W_SG550] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SG550] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_SG550], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SG550],
  4067. (iMoney >= g_iWeaponPrice[W_G3SG1] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_G3SG1] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_G3SG1], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_G3SG1],
  4068. (iMoney >= g_iWeaponPrice[W_SCOUT] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SCOUT] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_SCOUT], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SCOUT],
  4069. (iMoney >= g_iWeaponPrice[W_AWP] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_AWP] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_AWP], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_AWP],
  4070. (iMoney >= g_iWeaponPrice[W_SHIELD] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_SHIELD", (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SHIELD] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_SHIELD], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SHIELD],
  4071. (iMoney >= g_iWeaponPrice[W_C4] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_C4] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_C4", (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_C4] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_C4], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_C4] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_C4],
  4072. id, "EXIT"
  4073. )
  4074.  
  4075. #else // FEATURE_C4
  4076.  
  4077. formatex(szMenu, charsmax(szMenu),
  4078. "\y%L: %L^n^n\d1. \%sM249 \w(\%s%d %L\w)\R\%s$%d^n\d3. \%sSG550 \w(\%s%d %L\w)\R\%s$%d^n\d3. \%sG3SG1 \w(\%s%d %L\w)\R\%s$%d^n\d4. \%sScout \w(\%s%d %L\w)\R\%s$%d^n\d5. \%sAWP \w(\%s%d %L\w)\R\%s$%d^n\d6. \%s%L \w(\%s%d %L\w)\R\%s$%d^n^n\d0. \w%L",
  4079. id, "BUYMENU_TITLE", id, "BUYMENU_SPECIAL",
  4080. (iMoney >= g_iWeaponPrice[W_M249] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_M249] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_M249], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_M249],
  4081. (iMoney >= g_iWeaponPrice[W_SG550] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SG550] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_SG550], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SG550],
  4082. (iMoney >= g_iWeaponPrice[W_G3SG1] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_G3SG1] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_G3SG1], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_G3SG1],
  4083. (iMoney >= g_iWeaponPrice[W_SCOUT] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SCOUT] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_SCOUT], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SCOUT],
  4084. (iMoney >= g_iWeaponPrice[W_AWP] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_AWP] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_AWP], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_AWP],
  4085. (iMoney >= g_iWeaponPrice[W_SHIELD] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_SHIELD", (g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_SHIELD] ? BUY_ITEM_AVAILABLE2 : BUY_ITEM_DISABLED), g_iWeaponAdrenaline[W_SHIELD], id, "ADRENALINE", (iMoney >= g_iWeaponPrice[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SHIELD],
  4086. id, "EXIT"
  4087. )
  4088.  
  4089. #endif // FEATURE_C4
  4090.  
  4091. #else // FEATURE_ADRENALINE
  4092.  
  4093. #if FEATURE_C4 == true
  4094.  
  4095. formatex(szMenu, charsmax(szMenu),
  4096. "\y%L: %L^n^n\d1. \%sM249\R\%s$%d^n\d3. \%sSG550\R\%s$%d^n\d3. \%sG3SG1\R\%s$%d^n\d4. \%sScout\R\%s$%d^n\d5. \%sAWP\R\%s$%d^n\d6. \%s%L\R\%s$%d^n\d7. \%s%L\R\%s$%d^n^n\d0. \w%L",
  4097. id, "BUYMENU_TITLE", id, "BUYMENU_SPECIAL",
  4098. (iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED),(iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_M249],
  4099. (iMoney >= g_iWeaponPrice[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SG550],
  4100. (iMoney >= g_iWeaponPrice[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_G3SG1],
  4101. (iMoney >= g_iWeaponPrice[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SCOUT],
  4102. (iMoney >= g_iWeaponPrice[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_AWP],
  4103. (iMoney >= g_iWeaponPrice[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_SHIELD", (iMoney >= g_iWeaponPrice[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SHIELD],
  4104. (iMoney >= g_iWeaponPrice[W_C4] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_C4", (iMoney >= g_iWeaponPrice[W_C4] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_C4],
  4105. id, "EXIT"
  4106. )
  4107.  
  4108. #else // FEATURE_C4
  4109.  
  4110. formatex(szMenu, charsmax(szMenu),
  4111. "\y%L: %L^n^n\d1. \%sM249\R\%s$%d^n\d3. \%sSG550\R\%s$%d^n\d3. \%sG3SG1\R\%s$%d^n\d4. \%sScout\R\%s$%d^n\d5. \%sAWP\R\%s$%d^n\d6. \%s%L\R\%s$%d^n^n\d0. \w%L",
  4112. id, "BUYMENU_TITLE", id, "BUYMENU_SPECIAL",
  4113. (iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED),(iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_M249],
  4114. (iMoney >= g_iWeaponPrice[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_SG550] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SG550],
  4115. (iMoney >= g_iWeaponPrice[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_G3SG1] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_G3SG1],
  4116. (iMoney >= g_iWeaponPrice[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_SCOUT] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SCOUT],
  4117. (iMoney >= g_iWeaponPrice[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), (iMoney >= g_iWeaponPrice[W_AWP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_AWP],
  4118. (iMoney >= g_iWeaponPrice[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_SHIELD", (iMoney >= g_iWeaponPrice[W_SHIELD] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), g_iWeaponPrice[W_SHIELD],
  4119. id, "EXIT"
  4120. )
  4121.  
  4122. #endif // FEATURE_C4
  4123.  
  4124.  
  4125. #endif // FEATURE_ADRENALINE
  4126.  
  4127. }
  4128.  
  4129. case 8:
  4130. {
  4131. formatex(szMenu, charsmax(szMenu),
  4132. "\y%L: %L^n^n\d1. \%s%L\R$%d^n\d2. \%s%L\R$%d^n^n\d3. \%s%L\R$%d^n\d4. \%s%L\R$%d^n\d5. \%s%L\R$%d^n^n\d7. \%s%L\R$%d^n^n\d0. \w%L",
  4133. id, "BUYMENU_TITLE", id, "BUYMENU_EQUIPAMENT",
  4134. (iMoney >= g_iWeaponPrice[W_VEST] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_VEST", g_iWeaponPrice[W_VEST],
  4135. (iMoney >= g_iWeaponPrice[W_VESTHELM] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_VESTHELM", g_iWeaponPrice[W_VESTHELM],
  4136. (iMoney >= g_iWeaponPrice[W_FLASHBANG] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_FLASHBANG", g_iWeaponPrice[W_FLASHBANG],
  4137. (iMoney >= g_iWeaponPrice[W_HEGRENADE] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_HE", g_iWeaponPrice[W_HEGRENADE],
  4138. (iMoney >= g_iWeaponPrice[W_SMOKEGRENADE] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_SMOKE", g_iWeaponPrice[W_SMOKEGRENADE],
  4139. (iMoney >= g_iWeaponPrice[W_NVG] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_ITEM_NVG", g_iWeaponPrice[W_NVG],
  4140. id, "EXIT"
  4141. )
  4142. }
  4143.  
  4144. default:
  4145. {
  4146.  
  4147. #if FEATURE_ADRENALINE == true
  4148.  
  4149. formatex(szMenu, charsmax(szMenu),
  4150. "\y%L^n^n\d1. \%s%L^n\d2. \%s%L^n\d3. \%s%L^n\d4. \%s%L^n\d5. \%s%L^n^n\d6. \w%L\R$0^n^n\d8. \%s%L^n^n\d0. \w%L",
  4151. id, "BUYMENU_TITLE",
  4152. (iMoney >= g_iWeaponPrice[W_GLOCK18] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_PISTOLS",
  4153. (iMoney >= g_iWeaponPrice[W_M3] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_SHOTGUNS",
  4154. (iMoney >= g_iWeaponPrice[W_TMP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_SMGS",
  4155. (iMoney >= g_iWeaponPrice[W_GALIL] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_RIFLES",
  4156. (iMoney >= g_iWeaponPrice[W_M249] && g_iAdrenaline[id] >= g_iWeaponAdrenaline[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_SPECIAL",
  4157. id, "BUYMENU_AMMO",
  4158. (iMoney >= g_iWeaponPrice[W_FLASHBANG] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_EQUIPAMENT",
  4159. id, "EXIT"
  4160. )
  4161.  
  4162. #else // FEATURE_ADRENALINE
  4163.  
  4164. formatex(szMenu, charsmax(szMenu),
  4165. "\y%L^n^n\d1. \%s%L^n\d2. \%s%L^n\d3. \%s%L^n\d4. \%s%L^n\d5. \%s%L^n^n\d6. \w%L\R$0^n^n\d8. \%s%L^n^n\d0. \w%L",
  4166. id, "BUYMENU_TITLE",
  4167. (iMoney >= g_iWeaponPrice[W_GLOCK18] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_PISTOLS",
  4168. (iMoney >= g_iWeaponPrice[W_M3] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_SHOTGUNS",
  4169. (iMoney >= g_iWeaponPrice[W_TMP] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_SMGS",
  4170. (iMoney >= g_iWeaponPrice[W_GALIL] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_RIFLES",
  4171. (iMoney >= g_iWeaponPrice[W_M249] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_SPECIAL",
  4172. id, "BUYMENU_AMMO",
  4173. (iMoney >= g_iWeaponPrice[W_FLASHBANG] ? BUY_ITEM_AVAILABLE : BUY_ITEM_DISABLED), id, "BUYMENU_EQUIPAMENT",
  4174. id, "EXIT"
  4175. )
  4176.  
  4177. #endif // FEATURE_ADRENALINE
  4178.  
  4179. }
  4180. }
  4181.  
  4182. g_iMenu[id] = iMenu
  4183.  
  4184. show_menu(id, MENU_KEYS_BUY, szMenu, -1, MENU_BUY)
  4185.  
  4186. return PLUGIN_HANDLED
  4187. }
  4188.  
  4189. public player_key_buy(id, iKey)
  4190. {
  4191. iKey += 1
  4192.  
  4193. if(!g_bAlive[id] || iKey == 10)
  4194. return PLUGIN_HANDLED
  4195.  
  4196. if(!g_bBuyZone[id])
  4197. {
  4198. client_print(id, print_center, "%L", id, "BUY_NOTINZONE")
  4199. return PLUGIN_HANDLED
  4200. }
  4201.  
  4202. switch(g_iMenu[id])
  4203. {
  4204. case 1:
  4205. {
  4206. switch(iKey)
  4207. {
  4208. case 1: player_buyWeapon(id, W_GLOCK18)
  4209. case 2: player_buyWeapon(id, W_USP)
  4210. case 3: player_buyWeapon(id, W_P228)
  4211. case 4: player_buyWeapon(id, W_DEAGLE)
  4212. case 5: player_buyWeapon(id, W_FIVESEVEN)
  4213. case 6: player_buyWeapon(id, W_ELITE)
  4214. }
  4215. }
  4216.  
  4217. case 2:
  4218. {
  4219. switch(iKey)
  4220. {
  4221. case 1: player_buyWeapon(id, W_M3)
  4222. case 2: player_buyWeapon(id, W_XM1014)
  4223. }
  4224. }
  4225.  
  4226. case 3:
  4227. {
  4228. switch(iKey)
  4229. {
  4230. case 1: player_buyWeapon(id, W_TMP)
  4231. case 2: player_buyWeapon(id, W_MAC10)
  4232. case 3: player_buyWeapon(id, W_MP5NAVY)
  4233. case 4: player_buyWeapon(id, W_UMP45)
  4234. case 5: player_buyWeapon(id, W_P90)
  4235. }
  4236. }
  4237.  
  4238. case 4:
  4239. {
  4240. switch(iKey)
  4241. {
  4242. case 1: player_buyWeapon(id, W_GALIL)
  4243. case 2: player_buyWeapon(id, W_FAMAS)
  4244. case 3: player_buyWeapon(id, W_AK47)
  4245. case 4: player_buyWeapon(id, W_M4A1)
  4246. case 5: player_buyWeapon(id, W_AUG)
  4247. case 6: player_buyWeapon(id, W_SG552)
  4248. }
  4249. }
  4250.  
  4251. case 5:
  4252. {
  4253. switch(iKey)
  4254. {
  4255. case 1: player_buyWeapon(id, W_M249)
  4256. case 2: player_buyWeapon(id, W_SG550)
  4257. case 3: player_buyWeapon(id, W_G3SG1)
  4258. case 4: player_buyWeapon(id, W_SCOUT)
  4259. case 5: player_buyWeapon(id, W_AWP)
  4260. case 6: player_buyWeapon(id, W_SHIELD)
  4261. case 7: player_buyWeapon(id, W_C4)
  4262. }
  4263. }
  4264.  
  4265. case 8:
  4266. {
  4267. switch(iKey)
  4268. {
  4269. case 1: player_buyWeapon(id, W_VEST)
  4270. case 2: player_buyWeapon(id, W_VESTHELM)
  4271. case 3: player_buyWeapon(id, W_FLASHBANG)
  4272. case 4: player_buyWeapon(id, W_HEGRENADE)
  4273. case 5: player_buyWeapon(id, W_SMOKEGRENADE)
  4274. case 7: player_buyWeapon(id, W_NVG)
  4275. }
  4276. }
  4277.  
  4278. default:
  4279. {
  4280. switch(iKey)
  4281. {
  4282. case 1,2,3,4,5,8: player_menu_buy(id, iKey)
  4283. case 6,7: player_fillAmmo(id)
  4284. }
  4285. }
  4286. }
  4287.  
  4288. return PLUGIN_HANDLED
  4289. }
  4290.  
  4291. public player_cmd_buyWeapon(id)
  4292. {
  4293. if(!g_bBuyZone[id])
  4294. {
  4295. client_print(id, print_center, "%L", id, "BUY_NOTINZONE")
  4296. return PLUGIN_HANDLED
  4297. }
  4298.  
  4299. new szCmd[12]
  4300.  
  4301. read_argv(0, szCmd, charsmax(szCmd))
  4302.  
  4303. for(new w = W_P228; w <= W_NVG; w++)
  4304. {
  4305. for(new i = 0; i < 2; i++)
  4306. {
  4307. if(equali(g_szWeaponCommands[w][i], szCmd))
  4308. {
  4309. player_buyWeapon(id, w)
  4310. return PLUGIN_HANDLED
  4311. }
  4312. }
  4313. }
  4314.  
  4315. return PLUGIN_HANDLED
  4316. }
  4317.  
  4318. public player_buyWeapon(id, iWeapon)
  4319. {
  4320. if(!g_bAlive[id])
  4321. return
  4322.  
  4323. new CsArmorType:ArmorType
  4324. new iArmor = cs_get_user_armor(id, ArmorType)
  4325.  
  4326. new iMoney = cs_get_user_money(id)
  4327.  
  4328. /* apply discount if you already have a kevlar and buying a kevlar+helmet */
  4329. new iCost = g_iWeaponPrice[iWeapon] - (ArmorType == CS_ARMOR_KEVLAR && iWeapon == W_VESTHELM ? 650 : 0)
  4330.  
  4331. #if FEATURE_ADRENALINE == true
  4332.  
  4333. new iCostAdrenaline = g_iWeaponAdrenaline[iWeapon]
  4334.  
  4335. #endif // FEATURE_ADRENALINE
  4336.  
  4337. if(iCost > iMoney)
  4338. {
  4339. client_print(id, print_center, "%L", id, "BUY_NEEDMONEY", iCost)
  4340. return
  4341. }
  4342.  
  4343. #if FEATURE_ADRENALINE == true
  4344.  
  4345. else if(!(iCostAdrenaline <= g_iAdrenaline[id]))
  4346. {
  4347. client_print(id, print_center, "%L", id, "BUY_NEEDADRENALINE", iCostAdrenaline)
  4348. return
  4349. }
  4350.  
  4351. #endif // FEATURE_ADRENALINE
  4352.  
  4353. switch(iWeapon)
  4354. {
  4355.  
  4356. #if FEATURE_C4 == true
  4357.  
  4358. case W_C4:
  4359. {
  4360. if(user_has_weapon(id, W_C4))
  4361. {
  4362. client_print(id, print_center, "%L", id, "BUY_HAVE_C4")
  4363. return
  4364. }
  4365.  
  4366. player_giveC4(id)
  4367. }
  4368.  
  4369. #endif // FEATURE_C4
  4370.  
  4371. case W_NVG:
  4372. {
  4373. if(cs_get_user_nvg(id))
  4374. {
  4375. client_print(id, print_center, "%L", id, "BUY_HAVE_NVG")
  4376. return
  4377. }
  4378.  
  4379. cs_set_user_nvg(id, 1)
  4380. }
  4381.  
  4382. case W_VEST:
  4383. {
  4384. if(iArmor >= 100)
  4385. {
  4386. client_print(id, print_center, "%L", id, "BUY_HAVE_KEVLAR")
  4387. return
  4388. }
  4389. }
  4390.  
  4391. case W_VESTHELM:
  4392. {
  4393. if(iArmor >= 100 && ArmorType == CS_ARMOR_VESTHELM)
  4394. {
  4395. client_print(id, print_center, "%L", id, "BUY_HAVE_KEVLARHELM")
  4396. return
  4397. }
  4398. }
  4399.  
  4400. case W_FLASHBANG:
  4401. {
  4402. new iGrenades = cs_get_user_bpammo(id, W_FLASHBANG)
  4403.  
  4404. if(iGrenades >= 2)
  4405. {
  4406. client_print(id, print_center, "%L", id, "BUY_NOMORE_FLASH")
  4407. return
  4408. }
  4409.  
  4410. new iCvar = get_pcvar_num(pCvar_ctf_nospam_flash)
  4411. new Float:fGameTime = get_gametime()
  4412.  
  4413. if(g_fLastBuy[id][iGrenades] > fGameTime)
  4414. {
  4415. client_print(id, print_center, "%L", id, "BUY_DELAY_FLASH", iCvar)
  4416. return
  4417. }
  4418.  
  4419. g_fLastBuy[id][iGrenades] = fGameTime + iCvar
  4420.  
  4421. if(iGrenades == 1)
  4422. g_fLastBuy[id][0] = g_fLastBuy[id][iGrenades]
  4423. }
  4424.  
  4425. case W_HEGRENADE:
  4426. {
  4427. if(cs_get_user_bpammo(id, W_HEGRENADE) >= 1)
  4428. {
  4429. client_print(id, print_center, "%L", id, "BUY_NOMORE_HE")
  4430. return
  4431. }
  4432.  
  4433. new iCvar = get_pcvar_num(pCvar_ctf_nospam_he)
  4434. new Float:fGameTime = get_gametime()
  4435.  
  4436. if(g_fLastBuy[id][2] > fGameTime)
  4437. {
  4438. client_print(id, print_center, "%L", id, "BUY_DELAY_HE", iCvar)
  4439. return
  4440. }
  4441.  
  4442. g_fLastBuy[id][2] = fGameTime + iCvar
  4443. }
  4444.  
  4445. case W_SMOKEGRENADE:
  4446. {
  4447. if(cs_get_user_bpammo(id, W_SMOKEGRENADE) >= 1)
  4448. {
  4449. client_print(id, print_center, "%L", id, "BUY_NOMORE_SMOKE")
  4450. return
  4451. }
  4452.  
  4453. new iCvar = get_pcvar_num(pCvar_ctf_nospam_smoke)
  4454. new Float:fGameTime = get_gametime()
  4455.  
  4456. if(g_fLastBuy[id][3] > fGameTime)
  4457. {
  4458. client_print(id, print_center, "%L", id, "BUY_DELAY_SMOKE", iCvar)
  4459. return
  4460. }
  4461.  
  4462. g_fLastBuy[id][3] = fGameTime + iCvar
  4463. }
  4464. }
  4465.  
  4466. if(1 <= g_iWeaponSlot[iWeapon] <= 2)
  4467. {
  4468. new iWeapons
  4469. new iWeaponList[32]
  4470.  
  4471. get_user_weapons(id, iWeaponList, iWeapons)
  4472.  
  4473. if(cs_get_user_shield(id))
  4474. iWeaponList[iWeapons++] = W_SHIELD
  4475.  
  4476. for(new w, i = 0; i < iWeapons; i++)
  4477. {
  4478. w = iWeaponList[i]
  4479.  
  4480. if(1 <= g_iWeaponSlot[w] <= 2)
  4481. {
  4482. if(w == iWeapon)
  4483. {
  4484. client_print(id, print_center, "%L", id, "BUY_HAVE_WEAPON")
  4485. return
  4486. }
  4487.  
  4488. if(iWeapon == W_SHIELD && w == W_ELITE)
  4489. engclient_cmd(id, "drop", g_szWeaponEntity[W_ELITE]) // drop the dual elites too if buying a shield
  4490.  
  4491. if(iWeapon == W_ELITE && w == W_SHIELD)
  4492. engclient_cmd(id, "drop", g_szWeaponEntity[W_SHIELD]) // drop the too shield if buying dual elites
  4493.  
  4494. if(g_iWeaponSlot[w] == g_iWeaponSlot[iWeapon])
  4495. {
  4496. if(g_iWeaponSlot[w] == 2 && iWeaponList[iWeapons-1] == W_SHIELD)
  4497. {
  4498. engclient_cmd(id, "drop", g_szWeaponEntity[W_SHIELD]) // drop the shield
  4499.  
  4500. new ent = find_ent_by_owner(g_iMaxPlayers, g_szWeaponEntity[W_SHIELD], id)
  4501.  
  4502. if(ent)
  4503. {
  4504. entity_set_int(ent, EV_INT_flags, FL_KILLME) // kill the shield
  4505. call_think(ent)
  4506. }
  4507.  
  4508. engclient_cmd(id, "drop", g_szWeaponEntity[w]) // drop the secondary
  4509.  
  4510. give_item(id, g_szWeaponEntity[W_SHIELD]) // give back the shield
  4511. }
  4512. else
  4513. engclient_cmd(id, "drop", g_szWeaponEntity[w]) // drop weapon if it's of the same slot
  4514. }
  4515. }
  4516. }
  4517. }
  4518.  
  4519. if(iWeapon != W_NVG && iWeapon != W_C4)
  4520. give_item(id, g_szWeaponEntity[iWeapon])
  4521.  
  4522. player_addRebuy(id, iWeapon)
  4523.  
  4524. if(g_iWeaponPrice[iWeapon])
  4525. cs_set_user_money(id, iMoney - iCost, 1)
  4526.  
  4527. #if FEATURE_ADRENALINE == true
  4528.  
  4529. if(iCostAdrenaline)
  4530. {
  4531. g_iAdrenaline[id] -= iCostAdrenaline
  4532. player_hudAdrenaline(id)
  4533. }
  4534.  
  4535. #endif // FEATURE_ADRENALINE
  4536.  
  4537. if(g_iBPAmmo[iWeapon])
  4538. cs_set_user_bpammo(id, iWeapon, g_iBPAmmo[iWeapon])
  4539. }
  4540.  
  4541. public player_fillAmmo(id)
  4542. {
  4543. if(!g_bAlive[id])
  4544. return PLUGIN_HANDLED
  4545.  
  4546. if(!g_bBuyZone[id])
  4547. {
  4548. client_print(id, print_center, "%L", id, "BUY_NOTINZONE")
  4549. return PLUGIN_HANDLED
  4550. }
  4551.  
  4552. if(player_getAmmo(id))
  4553. {
  4554. emit_sound(id, CHAN_ITEM, SND_GETAMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  4555. client_print(id, print_center, "%L", id, "BUY_FULLAMMO")
  4556. }
  4557.  
  4558. return PLUGIN_HANDLED
  4559. }
  4560.  
  4561. #endif // FEATURE_BUY
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573. #if FEATURE_C4 == true
  4574.  
  4575. public c4_used(msgid, dest, id)
  4576. {
  4577. if(g_iTeam[id])
  4578. player_updateSpeed(id)
  4579.  
  4580. if(get_msg_arg_int(1) == 0)
  4581. g_bDefuse[id] = false
  4582.  
  4583. return PLUGIN_HANDLED
  4584. }
  4585.  
  4586. public c4_planted()
  4587. {
  4588. new szLogUser[80], szName[32]
  4589.  
  4590. read_logargv(0, szLogUser, charsmax(szLogUser))
  4591. parse_loguser(szLogUser, szName, charsmax(szName))
  4592.  
  4593. new id = get_user_index(szName)
  4594. new ent = g_iMaxPlayers
  4595. new Float:fAngles[3]
  4596. new szFormat[40]
  4597.  
  4598. entity_get_vector(id, EV_VEC_angles, fAngles)
  4599.  
  4600. fAngles[pitch] = 0.0
  4601. fAngles[yaw] += 90.0
  4602. fAngles[roll] = 0.0
  4603.  
  4604. new iC4Timer = get_pcvar_num(pCvar_mp_c4timer)
  4605.  
  4606. client_print(id, print_center, "%L", id, "C4_ARMED", iC4Timer)
  4607.  
  4608. formatex(szFormat, charsmax(szFormat), "%L", LANG_PLAYER, "C4_ARMED_RADIO", iC4Timer)
  4609.  
  4610. for(new i = 1; i <= g_iMaxPlayers; i++)
  4611. {
  4612. if(g_iTeam[i] == g_iTeam[id] && !g_bBot[id])
  4613. {
  4614. /* fully fake hookable radio message and event */
  4615.  
  4616. emessage_begin(MSG_ONE, gMsg_TextMsg, _, i)
  4617. ewrite_byte(3)
  4618. ewrite_string("#Game_radio")
  4619. ewrite_string(szName)
  4620. ewrite_string(szFormat)
  4621. emessage_end()
  4622.  
  4623. emessage_begin(MSG_ONE, gMsg_SendAudio, _, i)
  4624. ewrite_byte(id)
  4625. ewrite_string("%!MRAD_BLOW")
  4626. ewrite_short(100)
  4627. emessage_end()
  4628. }
  4629. }
  4630.  
  4631. while((ent = find_ent_by_owner(ent, GRENADE, id)))
  4632. {
  4633. if(get_pdata_int(ent, 96) & (1<<8))
  4634. {
  4635. entity_set_int(ent, EV_INT_solid, SOLID_NOT)
  4636. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  4637. entity_set_float(ent, EV_FL_gravity, 1.0)
  4638. entity_set_vector(ent, EV_VEC_angles, fAngles)
  4639.  
  4640. return
  4641. }
  4642. }
  4643. }
  4644.  
  4645. public c4_defuse(ent, id, activator, iType, Float:fValue)
  4646. {
  4647. if(g_bAlive[id] && get_pdata_int(ent, 96) & (1<<8))
  4648. {
  4649. new iOwner = entity_get_edict(ent, EV_ENT_owner)
  4650.  
  4651. if(id != iOwner && 1 <= iOwner <= g_iMaxPlayers && g_iTeam[id] == g_iTeam[iOwner])
  4652. {
  4653. client_print(id, print_center, "%L", id, "C4_NODEFUSE")
  4654. client_cmd(id, "-use")
  4655.  
  4656. return HAM_SUPERCEDE
  4657. }
  4658.  
  4659. if(g_iTeam[id] == TEAM_RED)
  4660. {
  4661. set_pdata_int(id, 114, TEAM_BLUE, 5)
  4662.  
  4663. ExecuteHam(Ham_Use, ent, id, activator, iType, fValue)
  4664.  
  4665. set_pdata_int(id, 114, TEAM_RED, 5)
  4666. }
  4667.  
  4668. if(!g_bDefuse[id])
  4669. {
  4670. client_print(id, print_center, "%L", id, "C4_DEFUSING", C4_DEFUSETIME)
  4671.  
  4672. message_begin(MSG_ONE_UNRELIABLE, gMsg_BarTime, _, id)
  4673. write_short(C4_DEFUSETIME)
  4674. message_end()
  4675.  
  4676. set_pdata_float(ent, 99, get_gametime() + C4_DEFUSETIME, 5)
  4677.  
  4678. g_bDefuse[id] = true
  4679. }
  4680. }
  4681.  
  4682. return HAM_IGNORED
  4683. }
  4684.  
  4685. public c4_defused()
  4686. {
  4687. new szLogUser[80], szName[32]
  4688.  
  4689. read_logargv(0, szLogUser, charsmax(szLogUser))
  4690. parse_loguser(szLogUser, szName, charsmax(szName))
  4691.  
  4692. new id = get_user_index(szName)
  4693.  
  4694. if(!g_bAlive[id])
  4695. return
  4696.  
  4697. g_bDefuse[id] = false
  4698.  
  4699. player_giveC4(id)
  4700. client_print(id, print_center, "%L", id, "C4_DEFUSED")
  4701. }
  4702.  
  4703. public c4_pickup(ent, id)
  4704. {
  4705. if(g_bAlive[id] && is_valid_ent(ent) && (entity_get_int(ent, EV_INT_flags) & FL_ONGROUND))
  4706. {
  4707. static szModel[32]
  4708.  
  4709. entity_get_string(ent, EV_SZ_model, szModel, charsmax(szModel))
  4710.  
  4711. if(equal(szModel, "models/w_backpack.mdl"))
  4712. {
  4713. if(user_has_weapon(id, W_C4))
  4714. return PLUGIN_HANDLED
  4715.  
  4716. player_giveC4(id)
  4717.  
  4718. weapon_remove(ent)
  4719.  
  4720. return PLUGIN_HANDLED
  4721. }
  4722. }
  4723.  
  4724. return PLUGIN_CONTINUE
  4725. }
  4726.  
  4727. #endif // FEATURE_C4 == true
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740. public weapon_spawn(ent)
  4741. {
  4742. if(!is_valid_ent(ent))
  4743. return
  4744.  
  4745. new Float:fWeaponStay = get_pcvar_float(pCvar_ctf_weaponstay)
  4746.  
  4747. if(fWeaponStay > 0)
  4748. {
  4749. task_remove(ent)
  4750. task_set(fWeaponStay, "weapon_startFade", ent)
  4751. }
  4752. }
  4753.  
  4754. public weapon_startFade(ent)
  4755. {
  4756. if(!is_valid_ent(ent))
  4757. return
  4758.  
  4759. new szClass[32]
  4760.  
  4761. entity_get_string(ent, EV_SZ_classname, szClass, charsmax(szClass))
  4762.  
  4763. if(!equal(szClass, WEAPONBOX) && !equal(szClass, ITEM_CLASSNAME))
  4764. return
  4765.  
  4766. entity_set_int(ent, EV_INT_movetype, MOVETYPE_FLY)
  4767. entity_set_int(ent, EV_INT_rendermode, kRenderTransAlpha)
  4768.  
  4769. if(get_pcvar_num(pCvar_ctf_glows))
  4770. entity_set_int(ent, EV_INT_renderfx, kRenderFxGlowShell)
  4771.  
  4772. entity_set_float(ent, EV_FL_renderamt, 255.0)
  4773. entity_set_vector(ent, EV_VEC_rendercolor, Float:{255.0, 255.0, 0.0})
  4774. entity_set_vector(ent, EV_VEC_velocity, Float:{0.0, 0.0, 20.0})
  4775.  
  4776. weapon_fadeOut(ent, 255.0)
  4777. }
  4778.  
  4779. public weapon_fadeOut(ent, Float:fStart)
  4780. {
  4781. if(!is_valid_ent(ent))
  4782. {
  4783. task_remove(ent)
  4784. return
  4785. }
  4786.  
  4787. static Float:fFadeAmount[4096]
  4788.  
  4789. if(fStart)
  4790. {
  4791. task_remove(ent)
  4792. fFadeAmount[ent] = fStart
  4793. }
  4794.  
  4795. fFadeAmount[ent] -= 25.5
  4796.  
  4797. if(fFadeAmount[ent] > 0.0)
  4798. {
  4799. entity_set_float(ent, EV_FL_renderamt, fFadeAmount[ent])
  4800.  
  4801. task_set(0.1, "weapon_fadeOut", ent)
  4802. }
  4803. else
  4804. {
  4805. new szClass[32]
  4806.  
  4807. entity_get_string(ent, EV_SZ_classname, szClass, charsmax(szClass))
  4808.  
  4809. if(equal(szClass, WEAPONBOX))
  4810. weapon_remove(ent)
  4811. else
  4812. entity_remove(ent)
  4813. }
  4814. }
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823. public item_touch(ent, id)
  4824. {
  4825. if(g_bAlive[id] && is_valid_ent(ent) && entity_get_int(ent, EV_INT_flags) & FL_ONGROUND)
  4826. {
  4827. new iType = entity_get_int(ent, EV_INT_iuser2)
  4828.  
  4829. switch(iType)
  4830. {
  4831. case ITEM_AMMO:
  4832. {
  4833. if(!player_getAmmo(id))
  4834. return PLUGIN_HANDLED
  4835.  
  4836. client_print(id, print_center, "%L", id, "PICKED_AMMO")
  4837.  
  4838. emit_sound(id, CHAN_ITEM, SND_GETAMMO, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  4839. }
  4840.  
  4841. case ITEM_MEDKIT:
  4842. {
  4843. new iHealth = get_user_health(id)
  4844.  
  4845. if(iHealth >= g_iMaxHealth[id])
  4846. return PLUGIN_HANDLED
  4847.  
  4848. set_user_health(id, clamp(iHealth + ITEM_MEDKIT_GIVE, 0, 100))
  4849.  
  4850. client_print(id, print_center, "%L", id, "PICKED_HEALTH", ITEM_MEDKIT_GIVE)
  4851.  
  4852. emit_sound(id, CHAN_ITEM, SND_GETMEDKIT, VOL_NORM, ATTN_NORM, 0, 110)
  4853. }
  4854.  
  4855. #if FEATURE_ADRENALINE == true
  4856.  
  4857. case ITEM_ADRENALINE:
  4858. {
  4859. if(g_iAdrenaline[id] >= 100)
  4860. return PLUGIN_HANDLED
  4861.  
  4862. g_iAdrenaline[id] = clamp(g_iAdrenaline[id] + ITEM_ADRENALINE_GIVE, 0, 100)
  4863.  
  4864. player_hudAdrenaline(id)
  4865.  
  4866. client_print(id, print_center, "%L", id, "PICKED_ADRENALINE", ITEM_ADRENALINE_GIVE)
  4867.  
  4868. emit_sound(id, CHAN_ITEM, SND_GETADRENALINE, VOL_NORM, ATTN_NORM, 0, 140)
  4869. }
  4870.  
  4871. #endif // FEATURE_ADRENALINE == true
  4872. }
  4873.  
  4874. task_remove(ent)
  4875. entity_remove(ent)
  4876. }
  4877.  
  4878. return PLUGIN_CONTINUE
  4879. }
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.  
  4895.  
  4896.  
  4897. public event_restartGame()
  4898. g_bRestarting = true
  4899.  
  4900. public event_roundStart()
  4901. {
  4902. new ent = -1
  4903.  
  4904. while((ent = find_ent_by_class(ent, WEAPONBOX)) > 0)
  4905. {
  4906. task_remove(ent)
  4907. weapon_remove(ent)
  4908. }
  4909.  
  4910. ent = -1
  4911.  
  4912. while((ent = find_ent_by_class(ent, ITEM_CLASSNAME)) > 0)
  4913. {
  4914. task_remove(ent)
  4915. entity_remove(ent)
  4916. }
  4917.  
  4918. for(new id = 1; id < g_iMaxPlayers; id++)
  4919. {
  4920. if(!g_bAlive[id])
  4921. continue
  4922.  
  4923. g_bDefuse[id] = false
  4924. g_bFreeLook[id] = false
  4925. g_fLastBuy[id] = Float:{0.0, 0.0, 0.0, 0.0}
  4926.  
  4927. task_remove(id - TASK_EQUIPAMENT)
  4928. task_remove(id - TASK_TEAMBALANCE)
  4929. task_remove(id - TASK_DEFUSE)
  4930.  
  4931. if(g_bRestarting)
  4932. {
  4933. task_remove(id)
  4934. task_remove(id - TASK_ADRENALINE)
  4935.  
  4936. g_bRestarted[id] = true
  4937. g_iAdrenaline[id] = 0
  4938. g_iAdrenalineUse[id] = 0
  4939. }
  4940.  
  4941. player_updateSpeed(id)
  4942. }
  4943.  
  4944. for(new iFlagTeam = TEAM_RED; iFlagTeam <= TEAM_BLUE; iFlagTeam++)
  4945. {
  4946. flag_sendHome(iFlagTeam)
  4947.  
  4948. task_remove(g_iFlagEntity[iFlagTeam])
  4949.  
  4950. log_message("%s, %s flag returned back to base.", (g_bRestarting ? "Game restarted" : "New round started"), g_szTeamName[iFlagTeam])
  4951. }
  4952.  
  4953. if(g_bRestarting)
  4954. {
  4955. g_iScore = {0,0,0}
  4956. g_bRestarting = false
  4957. }
  4958. }
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976. public msg_block()
  4977. return PLUGIN_HANDLED
  4978.  
  4979. #if FEATURE_C4 == true
  4980.  
  4981. public msg_sendAudio()
  4982. {
  4983. new szAudio[14]
  4984.  
  4985. get_msg_arg_string(2, szAudio, charsmax(szAudio))
  4986.  
  4987. return equal(szAudio, "%!MRAD_BOMB", 11) ? PLUGIN_HANDLED : PLUGIN_CONTINUE
  4988. }
  4989.  
  4990. #endif // FEATURE_C4 == true
  4991.  
  4992. public msg_screenFade(msgid, dest, id)
  4993. return (g_bProtected[id] && g_bAlive[id] && get_msg_arg_int(4) == 255 && get_msg_arg_int(5) == 255 && get_msg_arg_int(6) == 255 && get_msg_arg_int(7) > 199 ? PLUGIN_HANDLED : PLUGIN_CONTINUE)
  4994.  
  4995. public msg_scoreAttrib()
  4996. return (get_msg_arg_int(2) & (1<<1) ? PLUGIN_HANDLED : PLUGIN_CONTINUE)
  4997.  
  4998. public msg_teamScore()
  4999. {
  5000. new szTeam[2]
  5001.  
  5002. get_msg_arg_string(1, szTeam, 1)
  5003.  
  5004. switch(szTeam[0])
  5005. {
  5006. case 'T': set_msg_arg_int(2, ARG_SHORT, g_iScore[TEAM_RED])
  5007. case 'C': set_msg_arg_int(2, ARG_SHORT, g_iScore[TEAM_BLUE])
  5008. }
  5009. }
  5010.  
  5011. public msg_roundTime()
  5012. set_msg_arg_int(1, ARG_SHORT, get_timeleft())
  5013.  
  5014. public msg_sayText(msgid, dest, id)
  5015. {
  5016. new szString[32]
  5017.  
  5018. get_msg_arg_string(2, szString, charsmax(szString))
  5019.  
  5020. new iTeam = (szString[14] == 'T' ? TEAM_RED : (szString[14] == 'C' ? TEAM_BLUE : TEAM_SPEC))
  5021. new bool:bDead = (szString[16] == 'D' || szString[17] == 'D')
  5022.  
  5023. if(TEAM_RED <= iTeam <= TEAM_BLUE && equali(szString, "#Cstrike_Chat_", 14))
  5024. {
  5025. formatex(szString, charsmax(szString), "^x01%s(%L)^x03 %%s1^x01 : %%s2", (bDead ? "*DEAD* " : NULL), id, g_szMLFlagTeam[iTeam])
  5026. set_msg_arg_string(2, szString)
  5027. }
  5028. }
  5029.  
  5030. public msg_textMsg(msgid, dest, id)
  5031. {
  5032. static szMsg[48]
  5033.  
  5034. get_msg_arg_string(2, szMsg, charsmax(szMsg))
  5035.  
  5036. if(equal(szMsg, "#Spec_Mode", 10) && !get_pcvar_num(pCvar_mp_fadetoblack) && (get_pcvar_num(pCvar_mp_forcecamera) || get_pcvar_num(pCvar_mp_forcechasecam)))
  5037. {
  5038. if(TEAM_RED <= g_iTeam[id] <= TEAM_BLUE && szMsg[10] == '3')
  5039. {
  5040. if(!g_bFreeLook[id])
  5041. {
  5042. player_screenFade(id, {0,0,0,255}, 0.25, 9999.0, FADE_IN, true)
  5043. g_bFreeLook[id] = true
  5044. }
  5045.  
  5046. formatex(szMsg, charsmax(szMsg), "%L", id, "DEATH_NOFREELOOK")
  5047.  
  5048. set_msg_arg_string(2, szMsg)
  5049. }
  5050. else if(g_bFreeLook[id])
  5051. {
  5052. player_screenFade(id, {0,0,0,255}, 0.25, 0.0, FADE_OUT, true)
  5053. g_bFreeLook[id] = false
  5054. }
  5055. }
  5056. else if(equal(szMsg, "#Terrorists_Win") || equal(szMsg, "#CTs_Win"))
  5057. {
  5058. static szString[32]
  5059.  
  5060. formatex(szString, charsmax(szString), "%L", LANG_PLAYER, "STARTING_NEWROUND")
  5061.  
  5062. set_msg_arg_string(2, szString)
  5063. }
  5064. else if(equal(szMsg, "#Only_1", 7))
  5065. {
  5066. formatex(szMsg, charsmax(szMsg), "%L", id, "DEATH_ONLY1CHANGE")
  5067.  
  5068. set_msg_arg_string(2, szMsg)
  5069. }
  5070.  
  5071. #if FEATURE_C4 == true
  5072.  
  5073. else if(equal(szMsg, "#Defusing", 9) || equal(szMsg, "#Got_bomb", 9) || equal(szMsg, "#Game_bomb", 10) || equal(szMsg, "#Bomb", 5) || equal(szMsg, "#Target", 7))
  5074. return PLUGIN_HANDLED
  5075.  
  5076. #endif // FEATURE_C4 == true
  5077.  
  5078. return PLUGIN_CONTINUE
  5079. }
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.  
  5090.  
  5091.  
  5092.  
  5093.  
  5094.  
  5095. player_award(id, iMoney, iFrags, iAdrenaline, szText[], any:...)
  5096. {
  5097. #if FEATURE_ADRENALINE == false
  5098.  
  5099. iAdrenaline = 0
  5100.  
  5101. #endif // FEATURE_ADRENALINE
  5102.  
  5103. if(!g_iTeam[id] || (!iMoney && !iFrags && !iAdrenaline))
  5104. return
  5105.  
  5106. new szMsg[48]
  5107. new szMoney[24]
  5108. new szFrags[48]
  5109. new szFormat[192]
  5110. new szAdrenaline[48]
  5111.  
  5112. if(iMoney != 0)
  5113. {
  5114. cs_set_user_money(id, clamp(cs_get_user_money(id) + iMoney, 0, 16000), 1)
  5115.  
  5116. formatex(szMoney, charsmax(szMoney), "%s%d$", iMoney > 0 ? "+" : NULL, iMoney)
  5117. }
  5118.  
  5119. if(iFrags != 0)
  5120. {
  5121. player_setScore(id, iFrags, 0)
  5122.  
  5123. formatex(szFrags, charsmax(szFrags), "%s%d %L", iFrags > 0 ? "+" : NULL, iFrags, id, (iFrags > 1 ? "FRAGS" : "FRAG"))
  5124. }
  5125.  
  5126. #if FEATURE_ADRENALINE == true
  5127.  
  5128. if(iAdrenaline != 0)
  5129. {
  5130. g_iAdrenaline[id] = clamp(g_iAdrenaline[id] + iAdrenaline, 0, 100)
  5131.  
  5132. player_hudAdrenaline(id)
  5133.  
  5134. formatex(szAdrenaline, charsmax(szAdrenaline), "%s%d %L", iAdrenaline > 0 ? "+" : NULL, iAdrenaline, id, "ADRENALINE")
  5135. }
  5136.  
  5137. #endif // FEATURE_ADRENALINE == true
  5138.  
  5139. vformat(szMsg, charsmax(szMsg), szText, 6)
  5140. formatex(szFormat, charsmax(szFormat), "%s%s%s%s%s %s", szMoney, (szMoney[0] && (szFrags[0] || szAdrenaline[0]) ? ", " : NULL), szFrags, (szFrags[0] && szAdrenaline[0] ? ", " : NULL), szAdrenaline, szMsg)
  5141.  
  5142. client_print(id, print_console, "%s%L: %s", CONSOLE_PREFIX, id, "REWARD", szFormat)
  5143. client_print(id, print_center, szFormat)
  5144. }
  5145.  
  5146. #if FEATURE_ADRENALINE == true
  5147.  
  5148. player_hudAdrenaline(id)
  5149. {
  5150. set_hudmessage(HUD_ADRENALINE)
  5151.  
  5152. if(g_iAdrenalineUse[id])
  5153. show_hudmessage(id, "%L", id, "HUD_ADRENALINECOMBO", id, g_szAdrenalineUseML[g_iAdrenalineUse[id]], g_iAdrenaline[id], 100)
  5154.  
  5155. else if(g_iAdrenaline[id] >= 100)
  5156. show_hudmessage(id, "%L", id, "HUD_ADRENALINEFULL")
  5157.  
  5158. else
  5159. show_hudmessage(id, "%L", id, "HUD_ADRENALINE", g_iAdrenaline[id], 100)
  5160. }
  5161.  
  5162. #endif // FEATURE_ADRENALINE == true
  5163.  
  5164. player_print(id, iSender, szMsg[], any:...)
  5165. {
  5166. if(g_bBot[id] || (id && !g_iTeam[id]))
  5167. return PLUGIN_HANDLED
  5168.  
  5169. new szFormat[192]
  5170.  
  5171. vformat(szFormat, charsmax(szFormat), szMsg, 4)
  5172. format(szFormat, charsmax(szFormat), "%s%s", CHAT_PREFIX, szFormat)
  5173.  
  5174. if(id)
  5175. message_begin(MSG_ONE, gMsg_SayText, _, id)
  5176. else
  5177. message_begin(MSG_ALL, gMsg_SayText)
  5178.  
  5179. write_byte(iSender)
  5180. write_string(szFormat)
  5181. message_end()
  5182.  
  5183. return PLUGIN_HANDLED
  5184. }
  5185.  
  5186. bool:player_getAmmo(id)
  5187. {
  5188. if(!g_bAlive[id])
  5189. return false
  5190.  
  5191. new iWeapons
  5192. new iWeaponList[32]
  5193. new bool:bGotAmmo = false
  5194.  
  5195. get_user_weapons(id, iWeaponList, iWeapons)
  5196.  
  5197. for(new iAmmo, iClip, ent, w, i = 0; i < iWeapons; i++)
  5198. {
  5199. w = iWeaponList[i]
  5200.  
  5201. if(g_iBPAmmo[w])
  5202. {
  5203. ent = find_ent_by_owner(g_iMaxPlayers, g_szWeaponEntity[w], id)
  5204.  
  5205. iAmmo = cs_get_user_bpammo(id, w)
  5206. iClip = (ent ? cs_get_weapon_ammo(ent) : 0)
  5207.  
  5208. if((iAmmo + iClip) < (g_iBPAmmo[w] + g_iClip[w]))
  5209. {
  5210. cs_set_user_bpammo(id, w, g_iBPAmmo[w] + (g_iClip[w] - iClip))
  5211. bGotAmmo = true
  5212. }
  5213. }
  5214. }
  5215.  
  5216. return bGotAmmo
  5217. }
  5218.  
  5219. player_setScore(id, iAddFrags, iAddDeaths)
  5220. {
  5221. new iFrags = get_user_frags(id)
  5222. new iDeaths = cs_get_user_deaths(id)
  5223.  
  5224. if(iAddFrags != 0)
  5225. {
  5226. iFrags += iAddFrags
  5227.  
  5228. set_user_frags(id, iFrags)
  5229. }
  5230.  
  5231. if(iAddDeaths != 0)
  5232. {
  5233. iDeaths += iAddDeaths
  5234.  
  5235. cs_set_user_deaths(id, iDeaths)
  5236. }
  5237.  
  5238. message_begin(MSG_BROADCAST, gMsg_ScoreInfo)
  5239. write_byte(id)
  5240. write_short(iFrags)
  5241. write_short(iDeaths)
  5242. write_short(0)
  5243. write_short(g_iTeam[id])
  5244. message_end()
  5245. }
  5246.  
  5247. player_spawnItem(id)
  5248. {
  5249. #if FEATURE_ADRENALINE == true
  5250. if(!ITEM_DROP_AMMO && !ITEM_DROP_MEDKIT && !ITEM_DROP_ADRENALINE)
  5251. return
  5252. #else
  5253. if(!ITEM_DROP_AMMO && !ITEM_DROP_MEDKIT)
  5254. return
  5255. #endif
  5256.  
  5257. if(random_num(1, 100) > get_pcvar_float(pCvar_ctf_itempercent))
  5258. return
  5259.  
  5260. new ent = entity_create(INFO_TARGET)
  5261.  
  5262. if(!ent)
  5263. return
  5264.  
  5265. new iType
  5266. new Float:fOrigin[3]
  5267. new Float:fAngles[3]
  5268. new Float:fVelocity[3]
  5269.  
  5270. entity_get_vector(id, EV_VEC_origin, fOrigin)
  5271.  
  5272. fVelocity[x] = random_float(-100.0, 100.0)
  5273. fVelocity[y] = random_float(-100.0, 100.0)
  5274. fVelocity[z] = 50.0
  5275.  
  5276. fAngles[yaw] = random_float(0.0, 360.0)
  5277.  
  5278. #if FEATURE_ADRENALINE == true
  5279. while((iType = random(3)))
  5280. #else
  5281. while((iType = random(2)))
  5282. #endif
  5283. {
  5284. switch(iType)
  5285. {
  5286. case ITEM_AMMO:
  5287. {
  5288. if(ITEM_DROP_AMMO)
  5289. {
  5290. entity_set_model(ent, ITEM_MODEL_AMMO)
  5291. break
  5292. }
  5293. }
  5294.  
  5295. case ITEM_MEDKIT:
  5296. {
  5297. if(ITEM_DROP_MEDKIT)
  5298. {
  5299. entity_set_model(ent, ITEM_MODEL_MEDKIT)
  5300. break
  5301. }
  5302. }
  5303.  
  5304. #if FEATURE_ADRENALINE == true
  5305. case ITEM_ADRENALINE:
  5306. {
  5307. if(ITEM_DROP_ADRENALINE)
  5308. {
  5309. entity_set_model(ent, ITEM_MODEL_ADRENALINE)
  5310. entity_set_int(ent, EV_INT_skin, 2)
  5311. break
  5312. }
  5313. }
  5314. #endif // FEATURE_ADRENALINE == true
  5315. }
  5316. }
  5317.  
  5318. entity_set_string(ent, EV_SZ_classname, ITEM_CLASSNAME)
  5319. entity_spawn(ent)
  5320. entity_set_size(ent, ITEM_HULL_MIN, ITEM_HULL_MAX)
  5321. entity_set_origin(ent, fOrigin)
  5322. entity_set_vector(ent, EV_VEC_angles, fAngles)
  5323. entity_set_vector(ent, EV_VEC_velocity, fVelocity)
  5324. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS)
  5325. entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
  5326. entity_set_int(ent, EV_INT_iuser2, iType)
  5327.  
  5328. task_remove(ent)
  5329. task_set(get_pcvar_float(pCvar_ctf_weaponstay), "weapon_startFade", ent)
  5330. }
  5331.  
  5332. #if FEATURE_C4 == true
  5333.  
  5334. player_giveC4(id)
  5335. {
  5336. give_item(id, g_szWeaponEntity[W_C4])
  5337.  
  5338. cs_set_user_plant(id, 1, 1)
  5339. }
  5340.  
  5341. #endif // FEATURE_C4
  5342.  
  5343. player_healingEffect(id)
  5344. {
  5345. new iOrigin[3]
  5346.  
  5347. get_user_origin(id, iOrigin)
  5348.  
  5349. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin)
  5350. write_byte(TE_PROJECTILE)
  5351. write_coord(iOrigin[x] + random_num(-10, 10))
  5352. write_coord(iOrigin[y] + random_num(-10, 10))
  5353. write_coord(iOrigin[z] + random_num(0, 30))
  5354. write_coord(0)
  5355. write_coord(0)
  5356. write_coord(15)
  5357. write_short(gSpr_regeneration)
  5358. write_byte(1)
  5359. write_byte(id)
  5360. message_end()
  5361. }
  5362.  
  5363. player_updateRender(id, Float:fDamage = 0.0)
  5364. {
  5365. new bool:bGlows = (get_pcvar_num(pCvar_ctf_glows) == 1)
  5366. new iTeam = g_iTeam[id]
  5367. new iMode = kRenderNormal
  5368. new iEffect = kRenderFxNone
  5369. new iAmount = 0
  5370. new iColor[3] = {0,0,0}
  5371.  
  5372. if(g_bProtected[id])
  5373. {
  5374. if(bGlows)
  5375. iEffect = kRenderFxGlowShell
  5376.  
  5377. iAmount = 200
  5378.  
  5379. iColor[0] = (iTeam == TEAM_RED ? 155 : 0)
  5380. iColor[1] = (fDamage > 0.0 ? 100 - clamp(floatround(fDamage), 0, 100) : 0)
  5381. iColor[2] = (iTeam == TEAM_BLUE ? 155 : 0)
  5382. }
  5383.  
  5384. #if FEATURE_ADRENALINE == true
  5385. switch(g_iAdrenalineUse[id])
  5386. {
  5387. case ADRENALINE_BERSERK:
  5388. {
  5389. if(bGlows)
  5390. iEffect = kRenderFxGlowShell
  5391.  
  5392. iAmount = 160
  5393. iColor = {55, 0, 55}
  5394. }
  5395.  
  5396. case ADRENALINE_INVISIBILITY:
  5397. {
  5398. iMode = kRenderTransAlpha
  5399.  
  5400. if(bGlows)
  5401. iEffect = kRenderFxGlowShell
  5402.  
  5403. iAmount = 10
  5404. iColor = {15, 15, 15}
  5405. }
  5406. }
  5407. #endif // FEATURE_ADRENALINE == true
  5408.  
  5409. if(player_hasFlag(id))
  5410. {
  5411. if(iMode != kRenderTransAlpha)
  5412. iMode = kRenderNormal
  5413.  
  5414. if(bGlows)
  5415. iEffect = kRenderFxGlowShell
  5416.  
  5417. iColor[0] = (iTeam == TEAM_RED ? (iColor[0] > 0 ? 200 : 155) : 0)
  5418. iColor[1] = (iAmount == 160 ? 55 : 0)
  5419. iColor[2] = (iTeam == TEAM_BLUE ? (iColor[2] > 0 ? 200 : 155) : 0)
  5420.  
  5421. iAmount = (iAmount == 160 ? 50 : (iAmount == 10 ? 20 : 30))
  5422. }
  5423.  
  5424. set_user_rendering(id, iEffect, iColor[0], iColor[1], iColor[2], iMode, iAmount)
  5425. }
  5426.  
  5427. player_updateSpeed(id)
  5428. {
  5429. new Float:fSpeed = 1.0
  5430.  
  5431. if(player_hasFlag(id))
  5432. fSpeed *= SPEED_FLAG
  5433.  
  5434. #if FEATURE_ADRENALINE == true
  5435.  
  5436. if(g_iAdrenalineUse[id] == ADRENALINE_SPEED)
  5437. fSpeed *= SPEED_ADRENALINE
  5438.  
  5439. #endif // FEATURE_ADRENALINE
  5440.  
  5441. set_user_maxspeed(id, g_fWeaponSpeed[id] * fSpeed)
  5442. }
  5443.  
  5444. player_screenFade(id, iColor[4] = {0,0,0,0}, Float:fEffect = 0.0, Float:fHold = 0.0, iFlags = FADE_OUT, bool:bReliable = false)
  5445. {
  5446. if(id && !g_iTeam[id])
  5447. return
  5448.  
  5449. static iType
  5450.  
  5451. if(1 <= id <= g_iMaxPlayers)
  5452. iType = (bReliable ? MSG_ONE : MSG_ONE_UNRELIABLE)
  5453. else
  5454. iType = (bReliable ? MSG_ALL : MSG_BROADCAST)
  5455.  
  5456. message_begin(iType, gMsg_ScreenFade, _, id)
  5457. write_short(clamp(floatround(fEffect * (1<<12)), 0, 0xFFFF))
  5458. write_short(clamp(floatround(fHold * (1<<12)), 0, 0xFFFF))
  5459. write_short(iFlags)
  5460. write_byte(iColor[0])
  5461. write_byte(iColor[1])
  5462. write_byte(iColor[2])
  5463. write_byte(iColor[3])
  5464. message_end()
  5465. }
  5466.  
  5467. game_announce(iEvent, iFlagTeam, szName[])
  5468. {
  5469. new iColor = iFlagTeam
  5470. new szText[64]
  5471.  
  5472. switch(iEvent)
  5473. {
  5474. case EVENT_TAKEN:
  5475. {
  5476. iColor = get_opTeam(iFlagTeam)
  5477. formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGTAKEN", szName, LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
  5478. }
  5479.  
  5480. case EVENT_DROPPED: formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGDROPPED", szName, LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
  5481.  
  5482. case EVENT_RETURNED:
  5483. {
  5484. if(strlen(szName) != 0)
  5485. formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGRETURNED", szName, LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
  5486. else
  5487. formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGAUTORETURNED", LANG_PLAYER, g_szMLFlagTeam[iFlagTeam])
  5488. }
  5489.  
  5490. case EVENT_SCORE: formatex(szText, charsmax(szText), "%L", LANG_PLAYER, "ANNOUNCE_FLAGCAPTURED", szName, LANG_PLAYER, g_szMLFlagTeam[get_opTeam(iFlagTeam)])
  5491. }
  5492.  
  5493. set_hudmessage(iColor == TEAM_RED ? 255 : 0, 0, iColor == TEAM_BLUE ? 255 : 0, HUD_ANNOUNCE)
  5494. show_hudmessage(0, szText)
  5495.  
  5496. client_print(0, print_console, "%s%L: %s", CONSOLE_PREFIX, LANG_PLAYER, "ANNOUNCEMENT", szText)
  5497.  
  5498. if(get_pcvar_num(pCvar_ctf_sound[iEvent]))
  5499. client_cmd(0, "mp3 play ^"sound/ctf/%s.mp3^"", g_szSounds[iEvent][iFlagTeam])
  5500. }
  5501.