Raised This Month: $51 Target: $400
 12% 

[AMXX] Run time error 3: stack error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-02-2019 , 13:02   [AMXX] Run time error 3: stack error
Reply With Quote #1

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 
    

skatz_ws is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-02-2019 , 15:11   Re: [AMXX] Run time error 3: stack error
Reply With Quote #2

Show. Full. Code.
__________________

Last edited by OciXCrom; 09-02-2019 at 15:11.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-02-2019 , 15:25   Re: [AMXX] Run time error 3: stack error
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
Show. Full. Code.
Why? The error is on that line
skatz_ws is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-02-2019 , 16:37   Re: [AMXX] Run time error 3: stack error
Reply With Quote #4

Quote:
Originally Posted by skatz_ws View Post
Why? The error is on that line
I don't see it.
Show full code or at least the entire function.
__________________
HamletEagle is offline
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-03-2019 , 06:00   Re: [AMXX] Run time error 3: stack error
Reply With Quote #5

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?

Last edited by skatz_ws; 09-03-2019 at 06:05.
skatz_ws is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-03-2019 , 06:51   Re: [AMXX] Run time error 3: stack error
Reply With Quote #6

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.
__________________
HamletEagle is offline
skatz_ws
Junior Member
Join Date: Aug 2019
Old 09-03-2019 , 07:01   Re: [AMXX] Run time error 3: stack error
Reply With Quote #7

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

Last edited by skatz_ws; 09-03-2019 at 07:02.
skatz_ws is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-03-2019 , 12:44   Re: [AMXX] Run time error 3: stack error
Reply With Quote #8

Quote:
Originally Posted by skatz_ws View Post
And yes, I have a lot of variables inside the plugin
That's not how it works. Variables do not live all the time, space is allocated when entering a function and the stack is cleaned when the function exits.

If you want help, post full code and double check you gave the right error log.
__________________
HamletEagle is offline
Old 09-03-2019, 13:07
edon1337
This message has been deleted by edon1337.
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 09-04-2019 , 04:17   Re: [AMXX] Run time error 3: stack error
Reply With Quote #10

Quote:
Originally Posted by edon1337 View Post
Unless static/global, which are most likely the cause.
Those don't live on the stack and won't cause a stack error.
__________________
klippy 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 03:17.


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