AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Small code needs fixing. (https://forums.alliedmods.net/showthread.php?t=184248)

iBrazilian 05-02-2012 17:07

Small code needs fixing.
 
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;



Exolent[jNr] 05-02-2012 17:08

Re: Small code needs fixing.
 
PHP Code:

random_num(1,3

:arrow:
PHP Code:

random(3


iBrazilian 05-02-2012 17:32

Re: Small code needs fixing.
 
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?

Exolent[jNr] 05-02-2012 17:36

Re: Small code needs fixing.
 
random(x) = random_num(0, x - 1)

Your random range in this case was just wrong. You needed 0 - 2, not 1 - 3.

iBrazilian 05-02-2012 17:45

Re: Small code needs fixing.
 
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 



All times are GMT -4. The time now is 00:29.

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