HELP

Coding Help/Re-API Supported
Post Reply
User avatar
Loxer
Member
Member
Morocco
Posts: 1
Joined: 8 Months Ago
Has thanked: 0
Been thanked: 0
Contact:

HELP

#1

Post by Loxer » 6 Months Ago

Please Help :(
  1. L 01/14/2020 - 18:28:00: Start of error session.
  2. L 01/14/2020 - 18:28:00: Info (map "ze_egypt") (file "addons/amxmodx/logs/error_20200114.log")
  3. L 01/14/2020 - 18:28:00: [AMXX] Displaying debug trace (plugin "knife_menu.amxx", version "2019")
  4. L 01/14/2020 - 18:28:00: [AMXX] Run time error 4: index out of bounds
  5. L 01/14/2020 - 18:28:00: [AMXX]    [0] 5b68f2f345beff16ca5eac684e89d027.sma::Player_TakeDamage (line 386)
]
  1. public Player_TakeDamage (iVictim, iInflictor, iAttacker, Float:Damage, iDamageBits)
  2. {
  3.    if(iInflictor == iAttacker && HaveKnife1[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  4.    {
  5.       SetHamParamFloat(4, Damage * 1.1);
  6.       return HAM_HANDLED;
  7.    }
  8.    
  9.    if(iInflictor == iAttacker && HaveKnife2[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  10.    {
  11.       SetHamParamFloat(4, Damage * 1.1);
  12.       return HAM_HANDLED;
  13.    }
  14.    
  15.    if(iInflictor == iAttacker && HaveKnife3[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  16.    {
  17.       SetHamParamFloat(4, Damage * 1.1);
  18.       return HAM_HANDLED;
  19.    }
  20.    
  21.    if(iInflictor == iAttacker && HaveKnife4[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  22.    {
  23.       SetHamParamFloat(4, Damage * 1.1);
  24.       return HAM_HANDLED;
  25.    }
  26.    
  27.    if(iInflictor == iAttacker && HaveKnife5[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  28.    {
  29.       SetHamParamFloat(4, Damage * 1.2);
  30.       return HAM_HANDLED;
  31.    }
  32.    
  33.    if(iInflictor == iAttacker && HaveKnife6[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  34.    {
  35.       SetHamParamFloat(4, Damage * 1.2);
  36.       return HAM_HANDLED;
  37.    }
  38.    
  39.    if(iInflictor == iAttacker && HaveKnife7[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  40.    {
  41.       SetHamParamFloat(4, Damage * 1.2);
  42.       return HAM_HANDLED;
  43.    }
  44.    
  45.    if(iInflictor == iAttacker && HaveKnife8[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
  46.    {
  47.       SetHamParamFloat(4, Damage * 1.2);
  48.       return HAM_HANDLED;
  49.    }
  50.    
  51.    return HAM_IGNORED;
  52. }

[ Post made via Android ]

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 2016
Joined: 3 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 117 times
Age: 22
Contact:

#2

Post by Raheem » 6 Months Ago

Just make sure that the attacker is alive first before using HaveKnife1,2...[index]:
    1. public Player_TakeDamage (iVictim, iInflictor, iAttacker, Float:Damage, iDamageBits)
    2. {
    3.     if (!is_user_alive(iAttacker))
    4.         return HAM_HANDLED;
    5.    
    6.    if(iInflictor == iAttacker && HaveKnife1[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    7.    {
    8.       SetHamParamFloat(4, Damage * 1.1);
    9.       return HAM_HANDLED;
    10.    }
    11.    
    12.    if(iInflictor == iAttacker && HaveKnife2[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    13.    {
    14.       SetHamParamFloat(4, Damage * 1.1);
    15.       return HAM_HANDLED;
    16.    }
    17.    
    18.    if(iInflictor == iAttacker && HaveKnife3[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    19.    {
    20.       SetHamParamFloat(4, Damage * 1.1);
    21.       return HAM_HANDLED;
    22.    }
    23.    
    24.    if(iInflictor == iAttacker && HaveKnife4[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    25.    {
    26.       SetHamParamFloat(4, Damage * 1.1);
    27.       return HAM_HANDLED;
    28.    }
    29.    
    30.    if(iInflictor == iAttacker && HaveKnife5[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    31.    {
    32.       SetHamParamFloat(4, Damage * 1.2);
    33.       return HAM_HANDLED;
    34.    }
    35.    
    36.    if(iInflictor == iAttacker && HaveKnife6[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    37.    {
    38.       SetHamParamFloat(4, Damage * 1.2);
    39.       return HAM_HANDLED;
    40.    }
    41.    
    42.    if(iInflictor == iAttacker && HaveKnife7[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    43.    {
    44.       SetHamParamFloat(4, Damage * 1.2);
    45.       return HAM_HANDLED;
    46.    }
    47.    
    48.    if(iInflictor == iAttacker && HaveKnife8[iAttacker] && is_user_alive(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE && cs_get_user_team(iAttacker) == CS_TEAM_T)
    49.    {
    50.       SetHamParamFloat(4, Damage * 1.2);
    51.       return HAM_HANDLED;
    52.    }
    53.    
    54.    return HAM_IGNORED;
    55. }
Loading Raheem's signature, Please wait...
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests