Raised This Month: $ Target: $400
 0% 

Attempting to fix Raptor Mod-Index Out of Bounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 03-14-2009 , 11:19   Attempting to fix Raptor Mod-Index Out of Bounds
Reply With Quote #1

Code causing errors:
PHP Code:
new raptorreallife get_user_health(id);
        new 
raptorinvis = ((raptorreallife*100)/(raptorlife));
        
set_hudmessage(25525500.020.8706.01.0)
        
show_hudmessage(id"Invisibility:%d/100^n Health: %d"raptorinvisraptorreallife)
        
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha, (raptorinvisi-(raptorinvis*2))) 
Log:
Quote:
L 03/04/2009 - 17:507: [AMXX] Displaying debug trace (plugin "revoraptor5.amxx")
L 03/04/2009 - 17:507: [AMXX] Run time error 11: divide
L 03/04/2009 - 17:507: [AMXX] [0] revoraptor5.sma::client_PreThink (line 444)
Anyone know how to fix it? I've got everything else fixed and running so far but this.



New Issue:


Okay, after some more debugging I've discovered another issue.

PHP Code:
    if(israptor[attacker]!=&& attacker!=id && is_user_alive(attacker)){
        new 
victimhealth get_user_health(id)
        
set_user_health(idvictimhealth-raptordomage)
        new 
Float:vVel[3]
        for(new 
0;<= 2;i++)
        
vVel[i] = random_float(-10.0,10.0)            
        
entity_set_vector(id,EV_VEC_punchangle,vVel)
        
pain(id)
    } 
Error Log:

Quote:
L 03/15/2009 - 15:12:20: [AMXX] Displaying debug trace (plugin "revoraptor5.amxx")
L 03/15/2009 - 15:12:20: [AMXX] Run time error 4: index out of bounds
L 03/15/2009 - 15:12:20: [AMXX] [0] revoraptor5.sma::damaging (line 340)
Much appreciated if someone could help me out with this issue. I've just finished fixing the gun menu and this came up so I'm not quite sure on how to fix it.

Last edited by fang; 03-15-2009 at 21:25. Reason: new error discovered
fang is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-14-2009 , 11:22   Re: Attempting to fix Raptor Mod, Getting 'Divide' Error.
Reply With Quote #2

I don't know what is this 'raptorlife' var, may be you could link to the plugin.
Anyway you can try to replace :

new raptorinvis = ((raptorreallife*100)/(raptorlife));

with

new raptorinvis = ((raptorreallife*100)/( max(1, raptorlife) ));

This would avoid dividing by 0
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 03-14-2009 , 11:26   Re: Attempting to fix Raptor Mod, Getting 'Divide' Error.
Reply With Quote #3

Original plugin:
http://forums.alliedmods.net/showthr...ght=raptor+mod

I'll give your fix a shot and post back if it's still giving me errors. Thanks for the help so far
fang is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-14-2009 , 20:12   Re: Attempting to fix Raptor Mod, Getting 'Divide' Error.
Reply With Quote #4

lol this is a buggy plugin, but if u can fix this, please give me the sma. i have this running on ma server.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Old 03-14-2009, 20:50
fang
This message has been deleted by fang.
Old 03-15-2009, 18:03
fang
This message has been deleted by fang.
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 03-15-2009 , 18:39   Re: Attempting to fix Raptor Mod, New Error after fixing 'Divide'.
Reply With Quote #5

One:
Uhm.. Let's just say it's 'running' but it's not.. quite the same anymore. I've changed quite a lot of things.

And Connor your fix worked perfectly. The only issue is another error has come up. I've edited the main post with the error'd code and debug log.
fang is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 03-15-2009 , 19:33   Re: Attempting to fix Raptor Mod, New Error after fixing 'Divide'.
Reply With Quote #6

hmmm
Offtopic : would u release the code or not? i mean after this is finished?i tried 1 time to fix this but i found there only bugs & i tried 2 4get it.
http://forums.alliedmods.net/showthread.php?t=85503 << first i had problems with the model & after this comes more & more & more bugs
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 03-15-2009 , 20:30   Re: Attempting to fix Raptor Mod, New Error after fixing 'Divide'.
Reply With Quote #7

Well I'm working one step at a time. Debug and then decide what to do with it after it's completed. For now I don't plan on releasing it due to it not being close to the finished product of what I plan it to be.
fang is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-16-2009 , 02:35   Re: Attempting to fix Raptor Mod-Index Out of Bounds
Reply With Quote #8

PHP Code:
    static maxplayer
    
if( !maxplayer maxplayer get_maxplayers()    
    if( (
1<=attacker<=maxplayer) && israptor[attacker]!=&& attacker!=id && is_user_alive(attacker)){
        new 
damage
        
new victimhealth get_user_health(id)
        
damage read_data(2)
        
set_user_health(idvictimhealth-raptordomage)
        new 
Float:vVel[3]
        for(new 
0;<= 2;i++)
        
vVel[i] = random_float(-10.0,10.0)            
        
entity_set_vector(id,EV_VEC_punchangle,vVel)
        
pain(id)
    } 
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
fang
Senior Member
Join Date: Nov 2007
Location: New Jersey
Old 03-16-2009 , 14:46   Re: Attempting to fix Raptor Mod-Index Out of Bounds
Reply With Quote #9

Thanks connor! I'll test it asap.
fang 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 20:04.


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