AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Getting error in server console (https://forums.alliedmods.net/showthread.php?t=128109)

Effect 05-29-2010 01:53

Getting error in server console
 
I get this error in server console:
Quote:

L 05/29/2010 - 08:44:19: [AMXX] [0] hrk_zpmmod.sma::ShowHealth (line 417)
L 05/29/2010 - 08:44:20: [AMXX] Displaying debug trace (plugin "hrk_zpmmod.amxx")
Using this code:
PHP Code:

public ShowHealth(id)
{

    if (
g_zombie[id] && is_user_alive(id))
    {
        new 
Health
        Health 
get_user_health(id)

        
set_hudmessage(255000.020.9700.00.30.00.0)
        
show_hudmessage(id"|Health: %d || Class: %s|"HealthCLASSES[ZombieClass[id]]) //// on this line is error.
    
}


Who can help me ? :)

fysiks 05-29-2010 02:02

Re: Getting error in server console
 
I think you are missing the first line or two of the error from the log.

Effect 05-29-2010 02:44

Re: Getting error in server console
 
Yes you will right.. here:
Quote:

L 05/29/2010 - 08:44:01: Start of error session.
L 05/29/2010 - 08:52:18: Info (map "de_dust") (file "addons/amxmodx/logs/error_20100529.log")
L 05/29/2010 - 08:52:18: [AMXX] Displaying debug trace (plugin "hrk_zpmmod.amxx")
L 05/29/2010 - 08:52:18: [AMXX] Run time error 4: index out of bounds
L 05/29/2010 - 08:52:18: [AMXX] [0] hrk_zpmmod.sma::ShowHealth (line 417)

Bugsy 05-29-2010 09:25

Re: Getting error in server console
 
Index out of bounds error on this: CLASSES[ ZombieClass[id] ]

This means either id is larger than ZombieClass upper-bound or ZombieClass[id] is larger than CLASSES upper-bound. I assume the latter.

Show the definition for both arrays and where they are assigned values.

Effect 05-29-2010 09:58

Re: Getting error in server console
 
This ?:
PHP Code:

#define MAXCLASSES 4

new ZombieClass[33]

new const 
CLASSES[MAXCLASSES][] =
{
    
"Classic",
    
"Electric",
    
"Strong",
    
"Mystic"
}
enum
{
    
Classic 0,
    
Electric,
    
Strong,
    
Mystic



Bugsy 05-29-2010 10:04

Re: Getting error in server console
 
Show where ZombieClass[ id ] is assigned a value and make sure id is a value (1-32) player id.

Seta00 05-29-2010 10:14

Re: Getting error in server console
 
Quote:

Originally Posted by Effect (Post 1194307)
This ?:
PHP Code:

#define MAXCLASSES 4

new ZombieClass[33]

new const 
CLASSES[MAXCLASSES][] =
{
    
"Classic",
    
"Electric",
    
"Strong",
    
"Mystic"
}
enum
{
    
Classic 0,
    
Electric,
    
Strong,
    
Mystic



Quote:

Originally Posted by Bugsy (Post 1194290)
and where they are assigned values.


Exolent[jNr] 05-31-2010 02:16

Re: Getting error in server console
 
Show the full code.
The error will be near a line with set_task().

drekes 05-31-2010 08:31

Re: Getting error in server console
 
Quote:

Originally Posted by 'Exolent[jNr
The error will be near a line with set_task().

How do you know that when he didn't show a set_task yet? Tell me your secret :wink:

Effect 05-31-2010 12:52

Re: Getting error in server console
 
Here set_task:
PHP Code:

set_task(0.5"ShowHealth"id



All times are GMT -4. The time now is 05:23.

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