View Single Post
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-04-2011 , 13:03   Re: Mortal Headshot v0.0.1
Reply With Quote #14

  • In HamTraceAttack() :
    • Put g_weaponMortalHeadshot check before get_tr2. When you can, always check first the variables to filter more and avoid to call natives. The less natives you call, the more efficient your plugin will be.
    • You could use directly get_user_weapon in the array. The code is readable and you avoid to create a var.
    • I would avoid to alter the damage done, because it influences on the blood quantity, punch angle and such, when the purpose of the plugin is to simply kill right away with the current damage. Also, you do * 100, but it may not enough. So, you would better to avoid to alter damage and instead put the player's health to 0. It should be enough and you can be sure it will be killed. Please test before though.
  • In ConsoleCommand_MortalHeadshot()
    • Is there a specific reason you don't use cmd_access ? If not, you better use it, it will throw a message if you don't have the level required.
    • Retrieve the second argument only if the weapon id is valid.
    • I see you do several checks to filter CSW* constants. Here a tip to make your code shorter and with one check. Of course use your own style.
      Code:
      const bitsNotWeapons = 1 << CSW_SMOKEGRENADE | 1 << CSW_HEGRENADE | 1 << CSW_FLASHBANG | 1 << CSW_C4; if( weaponid && ~( 1 << weaponid ) & bitsNotWeapons ) {
    • Don't use client_print. Use instead console_print. It's a console command and message will be printed properly whatever you use from the server console or client.
    • Your forget to return PLUGIN_HANDLED, otherwise you will get a message the command is unknown.
__________________

Last edited by Arkshine; 01-13-2012 at 16:02.
Arkshine is offline