Raised This Month: $ Target: $400
 0% 

Unknow misterious stack error...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-21-2014 , 15:04   Unknow misterious stack error...
Reply With Quote #1

Hey, guys... I have been wondering for lot of time about this, but I couldn't find the reason. The problem is one goddamn annoying stack error (run time error 3). The code:
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>

#define PLUGIN "Admin Extras"
#define VERSION "1.0"
#define AUTHOR "Flicker"

#define ACCESS ADMIN_RCON

new g_msgMoneyg_hookMoneyMsg
new g_iNewUserMoney

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""onDeathMsgEvent""a")
    
    
g_msgMoney get_user_msgid("Money")
}

public 
onDeathMsgEvent()
{
    new 
atk read_data(1)
    new 
hs read_data(3)
    
    
set_user_health(atkclamp(get_user_health(atk) + hs 30 150150))
    
    
set_user_armor(atkclamp(get_user_armor(atk) + hs 20 100200))
    
    
give_item(atk"weapon_hegrenade")
    
cs_set_user_bpammo(atkCSW_HEGRENADEhs 1)
    
    
    
g_iNewUserMoney clamp(cs_get_user_money(atk) + hs 500 300016000)
    
g_hookMoneyMsg register_message(g_msgMoney"onMoneyMessage")
}

public 
onMoneyMessage(msgidmsgdestid)
{
    
unregister_message(g_msgMoneyg_hookMoneyMsg)
    
set_pdata_int(id115g_iNewUserMoney5)
    
set_msg_arg_int(1ARG_LONGg_iNewUserMoney)

Really, no lines, nothing. Just
Code:
L 07/21/2014 - 22:01:24: Start of error session.
L 07/21/2014 - 22:01:24: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20140721.log")
L 07/21/2014 - 22:01:24: [AMXX] Displaying debug trace (plugin "AdminExtras.amxx")
L 07/21/2014 - 22:01:24: [AMXX] Run time error 3: stack error
and server dies..
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 07-21-2014 , 15:33   Re: Unknow misterious stack error...
Reply With Quote #2

Why are you setting player money in such way? Just use cs_set_user_money(), there is nothing wrong with it. All that "Money" message stuff is unnecessary. Not sure, but that may be causing crashes.
And you should use min() instead of clamp() in this situation, it is more suitable.
klippy is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 07-21-2014 , 15:45   Re: Unknow misterious stack error...
Reply With Quote #3

I agree with KliPPy

Also, you are not checking if attacker is a valid player
__________________
Hey ^_^
NikKOo31 is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-21-2014 , 16:27   Re: Unknow misterious stack error...
Reply With Quote #4

Well, firstly (of course) I tried with cs_set_user_money. But, the money HUD is f*ckin up and shows some random values?! And I kindly saw this (and stole it) from Exolent (Kill Money plugin). That's all.
Btw, it was about to remove the original giving of money on kill, that's why I used that way.
EDIT: Btw (again), this code is now overflowing me
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <fun>

#define PLUGIN "Admin Extras"
#define VERSION "1.0"
#define AUTHOR "Flicker"

#define ACCESS ADMIN_RCON

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("DeathMsg""onDeathMsgEvent""a")
}

public 
onDeathMsgEvent()
{
    new 
atk read_data(1)
    new 
hs read_data(3)
    
    if(!(
get_user_flags(atk) & ACCESS) || !is_user_connected(atk) || atk == read_data(2))
        return 
PLUGIN_HANDLED
    
    set_user_health
(atkclamp(get_user_health(atk) + hs 30 150150))
    
    
set_user_armor(atkclamp(get_user_armor(atk) + hs 20 100200))
    
    
give_item(atk"weapon_hegrenade")
    
cs_set_user_bpammo(atkCSW_HEGRENADEhs 1)
    
    
cs_set_user_money(atkclamp(cs_get_user_money(atk) + hs 500 300016000))
    
    return 
PLUGIN_CONTINUE

__________________

Last edited by Flick3rR; 07-21-2014 at 17:22.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
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 12:03.


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