AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What wrong?? (https://forums.alliedmods.net/showthread.php?t=155918)

emperial159 04-28-2011 09:03

What wrong??
 
Code:

L 04/27/2011 - 16:21:45: [AMXX] Run time error 4: index out of bounds
What is wrong with this code???

PHP Code:

set_pev(randomplpev_gravitytank_gravity

Can somone help me?

Arkshine 04-28-2011 09:26

Re: What wrong??
 
Nothing wrong. Error is not on this line.

Show the full error.
Show more code.

emperial159 04-28-2011 09:44

Re: What wrong??
 
PHP Code:

public tank_reborn(iTaskID)
{
    if (
get_playersnum() < 1)
        return;

    
g_SpawnTanks &= ~( << ( ( iTaskID REBORN_TANK ) & 31 ) );

    new 
cName[32], randompliPlayers[32], iNum;

    
get_players(iPlayersiNum"ae""TERRORIST");
    
randompl iPlayers[random(iNum)];

    new 
Floattank_healthFloat:tank_gravity
    tank_health 
get_pcvar_float(hp_tank)
    
tank_gravity get_pcvar_float(gr_tank) / 800

    iClass
[randompl] = 9;
    
copy(player_model[randompl], charsmaxplayer_model[] ), tank_model)
    
set_pev(randomplpev_healthtank_health)
    
set_pev(randomplpev_gravitytank_gravity

Error sad on this line it's wrong where i wrote...

Code:

L 04/27/2011 - 16:21:45: [AMXX]    [0] uhhh.sma::global_tank (line 814)
L 04/27/2011 - 16:28:03: [AMXX] Displaying debug trace (plugin "uhhh.amxx")
L 04/27/2011 - 16:28:03: [AMXX] Run time error 4: index out of bounds


fysiks 04-28-2011 18:25

Re: What wrong??
 
You need to show the whole error and what a line number is in the code. You currently have part of two different errors.

Attaching the full code will make things much easier.

emperial159 04-29-2011 09:23

Re: What wrong??
 
PHP Code:

 get_players(iPlayersiNum"ae""TERRORIST"); 

Sry guys now it's this line error...


PHP Code:

 public global_tank()
{
    if (
get_playersnum() < 1)
        return;

    new 
cName[32], randompliPlayers[32], iNum;

    
get_players(iPlayersiNum"ae""TERRORIST");
    
randompl iPlayers[random(iNum)];

    new 
Floattank_healthFloat:tank_gravity
    tank_health 
get_pcvar_float(hp_tank)
    
tank_gravity get_pcvar_float(gr_tank) / 800

    iClass
[randompl] = 9;
    
copy(player_model[randompl], charsmaxplayer_model[] ), tank_model)
    
set_pev(randomplpev_healthtank_health)
    
set_pev(randomplpev_gravitytank_gravity)
    
bacon_give_weapon(randompl"weapon_knife")
    
set_pev(randomplpev_viewmodel2zombie_hands)
    
set_pev(randomplpev_weaponmodel2"")

    new 
currentmodel[32];
    
fm_get_user_model(randomplcurrentmodelsizeof currentmodel 1);
        
    if(!
equal(currentmodelplayer_model[randompl]))
    {
    
set_task(0.2"Task_Model"randompl TASKID_MODEL)
    }

    
get_user_name(randomplcName31);
    
set_hudmessage(150000.020.3000.02.02.01.0, -1);
    
show_hudmessage(0"Tank %s just spawned!!!"cName);



fysiks 04-29-2011 19:05

Re: What wrong??
 
Quote:

Originally Posted by fysiks (Post 1459798)
You need to show the whole error

from your error logs.

Quote:

Originally Posted by emperial159 (Post 1460080)
PHP Code:

 get_players(iPlayersiNum"ae""TERRORIST"); 

Sry guys now it's this line error...

There is no error on that line.

ProIcons 04-29-2011 20:37

Re: What wrong??
 
iClass[randompl]

Provide us iClass array's max characters
also change iPlayers[32] to iPlayers[33] just to be sure for this: randompl = iPlayers[random(iNum)];
also provide us the player_model[]'s max characters

also just to be sure again replace

Code:
fm_get_user_model(randompl, currentmodel, sizeof currentmodel - 1);
to
Code:
fm_get_user_model(randompl, currentmodel, charsmax( currentmodel ));

emperial159 04-30-2011 02:18

Re: What wrong??
 
PHP Code:

iClass[randompl] = 9

PHP Code:

    new randompliPlayers[32], iNum

when i do 33 error in compile sad array size do not match, or destination array is too small.

PHP Code:

new player_model[33][32

here...

With your code is okey ,but stilll error...

Any idea?


All times are GMT -4. The time now is 04:20.

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