AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [AMXX] Run time error 3: stack error (https://forums.alliedmods.net/showthread.php?t=318486)

skatz_ws 09-02-2019 13:02

[AMXX] Run time error 3: stack error
 
Can someone help me? I already searched for this but I didnt find a solution for my problem.

Error log:
PHP Code:

L 09/02/2019 17:55:44: [AMXXDisplaying debug trace (plugin "skz_ejail.amxx")
L 09/02/2019 17:55:44: [AMXXRun time error 3stack error 
L 09
/02/2019 17:55:44: [AMXXDisplaying debug trace (plugin "skz_ejail.amxx")
L 09/02/2019 17:55:44: [AMXXRun time error 3stack error 
L 09
/02/2019 17:55:44: [AMXXDisplaying debug trace (plugin "skz_ejail.amxx")
L 09/02/2019 17:55:44: [AMXXRun time error 3stack error 
L 09
/02/2019 17:55:44: [AMXX]    [0skz_ejail.sma::_inicioronda (line 1057

Code on that line:
PHP Code:

new players[32], pnum
    get_players
(playerspnum"ch")
    
    if (
pnum 5)
    {
        
ColorChat (0GREY"^01[^04eJail^01] ^03O ^04ranking eJails^03 inicia com^04 5 ou mais jogadores ^03dentro do servidor (%i/5)",pnum)
        
skStats false 
    



OciXCrom 09-02-2019 15:11

Re: [AMXX] Run time error 3: stack error
 
Show. Full. Code.

skatz_ws 09-02-2019 15:25

Re: [AMXX] Run time error 3: stack error
 
Quote:

Originally Posted by OciXCrom (Post 2665640)
Show. Full. Code.

Why? The error is on that line

HamletEagle 09-02-2019 16:37

Re: [AMXX] Run time error 3: stack error
 
Quote:

Originally Posted by skatz_ws (Post 2665642)
Why? The error is on that line

I don't see it.
Show full code or at least the entire function.

skatz_ws 09-03-2019 06:00

Re: [AMXX] Run time error 3: stack error
 
I hook the roundstart on plugin init

PHP Code:

register_event        "HLTV",         "_inicioronda""a","1=0","2=0"    ); 

Complete function:

PHP Code:

public _inicioronda()
{
    new 
iEntity;
    
    while( ( 
iEntity find_ent_by_classiEntity"func_button" ) ) > call_thinkiEntity );
    
    new 
players[32], pnum
    get_players
(playerspnum"ch")
    if (
pnum 5)
    {
        
ColorChat (0GREY"^01[^04eJail^01] ^03O ^04ranking eJails^03 inicia com^04 5 ou mais jogadores ^03dentro do servidor (%i/5)",pnum)
        
skStats false 
    
}
    else 
skStats true
    
    set_task 
(1.0,    "_escolha",             TASK_ESCOLHER_REI);
    
set_task (59.0,    "_microfonesupervip",     TASK_MICROFONE);
    
set_task (179.0"_avisoconduta",         TASK_CONDUTA);
    
set_task (419.0"_acabardia",             TASK_DIA);


The error is always pointed to "new players[32], pnum" line


EDIT: I found a guy with the same error: https://forums.alliedmods.net/showthread.php?t=258465
And he uses #pragma dynamic just like me. Can it possibily be the error?

HamletEagle 09-03-2019 06:51

Re: [AMXX] Run time error 3: stack error
 
stack error means you filled the entire stack(the place where variables are stored). pragma dynamic allows to change the amount of space allocated for the stack so if you put a small number there, then yes: it could be the reason.

skatz_ws 09-03-2019 07:01

Re: [AMXX] Run time error 3: stack error
 
Stack/heap size: 131072 bytes; max. usage is unknown, due to recursion

#pragma dynamic 32768

I have to put more?

And yes, I have a lot of variables inside the plugin

iceeedr 09-03-2019 09:11

Re: [AMXX] Run time error 3: stack error
 
Just a shot, I'm tired and couldn't test.

HTML Code:

public _inicioronda()
{
    new iEntity = -1;
   
    while( ( iEntity = find_ent_by_class( iEntity, "func_button" ) ) != 0 ) call_think( iEntity );
   
    new players[32], pnum
    get_players(players, pnum, "ch")
    if (pnum < 5)
    {
        ColorChat (0, GREY, "^01[^04eJail^01] ^03O ^04ranking eJails^03 inicia com^04 5 ou mais jogadores ^03dentro do servidor (%i/5)",pnum)
        skStats = false
        break

    }
    else skStats = true
   
    set_task (1.0,    "_escolha",            TASK_ESCOLHER_REI);
    set_task (59.0,    "_microfonesupervip",    TASK_MICROFONE);
    set_task (179.0, "_avisoconduta",        TASK_CONDUTA);
    set_task (419.0, "_acabardia",            TASK_DIA);
}


Natsheh 09-03-2019 12:11

Re: [AMXX] Run time error 3: stack error
 
Can you also show call_think

edon1337 09-03-2019 12:16

Re: [AMXX] Run time error 3: stack error
 
Quote:

Originally Posted by Natsheh (Post 2665713)
Can you also show call_think

https://www.amxmodx.org/api/engine/call_think


All times are GMT -4. The time now is 17:28.

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