Raised This Month: $ Target: $400
 0% 

[HELP] Run time error 4: index out of bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Michell
Member
Join Date: Oct 2015
Old 10-24-2015 , 09:31   [HELP] Run time error 4: index out of bounds
Reply With Quote #1

Could anyone help me remove this error ?

L 10/24/2015 - 04:59:16: [AMXX] Displaying debug trace (plugin "pg.amxx", version "2015")
L 10/24/2015 - 04:59:16: [AMXX] Run time error 4: index out of bounds
L 10/24/2015 - 04:59:16: [AMXX] [0] 99a9e4b68481360b9fba15b8071f2334.sma:: PlayerDeath (line 662)


Quote:
public PlayerDeath(victim, attacker){

new vicname[32]
new killname[32]
new health

health = get_user_health(attacker);
gKillerID[victim] = attacker;

get_user_name(victim,vicname,31);
get_user_name(attacker,killname,31);

if(get_pcvar_num(VarShowHP) == 1){
if(iLive){
if(is_user_connected(victim) && victim != attacker){
client_print(victim,print_chat,"[ %s te matou, ficando com %i HP ]",killname,health);
gHPKiller[attacker] = health;
}

}
}
}
Quote:
line 662: gHPKiller[attacker] = health;

Last edited by Michell; 10-24-2015 at 09:32. Reason: Erro em traslation
Michell is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-24-2015 , 09:45   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #2

How is PlayerDeath registered ?
__________________
HamletEagle is offline
Michell
Member
Join Date: Oct 2015
Old 10-24-2015 , 09:47   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #3

Quote:
RegisterHam( Ham_Killed, "player", "PlayerDeath", 1)
Michell is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-24-2015 , 10:07   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #4

Show the definition for these 2 arrays:

gKillerID[]
gHPKiller[]

Try this
PHP Code:
#include <amxmodx>
#include <hamsandwich>

const MAXPLAYERS 32;

new 
gKillerIDMAXPLAYERS ];
new 
gHPKillerMAXPLAYERS ];

#define IsPlayer(%1)    (1<=%1<=MAXPLAYERS)

public plugin_init() 
{
    
RegisterHamHam_Killed "player" "PlayerDeath" 
}

public 
PlayerDeathvictim attacker )
{
    new 
vicname[32]
    new 
killname[32]
    new 
health

    
if( IsPlayerattacker ) && victim != attacker && is_user_connectedattacker ) )
    {
        
health get_user_health(attacker);
        
gKillerID[victim] = attacker;
        
        
get_user_name(victim,vicname,31);
        
get_user_name(attacker,killname,31);
        
client_print(victim,print_chat,"[ %s te matou, ficando com %i HP ]",killname,health);
        
        
gHPKiller[attacker] = health;
    }
    else
    {
        
client_printvictim print_chat "Attacker is self, not a player, or left the server" );
    }

__________________

Last edited by Bugsy; 10-24-2015 at 10:14.
Bugsy is offline
Michell
Member
Join Date: Oct 2015
Old 10-24-2015 , 10:08   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #5

Quote:
new gKillerID[33]
new gHPKiller[33]
Michell is offline
Michell
Member
Join Date: Oct 2015
Old 10-24-2015 , 10:19   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #6

OK
Michell is offline
Michell
Member
Join Date: Oct 2015
Old 10-24-2015 , 10:33   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #7

when it happens the event just appears 2x .
EX :
Michell killed you , getting HP

RESOLVED DUPLICATION

Last edited by Michell; 10-24-2015 at 10:40.
Michell is offline
Michell
Member
Join Date: Oct 2015
Old 10-25-2015 , 20:50   Re: [HELP] Run time error 4: index out of bounds
Reply With Quote #8

RESOLVED Run time error 4: index out of bounds
Michell is offline
Reply



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 22:16.


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