Raised This Month: $66 Target: $400
 16% 

Knife Management v3.3 by Jon


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Gameplay        Approver:   Exolent[jNr] (178)
Jon
Veteran Member
Join Date: Dec 2007
Old 08-15-2009 , 09:28   Knife Management v3.3 by Jon
Reply With Quote #1

Description:

A plugin intended for knife only servers. See features below.


Features:
  • Strip weapons and blocks buying
  • Respawn mode
  • No slashing on _acer maps
  • Disable spraying _wires maps
  • 3rd-person camera
  • Free hit system
  • Checks hp on 35hp and 1hp maps (as it sometimes bugs)
  • Ghost chat (dead and living can read each other's chat messages)

About free hit system:

If you've played a little knife you probably know about free hits. When two players are battling and one of them are low, he could ask the other for a free hit for the battle to be fair (a stab without the other attacking). With this system you can just press your +use key on your enemy three times and a menu will appear for him. If he accepts, your enemy's health will be set to the same as yours.


Cvars:

km_respawn 1/0 - Enable/disable respawn mode (default: 0)

km_freehits Freehits - Sets number of free hits a player can request each round, 0 = disable this feature. (default: 2)

km_camera 1/0 - If enabled, camera is allowed. (default: 1)

km_stabacer 1/0 - If enabled, players will be forced to stab on _acer maps. (default: 0)

km_ghostchat 1/0 - If enabled, dead and living can read each others chat messages. (default: 1)


Commands
:

/cam or /camera - Toggles 3rd-person camera. Can be disabled by cvar.


Credits:
  • Original free hit system idea, grimvh2

Additions:

Knife Distance by SchlumPF
No Slashing Zones by grimvh2


Attached Files
File Type: sma Get Plugin or Get Source (knife_management.sma - 7630 views - 12.1 KB)

Last edited by Jon; 10-31-2009 at 11:21.
Jon is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-15-2009 , 09:28   Re: Knife Management v3.0 by Jon
Reply With Quote #2

Changelog:

1.0 -> 3.0 - Private plugin

3.0 -> 3.1 - Minor fixes and a new method for blocking buy and giving/stripping weapons. Fun and fakemeta no longer needed. Thanks to Arkshine.

3.1 -> 3.2
- Added ghostchat feature
- Added different respawn method, you now respawn by pressing your attack1 button (normally left mousebutton).
- Added removal of existing guns on maps

3.2 -> 3.21
- Fixed ghostchat bug

3.21 -> 3.22
- Removed a useless variable
- Added cstrike for team retriving

3.22 -> 3.23
- Minor optimizations

3.23 -> 3.3
- Removed that you have to click to respawn
- Now stripping and giving weapons on each spawn
- Minor code improvements

Last edited by Jon; 10-31-2009 at 11:22.
Jon is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 08-15-2009 , 09:50   Re: Knife Management v3.0 by Jon
Reply With Quote #3

nice, gj!
KadiR is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2009 , 10:09   Re: Knife Management v3.0 by Jon
Reply With Quote #4

It seems well coded, though there are some minor things :

- To disable buy and giving weapon, in this case, I would prefer to use keyvalue and letting the engine doing its job without any extra calls each time. And about the buy, I prefer to see the original message saying you can't buy. An example ( it's possible to use Ham_Spawn instead of pnf_keyvalue() :
Code:
    public plugin_precache()     {         new Entity;                 Entity = create_entity( "info_map_parameters" );         DispatchKeyValue( Entity, "buying", "3" );         DispatchSpawn( Entity );                 Entity = create_entity( "player_weaponstrip" );         DispatchKeyValue( Entity, "targetname", "stripper" );         DispatchSpawn( Entity );                 Entity = create_entity( "game_player_equip" );         DispatchKeyValue( Entity, "weapon_knife", "1" );         DispatchKeyValue( Entity, "targetname"  , "equipement" );         DispatchSpawn( Entity );                 Entity = create_entity( "multi_manager" );         DispatchKeyValue( Entity, "equipement", "0.5"   );         DispatchKeyValue( Entity, "stripper"  , "0"     );         DispatchKeyValue( Entity, "targetname", "game_playerspawn" );         DispatchKeyValue( Entity, "spawnflags", "1"     );         DispatchSpawn( Entity );     }         public pfn_keyvalue( Entity )     {         new ClassName[ 20 ];         new KeyName  [ 16 ];         new Value    [ 20 ];                 copy_keyvalue( ClassName, charsmax( ClassName ), KeyName, charsmax( KeyName ), Value, charsmax( Value ) );                 if ( equal( ClassName, "info_map_parameters" ) || equal( ClassName, "player_weaponstrip" ) ||              equal( ClassName, "game_player_equip" )   || equal( ClassName, "func_buyzone" ) )         {             remove_entity( Entity );             return PLUGIN_HANDLED;         }                 return PLUGIN_CONTINUE;     }
- In fwdCmdStart(), you could use directly get_user_weapon() and no need to return FMRES_SUPERCEDE, FMRES_HANDLED is enough. But I would use the weapon's offsets ( m_flNextPrimaryAttack (46) / m_flNextSecondaryAttack (47) ) to block primary/secondary knife attack, it will be more efficient and you would not need to use FM_CmdStart.
- g_iMapType & TYPE_35HP || g_iMapType & TYPE_1HP ) ; you can do g_iMapType & ( TYPE_35HP | TYPE_1HP )
- Adding ML ?
- Never tried yet, but about the respawn stuff, it may interesting to use another condition than game_playerspawn if you use keyvalue, see http://twhl.co.za/wiki.php?id=1082

That's all.
__________________
Arkshine is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 08-15-2009 , 10:15   Re: Knife Management v3.0 by Jon
Reply With Quote #5

wow, arkshine is a nice plugin checker
KadiR is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-15-2009 , 10:25   Re: Knife Management v3.0 by Jon
Reply With Quote #6

Thanks for your corrections and suggestions.

Quote:
Originally Posted by Arkshine View Post
But I would use the weapon's offsets ( m_flNextPrimaryAttack (46) / m_flNextSecondaryAttack (47) ) to block primary/secondary knife attack, it will be more efficient and you would not need to use FM_CmdStart.
In what forward? I haven't worked so much with offsets before.
Jon is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2009 , 10:27   Re: Knife Management v3.0 by Jon
Reply With Quote #7

The best place I would think is Ham_Item_Deploy ( as post ).
__________________
Arkshine is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-15-2009 , 10:40   Re: Knife Management v3.0 by Jon
Reply With Quote #8

I found this method rather simple and satisfying:

PHP Code:
RegisterHamHam_Weapon_PrimaryAttack"weapon_knife""fwdTest" );

public 
fwdTestiEntity )
{
    
ExecuteHamHam_Weapon_SecondaryAttackiEntity );
    return 
HAM_SUPERCEDE;

Since I am switching attack and attack2.
Jon is offline
Mouseglider
New Member
Join Date: Aug 2009
Old 08-15-2009 , 10:41   Re: Knife Management v3.0 by Jon
Reply With Quote #9

Great Plugin
Mouseglider is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2009 , 10:48   Re: Knife Management v3.0 by Jon
Reply With Quote #10

Quote:
Since I am switching attack and attack2.
I think I've misread the code. You want to block the primary attack only. In this case, yes, your way is nice and enough.
__________________
Arkshine 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 23:19.


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