Raised This Month: $ Target: $400
 0% 

Small code needs fixing.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iBrazilian
Senior Member
Join Date: May 2011
Old 05-02-2012 , 17:07   Small code needs fixing.
Reply With Quote #1

L 05/02/2012 - 16:02:06: [AMXX] Displaying debug trace (plugin "pokemod.amxx")
L 05/02/2012 - 16:02:06: [AMXX] Run time error 4: index out of bounds
L 05/02/2012 - 16:02:06: [AMXX] [0] pokeskills.inl::Triple_Team (line 2620)

PHP Code:
public Triple_Team(idksillprop)
    {
    new 
aidteled
    new 
players[MAX_PLAYERS], pnum
    
new f_origin[3];
    
pev(idpev_originf_origin)
    
f_origin[2] += 5
    poke_get_players
(playerspnumPLAYER_ALIVE|PLAYER_MORTAL)
    for(new 
ii<pnumi++)
        {
        
aid players[i]
        if(
get_user_team(id) == get_user_team(aid) && teled 3)
            {
            
f_origin[random_num(1,3)] += 10*teled // LINE ERROR HERE
            
set_pev(aidpev_origin,f_origin)
            
poke_UnStuck(aid)
            
teled++;
        }
    }
    if(
teled)
        return 
SKILL_USED;
    return 
SKILL_READY;

__________________
Pokemod Season 5 [ |||||||||| Complete]
iBrazilian is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-02-2012 , 17:08   Re: Small code needs fixing.
Reply With Quote #2

PHP Code:
random_num(1,3

PHP Code:
random(3
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
iBrazilian
Senior Member
Join Date: May 2011
Old 05-02-2012 , 17:32   Re: Small code needs fixing.
Reply With Quote #3

I run pokemod, I have many skills with ramdom_num, can they all be changed into ramdom(x) instead of ramdom_num(x)?

And thank you for the support.

Also, it has about 549 skills with Public functions, is there any other way that I can make it call without being Public functions?
__________________
Pokemod Season 5 [ |||||||||| Complete]

Last edited by iBrazilian; 05-02-2012 at 17:36.
iBrazilian is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-02-2012 , 17:36   Re: Small code needs fixing.
Reply With Quote #4

random(x) = random_num(0, x - 1)

Your random range in this case was just wrong. You needed 0 - 2, not 1 - 3.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
iBrazilian
Senior Member
Join Date: May 2011
Old 05-02-2012 , 17:45   Re: Small code needs fixing.
Reply With Quote #5

I understand, also I asked above too..

PHP Code:
Alsoit has about 549 skills with Public functionsis there any other  way that I can make it call without being Public functionsIt seems to crash my server since It's calling so many 
__________________
Pokemod Season 5 [ |||||||||| Complete]

Last edited by iBrazilian; 05-02-2012 at 17:48.
iBrazilian 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 00:29.


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