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

Run time error 3: stack error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Flasher
Senior Member
Join Date: Apr 2008
Old 12-29-2008 , 01:34   Run time error 3: stack error
Reply With Quote #1

I has written AntiEGON plugin (http://forums.alliedmods.net/showthread.php?t=82626), it works fine, but sometimes log "Run time error 3: stack error". This error happens rarely (once a day for server with max 8 clients).
Tried many ways to solve this problem with no luck. Here is beta version of plugin, error log and debug log written by plugin.
From log you can see that function CurrentWeaponChanged is entered recursively. Doen't know why this can happen. Subscription on event CurWeapon is marked with "1=10", so it should happen only if weapon is EGON. And in function start I check if weapon is EGON. No reports about wrong weapon happens.
This is normal way it works:
Code:
L 12/29/2008 - 10:19:15: ver: 1.5.2b in:  client_command, 4072
L 12/29/2008 - 10:19:15: ver: 1.5.2b out: client_command, 4052
L 12/29/2008 - 10:19:16: ver: 1.5.2b in:  WeaponPicked, 4072
L 12/29/2008 - 10:19:16: ver: 1.5.2b out: WeaponPicked, 4072
L 12/29/2008 - 10:19:16: ver: 1.5.2b in:  CurrentWeaponChanged, 4072
L 12/29/2008 - 10:19:16: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 3, player id: 5, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:19:16: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:19:16: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:19:16: ver: 1.5.2b 3. player has weapon: 12
L 12/29/2008 - 10:19:16: ver: 1.5.2b out: CurrentWeaponChanged, 3800
L 12/29/2008 - 10:19:22: ver: 1.5.2b in:  client_putinserver, 4072
L 12/29/2008 - 10:19:22: ver: 1.5.2b out: client_putinserver, 4072
Adn this is when it enters CurrentWeaponChanged recursively:
Code:
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  client_command, 4072
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: client_command, 4052
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  WeaponPicked, 4072
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: WeaponPicked, 4072
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 4072
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 3764
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 3456
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 3148
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 2840
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 2532
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 2224
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 1916
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 1608
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 1300
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 992
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 684
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 376
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. isHaveWeapon: 1, weapon num: 2, player id: 7, prev weapon id: 2, prev weapon name: weapon_9mmhandgun
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 1
L 12/29/2008 - 10:21:22: ver: 1.5.2b 3. player has weapon: 2
L 12/29/2008 - 10:21:22: ver: 1.5.2b in:  CurrentWeaponChanged, 68
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 104
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 412
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 720
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 1028
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 1336
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 1644
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 1952
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 2260
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 2568
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 2876
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 3184
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 3492
L 12/29/2008 - 10:21:22: ver: 1.5.2b out: CurrentWeaponChanged, 3800
L 12/29/2008 - 10:21:23: ver: 1.5.2b in:  client_command, 4072
L 12/29/2008 - 10:21:23: ver: 1.5.2b out: client_command, 4052
Command issued (thru engclient_cmd) in both ways is "weapon_9mmhandgun". So I doesn't know why it sometimes enters CurrentWeaponChanged again.
Attached Files
File Type: zip 1.5.2b log.zip (1.3 KB, 116 views)

Last edited by Flasher; 02-14-2009 at 01:15. Reason: Beta plugin source removal. PM if needed.
Flasher is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-29-2008 , 01:49   Re: Run time error 3: stack error
Reply With Quote #2

For starters:

Code:
log_to_file("antiegon.log", "ver: %s Bad weapon received: %i", weapon);

This will give you a parameter error.

I don't know the problem but try removing this for now:

Code:
engclient_cmd(plrid, weapname);

Of course you'll have to add it back eventually, but that's the only thing I can see that could cause any sort of recursion.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Flasher
Senior Member
Join Date: Apr 2008
Old 12-29-2008 , 01:58   Re: Run time error 3: stack error
Reply With Quote #3

Quote:
Originally Posted by Hawk552 View Post
For starters:

Code:
log_to_file("antiegon.log", "ver: %s Bad weapon received: %i", weapon);

This will give you a parameter error.
Thanks. As offten this is an copy paste error . I hope if function enters this line I any way would have error reporting.
Quote:
Originally Posted by Hawk552 View Post
I don't know the problem but try removing this for now:

Code:
engclient_cmd(plrid, weapname);

Of course you'll have to add it back eventually, but that's the only thing I can see that could cause any sort of recursion.
This is the main call in function without it this plugin is for nothing.
And sorry I doesn't write - mentioned error happens rarely (once a day for server with max 8 clients). I doesn't know how to reproduce error. If I remove this call error will definetely disappear, because this call lead to recurcive.
Flasher is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-29-2008 , 03:00   Re: Run time error 3: stack error
Reply With Quote #4

You could try running the command "lastinv" and let the engine do all the work for you including checks.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Flasher
Senior Member
Join Date: Apr 2008
Old 12-29-2008 , 04:10   Re: Run time error 3: stack error
Reply With Quote #5

Quote:
Originally Posted by Hawk552 View Post
You could try running the command "lastinv" and let the engine do all the work for you including checks.
I pass this thru. If player issue drop command and player has EGON it is select as most destructive weapon. And "lastinv" do nothing in this case because player dropped weapon.

I can add the check if function is called recursive. But it will be better to solve the source of the problem.

Last edited by Flasher; 12-29-2008 at 04:24.
Flasher is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 12-29-2008 , 14:46   Re: Run time error 3: stack error
Reply With Quote #6

If you're trying to make sure they don't use the EGON, why don't you just gather all their weapons every time they pick one up, then if the EGON is one of them, make them switch to it and drop it. If it's the only one, give them another weapon (like a crowbar) then make them drop it.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Flasher
Senior Member
Join Date: Apr 2008
Old 12-29-2008 , 15:09   Re: Run time error 3: stack error
Reply With Quote #7

I tried with drop - looks funny - you are moving to EGON it is picked up then dropped before you. You moving to it, picks it up and again it dropped.
And if drop then I have to give atomic ammo (or how they are named) to player to compensate.
Main idea was: if player picks up EGON it should get ammo for gauss gun (the same ammo as for EGON). And the player can't use, select or even see that he has EGON.
This is all done with this simple plugin, but sometimes it behave wrong.

If I would tried to go aonther way it will be this: if user pickup EGON, then strip weapon from player completely (drop and remove), then give ammo that he loose. When EGON is dropped, ammo in weapon box is near half of player has (i.e. not constant). So as you can see this is not easy way. May be some day I will have time to do this. But I think that may be it will be easier to solve problem with current plugin.
Yes, I understand that this will draw you time or anyone that will try to help. But may be this bug is not within plugin, but within AMXX or Metamod and we can find and fix it? I doesn't know. I am not well know AMXX and HL engine to decide.

Thanks for helping!
Flasher 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 01:15.


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