View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 01-25-2015 , 06:39   Re: [Plugin] Ballistic knife new*
Reply With Quote #12

CmdStart is not as good as Jhob said.
  • Sometimes static, sometimes new. In such forward static is better.
  • Returning PLUGIN_HANDLED is dumb, use FMRES_ return types.
  • Striping all user weapons seems an unwanted bug.
  • Same story for PLUGIN_CONTINUE as for PLUGIN_HANDLED.
  • This check
    PHP Code:
      else if(is_user_alive (id) && !g_Block[id]) 
    make no sens, why you need to check again if it's alive when you already do that some lines above ?

The other parts:
  • const Hex_Value = 0x21 just to make it to "look better" in your opinion or why ? You kill the ability of beginners to fully understanding your code.
  • Stick to just one coding style. If you capitalize some of your vars, do that with all of them.
  • Storing cvars into an array doesn't give any advantages, it's good only if you are going to loop and cache them. Now it's not wrong, but not in any way better.
  • Again, strip only the knife, not all of his weapons.
  • g_Remplace: isn't Remplace a french word ? Just curious.
  • In Ballistic_knife check if the user is alive.
  • PHP Code:
     (get_pcvar_float(Cvar_stock[0]) > 1) ? ExecuteHam(Ham_TakeDamageVictimididDamageDMG_NERVEGAS) : death_message(idVictim1"weapon_knife"
    coding in just one line. Readability is gone.....
  • Cache get_user_msgid("ScoreInfo").
  • Use Ham_Item_Deploy for setting models, not CurWeapon event.
  • Instead of checking to times if he has knife in his hands, check just one time.
__________________

Last edited by HamletEagle; 01-25-2015 at 06:40.
HamletEagle is offline