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

Solved [AMXX] Run time error 3: stack error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 10-25-2022 , 02:59   [AMXX] Run time error 3: stack error
Reply With Quote #1

Hi, can someone explain me why do i get overflow and stack error?

PHP Code:
[AMXXDisplaying debug trace (plugin "xmas_base.amxx"version "1.0")
L 10/25/2022 06:43:52: [AMXXRun time error 3stack error 
n3v3r
# overflowed
WARNINGreliable overflow on n3v3r#
Dropped n3v3r# from server
Reason:  Reliable channel overflowed
Netchan_Clear
reliable length not 0reliable_sequence255incoming_reliable_acknowledged1
Creating bot
...
L 10/25/2022 06:43:53: [AMXXDisplaying debug trace (plugin "xmas_base.amxx"version "1.0")
L 10/25/2022 06:43:53: [AMXXRun time error 3stack error // i didn't find any solution for this
L 10/25/2022 06:43:53: [AMXXDisplaying debug trace (plugin "xmas_base.amxx"version "1.0")
L 10/25/2022 06:43:53: [AMXXRun time error 3stack error 
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <nvault>
#include <fakemeta_util>
#include <engine>
#include <fun>
#include <hamsandwich>

//#pragma dynamic 32768

#define CHAT_TAG "^3[HoHoHo!]^1" // chat tag
#define IsPlayer(%0)    (1 <= %0 <= MAX_PLAYERS + 1)
#define MAX_LEVELS 7

enum (+= 100)
{
    
TASK_SHOW_HUD 900,
    
TASK_RESPAWN_BOT
}

enum LevelsData
{
    
LevelName[MAX_FMT_LENGTH],
    
LevelReqKills,
    
LevelRankUPBonus
}
new const 
g_level_data[MAX_LEVELS][LevelsData] =
{    
    {
"NewBie"00},
    {
"Level I"10100},
    {
"Level II"30250},
    {
"Level III"60400},
    {
"Level IV"100550},
    {
"Level V"150700},
    {
"-"9999999999990}
}

new 
g_player_models[][] =
{
    
"monster"
}

new 
g_nVault
new const g_nVaultFileName[] = "xmas_2022_ultimate"
new g_iLevel[MAX_PLAYERS 1], g_iSnowFlakes[MAX_PLAYERS 1], g_iKills[MAX_PLAYERS 1]
new 
g_name[MAX_PLAYERS 1][MAX_NAME_LENGTH]
new 
g_SyncMessage


public plugin_init()
{
    
register_plugin("[XMAS-CORE] Base""1.0""n3v3r#")

    
RegisterHam(Ham_Spawn"player""event_player_spawn"1)
    
register_event("DeathMsg""event_deathmessage""a")

    
_init_vault()
    
g_SyncMessage CreateHudSyncObj()
}

public 
_init_vault()
{
    
g_nVault nvault_open(g_nVaultFileName)

    if(
g_nVault == INVALID_HANDLE)
        
set_fail_state("[nVault] Error opening vault ^"%s^" !"g_nVaultFileName)
}

public 
plugin_end()
{
    new 
iPlayers[MAX_PLAYERS], iNum
    get_players
(iPlayersiNum"ch")

    for(new 
iiNumi++)
    {
        
SaveData(iPlayers[i])
    }

    
_init_vault()
}

public 
plugin_precache()
{
    new 
path[MAX_RESOURCE_PATH_LENGTH]
    for(new 
isizeof g_player_modelsi++)
    {
        
formatex(pathMAX_RESOURCE_PATH_LENGTH 1"models/player/%s/%s.mdl"g_player_models[i], g_player_models[i])
        
precache_model(path)
    }

}

public 
client_putinserver(id)
{
    
get_user_name(idg_name[id], charsmax(g_name[]))
    
LoadData(id)
}

public 
client_authorized(id)
{
    if(!
is_real_player(id))
    {
        return 
PLUGIN_HANDLED
    
}

    
LoadData(id)

    return 
PLUGIN_CONTINUE
}

public 
client_infochanged(id)
{
    if(!
is_real_player(id))
    {
        return 
PLUGIN_HANDLED
    
}

    
LoadData(id)

    return 
PLUGIN_CONTINUE
}

public 
client_disconnected(id)
{
    
SaveData(id)
}

public 
event_player_spawn(id)
{
    if(!
is_user_alive(id))
    {
        return 
HAM_IGNORED
    
}

    if(!
g_iKills[id])
    {
        
g_iKills[id] = 0
    
}

    if(!
g_iLevel[id])
    {
        
g_iLevel[id] = 0
    
}

    if(!
g_iSnowFlakes[id])
    {
        
g_iSnowFlakes[id] = 0
    
}

    if(
is_user_bot(id))
    {
        
cs_set_user_model(idg_player_models[0], true)
        
ExecuteHamB(Ham_CS_RoundRespawnid)
        
set_pev(idpev_health10000.0)
    }

    
set_task(0.1"show_hud"TASK_SHOW_HUD id__"b")

    return 
HAM_IGNORED
}

public 
event_deathmessage()
{
    if(
read_data(1) == read_data(2) || !is_user_alive(read_data(1)))
    {
        return 
    }

    
g_iKills[read_data(1)]++
    
g_iSnowFlakes[read_data(1)] += 200

    
if(is_user_bot(read_data(2)))
    {
        
set_task(1.0"func_respawn_bot"TASK_RESPAWN_BOT read_data(2))
    }

    if(
g_iLevel[read_data(1)] < MAX_LEVELS)
    {
        while(
g_iKills[read_data(1)] >= g_level_data[g_iLevel[read_data(1)]][LevelReqKills])
        {
            
g_iLevel[read_data(1)]++
            
g_iSnowFlakes[read_data(1)] += g_level_data[g_iLevel[read_data(1)]][LevelRankUPBonus]
            
client_print_color(0print_team_default"%s %s reached level ^3%d^1(^3%s^1) and got ^3%d^1 bonus SnowFlakes !"CHAT_TAGg_name[read_data(1)], g_iLevel[read_data(1)], g_level_data[g_iLevel[read_data(1)]][LevelName], g_level_data[g_iLevel[read_data(1)]][LevelRankUPBonus])
        }
    }
}


public 
func_respawn_bot(bot)
{
    
bot -= TASK_RESPAWN_BOT

    
if(!is_user_connected(bot))
    {
        return
    }
    
cs_set_user_team(botCS_TEAM_T)
    
ExecuteHamB(Ham_CS_RoundRespawnbot)
    
set_pev(botpev_health10000.0)
}

public 
show_hud(id)
{
    
id -= TASK_SHOW_HUD

    
if(is_user_alive(id))
    {
        
set_hudmessage(random(255), random(255), random(255), 0.02, -0.206.01.1)
        
ShowSyncHudMsg(idg_SyncMessage"[Level %d (%s)]^n[Kills %d]^n[SnowFlakes %d]"g_iLevel[id], g_level_data[g_iLevel[id]][LevelName], g_iKills[id], g_iSnowFlakes[id])
    }
    
}

SaveData(id)
{
    
_init_vault()

    new 
szData[256]
    
formatex(szDatacharsmax(szData), "%i#%i#%i#"g_iLevel[id], g_iKills[id], g_iSnowFlakes[id])

    
nvault_set(g_nVaultg_name[id], szData)
}

LoadData(id)
{
    
_init_vault()

    new 
szData[256]
    
formatex(szDatacharsmax(szData), "%i#%i#%i#"g_iLevel[id], g_iKills[id], g_iSnowFlakes[id])

    
nvault_get(g_nVaultg_name[id], szDatacharsmax(szData))
    
replace_all(szDatacharsmax(szData), "#"" ")

    new 
level[32], kills[32], snowflakes[32]
    
parse(szDatalevelcharsmax(level), killscharsmax(kills), snowflakescharsmax(snowflakes))

    
g_iLevel[id] = str_to_num(level)
    
g_iKills[id] = str_to_num(kills)
    
g_iSnowFlakes[id] = str_to_num(snowflakes)
}


stock bool:is_real_player(id)    return ((is_user_bot(id) || is_user_hltv(id)) ? false true)

stock func_fade(idholdtimergba)
{
   
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("ScreenFade"), _id)
   
write_short(math(holdtime))
   
write_short(math(holdtime))
   
write_short(0)
   
write_byte(r)
   
write_byte(g)
   
write_byte(b)
   
write_byte(a)
   
message_end()
}

stock math(time)
{
   return((
<< 12) * (time))


Last edited by N3v3rM1nd; 10-25-2022 at 06:00.
N3v3rM1nd is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-25-2022 , 05:08   Re: [AMXX] Run time error 3: stack error
Reply With Quote #2

I have 3 guesses and those are:
1. You respawn the bot while he's spawning
Code:
if(is_user_bot(id))
{
	cs_set_user_model(id, g_player_models[0], true)
	ExecuteHamB(Ham_CS_RoundRespawn, id)
	set_pev(id, pev_health, 10000.0)
}
2. You initialize the vault every time you save or load data and never close the vault
Code:
public _init_vault()
{
	g_nVault = nvault_open(g_nVaultFileName)

	if(g_nVault == INVALID_HANDLE)
		set_fail_state("[nVault] Error opening vault ^"%s^" !", g_nVaultFileName)
}

SaveData(id)
{
	_init_vault()

	new szData[256]
	formatex(szData, charsmax(szData), "%i#%i#%i#", g_iLevel[id], g_iKills[id], g_iSnowFlakes[id])

	nvault_set(g_nVault, g_name[id], szData)
}

LoadData(id)
{
	_init_vault()

	new szData[256]
	formatex(szData, charsmax(szData), "%i#%i#%i#", g_iLevel[id], g_iKills[id], g_iSnowFlakes[id])

	nvault_get(g_nVault, g_name[id], szData, charsmax(szData))
	replace_all(szData, charsmax(szData), "#", " ")

	new level[32], kills[32], snowflakes[32]
	parse(szData, level, charsmax(level), kills, charsmax(kills), snowflakes, charsmax(snowflakes))

	g_iLevel[id] = str_to_num(level)
	g_iKills[id] = str_to_num(kills)
	g_iSnowFlakes[id] = str_to_num(snowflakes)
}
3. You use set_task every player spawn but not end it (not sure it might be a problem or not)
Code:
public event_player_spawn(id)
{
	if(!is_user_alive(id))
	{
		return HAM_IGNORED
	}

	if(!g_iKills[id])
	{
		g_iKills[id] = 0
	}

	if(!g_iLevel[id])
	{
		g_iLevel[id] = 0
	}

	if(!g_iSnowFlakes[id])
	{
		g_iSnowFlakes[id] = 0
	}

	if(is_user_bot(id))
	{
		cs_set_user_model(id, g_player_models[0], true)
		ExecuteHamB(Ham_CS_RoundRespawn, id)
		set_pev(id, pev_health, 10000.0)
	}

	set_task(0.1, "show_hud", TASK_SHOW_HUD + id, _, _, "b")

	return HAM_IGNORED
}

Last edited by AnimalMonster; 10-25-2022 at 05:17.
AnimalMonster is offline
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 10-25-2022 , 05:12   Re: [AMXX] Run time error 3: stack error
Reply With Quote #3

lol.. im really dizzy, thanks
N3v3rM1nd is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-25-2022 , 05:27   Re: [AMXX] Run time error 3: stack error
Reply With Quote #4

If it is solved please mark it as solved so any other member can solve problems similar to this one

Last edited by AnimalMonster; 10-25-2022 at 05:35.
AnimalMonster is offline
zXCaptainXz
Member
Join Date: May 2017
Old 10-25-2022 , 05:31   Re: [AMXX] Run time error 3: stack error
Reply With Quote #5

I'm dizzy as well to be perfectly honest, 2 questions:
- When is the error happening exactly?
- How many snowflakes do you have?
zXCaptainXz is offline
N3v3rM1nd
Junior Member
Join Date: Apr 2021
Old 10-25-2022 , 05:37   Re: [AMXX] Run time error 3: stack error
Reply With Quote #6

Quote:
Originally Posted by zXCaptainXz View Post
I'm dizzy as well to be perfectly honest, 2 questions:
- When is the error happening exactly?
- How many snowflakes do you have?
Errors happened when i start the server
not the value of integers was the problem, the bot re-respawning in the ham_spawn was the problem here
N3v3rM1nd is offline
AnimalMonster
Senior Member
Join Date: May 2020
Old 10-25-2022 , 05:38   Re: [AMXX] Run time error 3: stack error
Reply With Quote #7

Quote:
Originally Posted by N3v3rM1nd View Post
Errors happened when i start the server
not the value of integers was the problem, the bot re-respawning in the ham_spawn was the problem here
I think it's the second guess from the ones i listed above.

Let the init_vault be only in plugin_init
AnimalMonster 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 09:56.


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