Advertisement
Guest User

Untitled

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