General:
This is my second plugin!
This is based off dalto's original plugin as well as the Knifep3n plugin for eventscripts. I did borrow a few snippets from dalto's unapproved plugin. I also borrowed code from the core beacon.sp. Additionally, thanks to FlyingMongoose for letting me steal his lightning effects and sound, and LDuke for his ragdoll dissolver code. =)
Info:
When a 1 versus 1 situation occurs, the plugin will prompt players asking if they want to knife to the death. This plugin does support music during the fight, however I have not included any at this time.
When the knife fight starts, ALL weapons are stripped, and saved. When the fight has concluded, the winner will get their weapons back.
The bomb is removed when the knife fight starts, there will be no completing the objective, someone must die! Additionally, the fights won't trigger if the bomb is already planted.
Usage:
Sit back and have fun.
If you would like to see it in action before downloading, you can visit this server: 65.99.193.99:27015
Installation:
Download the zip file and extract into your /cstrike/ directory.
Manual Installation:
- Copy knifefight.smx to addons/sourcemod/plugins/
- Copy knifefight.phrases.txt to addons/sourcemod/translations/
- Copy knifefight.sp to addons/sourcemod/scripting/
- Copy chicken.wav to /cstrike/sound/knifefight/
- Fight Music goes in /cstrike/sound/knifefight/ and must be added to your knifefight.cfg file.
The plugin will automatically create your config (knifefight.cfg) file in: /cstrike/cfg/sourcemod/
Configuration:- sm_knifefight_enabled: Enables or disables the plugin (Default :1)
- sm_knifefight_useteleport: Use the built in teleport system before the fight. This helps ensure that both players find each other quickly. The Terrorist will always be teleported to the Counter-Terrorist. Additionally, if the players are already close to each other, no teleport will take place. (Default: 1)
- sm_knifefight_forcefight: Skips asking the players if they want to knife, and forces a 1v1 knife fight. (Default: 0)
- sm_knifefight_restorehealth: Restore both players health to 100 prior to fighting. (Default: 0)
- sm_knifefight_winnerhealth: The amount of health to give the winner for the next round only. (Default: 0)
- sm_knifefight_winnermoney: The amount of extra money to give the winner for the next round only. (Default: 0)
- sm_knifefight_winnerspeed: The amount of extra speed given to the winner for the next round only. (Default: 0)
- sm_knifefight_winnereffects: Use lightning and sound effects on the winner after the fight. (Default: 1)
- sm_knifefight_losereffects: Dissolve losers body using special effects. (Default: 1)
- sm_knifefight_locatorbeam: Use locator beam between players if they are far apart. (Default: 1)
- sm_knifefight_decinesound: Sound file to use when a player declines to knife fight. (Default: chicken.wav)
- sm_knifefight_fightsongs: Sound files to play during the knife fight (random). (Default: none.)
- sm_knifefight_stopmusic: Stop music when fight is over. Useful when used with GunGame. (Default: 0)
- sm_knifefight_countdowntimer: Number of seconds to count down before a knife fight. (Default: 3)
- sm_knifefight_fightimer: Number of seconds to allow for knifing. Players get slayed after this time limit expires. (Default: 30)
- sm_knifefight_minplayers: Minimum number of players before a knife fight will trigger. (Default: 4)
Changelog:
Version 1.2.1:
Added CVAR feature request:
sm_knifefight_minplayers. Places requirement on the minimum number of players on the server before knife fights will trigger.
Version 1.2:
You must update your translations file with version 1.2!
Added CVAR
sm_knifefight_fighttime. This is a generic fight timer. Once the time expires, if there is no winner, the players will be slayed and will not receive their weapons back.
Fixed crash scenario with GunGame4.
Prevented fights from starting if the map is over (during scoreboard/intermission).
Version 1.1:
Changed from using GetEntDataEnt to GetEntDataEnt2 - more stable and no errors.
Added CVAR:
sm_knifefight_locatorbeam
This cvar places beams between the two players so that they can easily find each other if they are far apart. Works with and without teleport enabled.
Added CVAR:
sm_knifefight_stopmusic
When enabled, this will stop the fight music as soon as the fight is over. This is useful on gungame servers incase the winner of the knife fight wins the game. It prevents the winner music and fight music from overlapping. Unfortunately, I don't know of any way to reach over and check the "level" the gungame player is on to make this work dynamically. Maybe in the future.
You can either erase your knifefight.cfg and let it be re-created, or add these two new cvar's to it manually.
Version 1.0.2:
I think I've gotten the crash bug fixed now. No, really. Thanks to Tigerox for helping track it down! Please upgrade to this version, or you may still be at risk for server crashes. Also looks for my
warmup round plugin. Knife fights will not occur during warmup.
Version 1.0.1:
Traced crash bug to an error dealing with entity's. Must have been the weapon handler. I completely rewrote the weapon stripping/giving function this evening. Did some minor cleanup. Less PrintToChatAll, more PrintHintTextToAll for shiny purposes.
Version 1.0:
Fixed a few small timing issues to make things smoother. Please provide feedback on whatever issues you may find! Did some minor code cleanup based on feedback from others.
Version 0.8:
Fixed a really stupid bug on my part regarding some people reporting weapons not being stripped etc, prior to a knife fight. I accidentally had the code which performs these functions within a conditional statement for the music. If you had no songs defined, you wouldn't get any of the functionality. Oopsie.
Please erase your knifefight.cfg file when updating to this version, it needs to be generated automatically from the plugin.
Added CVAR
sm_knifefight_losereffects
Added ragdoll dissolve animation to the losing player's body.
Version 0.7:
Added CVAR
sm_knifefight_countdown timer.
If the player has a speed boost going into knife fight, the speed is removed prior to the new fight beginning.
Added IsFakeClient logic. If one bot and one human player remain, the bot will always agree to knife. If only two bots are left alive, the knife fight never triggers. It's painful enough watching two bots with guns camp it out.
Please erase your knifefight.cfg file when updating to this version, it needs to be generated automatically from the plugin.
See GunGame: Python notes below in red.
Version 0.6:
Fixed some minor bugs I created in 0.5. Moved teleport to be sooner, if needed. This version is very stable! Ran for 16 hours yesterday, error free. Please erase your knifefight.cfg file when updating to this version, it needs to be generated automatically from the plugin.
Version 0.5:
Fixed various issues with invalid client index 0. Players SHOULD always get a knife now! (probably just jinxed it)
Fixed Cvar change notifications.
Version 0.4:
Fixed issues where dumb admins decide to slay a player during the countdown or knife fight.
No file changes except for .smx.
I *may* have fixed it not giving a knife. I tried with bots about 40 times in a row and never had an instance without a knife. This may well not be the case with more real players however.
Version 0.3:
Fixed many dynamic errors today based on various situations. This version is much more stable over the original testing release.
No file changes except for .smx.
Version 0.1:
Public testing release.
Known Issues:
Gungame: Python Issues:
If you use Turbo mode (without respawn), it will strip the knife away from a player during a knife fight due to turbo having a dependency set on gg_dead_strip.
To fix this, open addons/eventscripts/gungame/included_addons/gg_turbo/gg_turbo.py.
Line 42: gg_turbo.addDependency('gg_dead_strip', 1)
Change to: gg_turbo.addDependency('gg_dead_strip', 0)
Remove your gg_turbo.pyc file, and restart gungame.
This will disable weapon stripping, and turbo will continue to function normally, with the mild exception that in rare instances, a player may walk over a gun and pick it up instead of being given their next weapon as intended.
It's also probably a bad idea to try and use this on a deathmatch/respawn server.
Additional Comments:
Being my second plugin, this was a real learning experience. I'm sure I did a lot of stuff in stupid ways. End result, it works!
If you use fast downloads/redirects, don't forget to copy chicken.wav (and your fight songs). This plugin does add the files to the download tables.
When running this plugin, please check your log file for errors occasionally and report them back. If you can turn on debugging while testing and post the debug logs, that'd be even better.
Enjoy!
X