Monthly Target: $400 Donations: $131
 32% 

1v1 Knife Fight (1.2.1, Updated: 10/17/2008)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Plugin ID:
552
Plugin Version:
1.2.1
Plugin Category:
Fun Stuff
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
    412 
    Plugin Description:
    Let the last two players alive knife it out!
    Old 09-24-2008 , 12:28   1v1 Knife Fight (1.2.1, Updated: 10/17/2008)
    Reply With Quote #1

    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
    Attached Files
    File Type: sp Get Plugin or Get Source (knifefight.sp - 11300 views - 30.5 KB)
    File Type: zip knifefight.zip (30.9 KB, 35766 views)

    Last edited by XARIUS; 10-17-2008 at 10:33.
    XARIUS is offline
    MikeGreene
    Junior Member
    Join Date: Sep 2008
    Old 09-24-2008 , 13:11   Re: 1v1 Knife Fight
    Reply With Quote #2

    Will be testing this thoroughly today tomorrow, will let you know if we see any bugs . Great work!
    MikeGreene is offline
    Derek
    Senior Member
    Join Date: Sep 2007
    Old 09-24-2008 , 13:14   Re: 1v1 Knife Fight
    Reply With Quote #3

    Woot! We have installed it on our GunGame server and it seems to be working great. We have seen 1 bug and 1 error so far.

    1. Once in awhile your knife will get stuck and you can't knife.

    2. Error Log

    L 09/24/2008 - 11:09:09: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
    L 09/24/2008 - 11:09:09: [SM] Debug mode is not enabled for "knifefight.smx"
    L 09/24/2008 - 11:09:09: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 32 on
    __________________
    Derek
    Owner
    XFactorServers
    Game Server Hosting
    Derek is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 09-24-2008 , 14:14   Re: 1v1 Knife Fight
    Reply With Quote #4

    Quote:
    Originally Posted by DerekRDenholm View Post
    Woot! We have installed it on our GunGame server and it seems to be working great. We have seen 1 bug and 1 error so far.

    1. Once in awhile your knife will get stuck and you can't knife.

    2. Error Log

    L 09/24/2008 - 11:09:09: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
    L 09/24/2008 - 11:09:09: [SM] Debug mode is not enabled for "knifefight.smx"
    L 09/24/2008 - 11:09:09: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 32 on
    Thanks, this is exactly the stuff I'm looking for. There's a bazillion ways and places little things like this can happen, and I hafta find them all. If you can get me a debug log of that, it would help immensely. rcon sm plugins debug 32 on

    X

    Last edited by XARIUS; 09-24-2008 at 14:35.
    XARIUS is offline
    Derek
    Senior Member
    Join Date: Sep 2007
    Old 09-24-2008 , 16:36   Re: 1v1 Knife Fight
    Reply With Quote #5

    Here is the debug mode:

    L 09/24/2008 - 144:16: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
    L 09/24/2008 - 144:16: [SM] Displaying call stack trace for plugin "knifefight.smx":
    L 09/24/2008 - 144:16: [SM] [0] Line 399, /home/groups/sourcemod/upload_tmp/textwDkT26.sp::CancelFight()
    L 09/24/2008 - 144:16: [SM] [1] Line 444, /home/groups/sourcemod/upload_tmp/textwDkT26.sp::Countdown()

    Our gungame has had our 1st crash and we just added this plugin so I am guessing something in this plugin is caushing the crash. Thanks!
    __________________
    Derek
    Owner
    XFactorServers
    Game Server Hosting
    Derek is offline
    Derek
    Senior Member
    Join Date: Sep 2007
    Old 09-24-2008 , 16:44   Re: 1v1 Knife Fight
    Reply With Quote #6

    Also at the end of the round and you kill the person before the knife fight triggers (both pressed to fight) it starts the next round but the knife fight starts on that round because it carries over from last round.
    __________________
    Derek
    Owner
    XFactorServers
    Game Server Hosting
    Derek is offline
    Derek
    Senior Member
    Join Date: Sep 2007
    Old 09-24-2008 , 16:46   Re: 1v1 Knife Fight
    Reply With Quote #7

    Here is another error:

    L 09/24/2008 - 14:446: [SM] [0] Line 399, /home/groups/sourcemod/upload_tmp/textwDkT26.sp::CancelFight()
    L 09/24/2008 - 14:446: [SM] [1] Line 723, /home/groups/sourcemod/upload_tmp/textwDkT26.sp:anelHandler()
    __________________
    Derek
    Owner
    XFactorServers
    Game Server Hosting
    Derek is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 09-24-2008 , 17:39   Re: 1v1 Knife Fight
    Reply With Quote #8

    Thanks, much appreciated.

    I threw it on my gungame server as well. Immediately I found a bunch of different scenarios I hadn't envisioned, so I've got more work to do.

    Instead of updating the plugin every 20 minutes on here, I'll try and get it updated once a day so you have new versions to test with.

    One thing that came up right away on gungame was the speed at which players join (especially on map change).

    ie: map starts, players join, start fighting, 1v1 knife starts, more players join and stay alive because its only been say 30 seconds, so the server doesn't join them as dead. I suppose if a knife fight is going on I'll just kill the player as they join.
    XARIUS is offline
    XARIUS
    SourceMod Donor
    Join Date: May 2008
    Location: Atlanta, GA
    Old 09-25-2008 , 01:46   Re: 1v1 Knife Fight
    Reply With Quote #9

    Updated to 0.4, please see changelog/notes.

    The plugin should be very stable at this point. If you get crashes or any other odd behaviour, please report it!

    Thanks,

    X

    Last edited by XARIUS; 09-25-2008 at 12:29.
    XARIUS is offline
    Derek
    Senior Member
    Join Date: Sep 2007
    Old 09-25-2008 , 12:47   Re: 1v1 Knife Fight
    Reply With Quote #10

    We are still getting crashing with the 0.03 as well as this in the error log:

    L 09/25/2008 - 09:476: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
    L 09/25/2008 - 09:476: [SM] Displaying call stack trace for plugin "knifefight.smx":
    L 09/25/2008 - 09:476: [SM] [0] Line 424, /home/groups/alliedmodders/forums/files/3/7/7/5/1/31782.attach::CancelFight()
    L 09/25/2008 - 09:476: [SM] [1] Line 417, /home/groups/alliedmodders/forums/files/3/7/7/5/1/31782.attach::StartFight()
    L 09/25/2008 - 09:476: [SM] [2] Line 744, /home/groups/alliedmodders/forums/files/3/7/7/5/1/31782.attach:anelHandler()
    L 09/25/2008 - 09:476: [SM] Native "GetClientTeam" reported: Client index 0 is invalid
    __________________
    Derek
    Owner
    XFactorServers
    Game Server Hosting
    Derek is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 03:47.


    Powered by vBulletin®
    Copyright ©2000 - 2017, vBulletin Solutions, Inc.
    Theme made by Freecode