AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_TakeDamage Error (https://forums.alliedmods.net/showthread.php?t=213676)

bloody806 04-17-2013 13:48

Ham_TakeDamage Error
 
Hi i need help with error. Plugin can normal compile but dont work Item on this function.
Please help :P

Here are errors:

L 04/17/2013 - 19:41:34: [AMXX] Run time error 4: index out of bounds
L 04/17/2013 - 19:41:34: [AMXX] [0] KnifeShoppp.sma::takeDamage_pre (line 219
)

Code:
PHP Code:

new bool:g_bActived_SuperKnife[33]; 

PHP Code:

RegisterHam(Ham_TakeDamage"player","takeDamage_pre"

PHP Code:

public takeDamage_pre(victimIDinflictorattackerIDFloat:flDmgdmgBits)
{
    if(
g_bActived_SuperKnife[attackerID]) // -------- Here is error --------
    
{
    new 
iTempiWepId;
    
iWepId get_user_weapon(attackerIDiTempiTemp);

    if(
cs_get_user_team(attackerID) == CS_TEAM_T && iWepId == CSW_KNIFE)
    {
        
SetHamParamFloat(4flDmg get_pcvar_float(cvar_dmg))
    }
}
    return 
HAM_IGNORED



baneado 04-17-2013 13:58

Re: Ham_TakeDamage Error
 
Add
PHP Code:

if (!is_user_connected(attackerID) || victimID == attackerID) return HAM_IGNORED


bloody806 04-17-2013 14:12

Re: Ham_TakeDamage Error
 
This way?

PHP Code:

public takeDamage_pre(victimIDinflictorattackerIDFloat:flDmgdmgBits)
{
if(
g_bActived_SuperKnife[attackerID] && !is_user_connected(attackerID) || victimID == attackerID) return HAM_IGNORED;  
{
new 
iTempiWepId;
iWepId get_user_weapon(attackerIDiTempiTemp);

if(
cs_get_user_team(attackerID) == CS_TEAM_T && iWepId == CSW_KNIFE)
{
SetHamParamFloat(4flDmg get_pcvar_float(cvar_dmg))
}
}
return 
HAM_IGNORED



didoWEE 04-17-2013 15:34

Re: Ham_TakeDamage Error
 
no,
public takeDamage_pre(victimID, inflictor, attackerID, Float:flDmg, dmgBits)
{
if(
!is_user_connected(attackerID) || victimID == attackerID) return HAM_IGNORED;

if(g_bActived_SuperKnife[attackerID])
{
........

bloody806 04-18-2013 11:51

Re: Ham_TakeDamage Error
 
Thanks for all :) Now dont show any errors.


All times are GMT -4. The time now is 10:55.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.