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