Raised This Month: $218 Target: $400
 54% 

[ Knife Menu ] Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AlaskaxD
New Member
Join Date: Apr 2019
Old 01-14-2020 , 17:41   [ Knife Menu ] Help
Reply With Quote #1

Please Help

Code:
L 01/14/2020 - 18:28:00: Start of error session.
L 01/14/2020 - 18:28:00: Info (map "de_dust2_china") (file "addons/amxmodx/logs/error_20200114.log")
L 01/14/2020 - 18:28:00: [AMXX] Displaying debug trace (plugin "knife_menu.amxx", version "2019")
L 01/14/2020 - 18:28:00: [AMXX] Run time error 4: index out of bounds 
L 01/14/2020 - 18:28:00: [AMXX]    [0] 5b68f2f345beff16ca5eac684e89d027.sma::Player_TakeDamage (line 386)

Code:
public Player_TakeDamage (iVictim, iInflictor, iAttacker, Float:Damage, iDamageBits)
{
   if(iInflictor == iAttacker && HaveKnife1[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.1);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife2[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.1);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife3[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.1);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife4[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.1);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife5[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.2);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife6[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.2);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife7[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.2);
      return HAM_HANDLED;
   }
   
   if(iInflictor == iAttacker && HaveKnife8[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
   {
      SetHamParamFloat(4, Damage * 1.2);
      return HAM_HANDLED;
   }
   
   return HAM_IGNORED;
}
AlaskaxD is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-14-2020 , 18:38   Re: [ Knife Menu ] Help
Reply With Quote #2

Lol, what's that. Use this - https://forums.alliedmods.net/showthread.php?t=293632

If this is actually a scripting question and not another wrong section, then your "HaveKnife" variables are not defined with an array size of 33.

PS: all of this redundant code can be replaced with less than 5 lines. You don't need to check the exact same things every time, use variables. You're doing 32 checks when you can do only 4.
__________________

Last edited by OciXCrom; 01-14-2020 at 18:39.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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:24.


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