View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-15-2009 , 09: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