Raised This Month: $32 Target: $400
 8% 

Module: Cvar Utilities (v1.6)


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2012 , 08:08   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #91

Does it happen too if you use directly server console ?
__________________
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-30-2012 , 08:14   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #92

Seems not, the amx_cvar command ruins it.

Server console output:
Code:
amx_immunity 1
Debug(): 0 -> 1
amx_immunity 0
Debug(): 1 -> 0
amx_immunity 1
Debug(): 0 -> 1
amx_immunity 0
Debug(): 1 -> 0
Server console output with amx_cvar
Code:
L 08/30/2012 - 15:14:18: [cu_amx_cvar_fix.amxx] before = 115
Debug(): 0 -> 1
L 08/30/2012 - 15:14:18: [cu_amx_cvar_fix.amxx] after = 115
L 08/30/2012 - 15:14:18: [cu_amx_cvar_fix.amxx] Cmd: "Alka<1><STEAM_0:1:1232
><>" set cvar (name "amx_immunity") (value "a")
L 08/30/2012 - 15:14:22: [cu_amx_cvar_fix.amxx] before = 115
Debug(): a -> 0
L 08/30/2012 - 15:14:22: [cu_amx_cvar_fix.amxx] after = 115
L 08/30/2012 - 15:14:22: [cu_amx_cvar_fix.amxx] Cmd: "Alka<1><STEAM_0:1:1232
><>" set cvar (name "amx_immunity") (value "a")
L 08/30/2012 - 15:14:25: [cu_amx_cvar_fix.amxx] before = 115
Debug(): a -> 1
L 08/30/2012 - 15:14:25: [cu_amx_cvar_fix.amxx] after = 115
L 08/30/2012 - 15:14:25: [cu_amx_cvar_fix.amxx] Cmd: "Alka<1><STEAM_0:1:1232
><>" set cvar (name "amx_immunity") (value "a")
Also in your fix plugin a bounded cvar isn't blocked, it's passed to admincmd.amxx too
PHP Code:
if( CvarGetStatuspointer ) & CvarStatus_WasOutOfBound )
    {
        
console_printid"[AMXX] The cvar has a min and/or a max bound and the wanted value is out of bound." );
    } 
a return PLUGIN_HANDLED should be placed, isn't it? :-)

EDIT: Seems to happen only with cvars registerd with your module, amxx default ones works just fine.
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 08-30-2012 at 08:49.
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2012 , 08:45   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #93

No, the value has been bound by the module, but the cvar value has still been changed, so we should say the new value too.

Let me check/fix the plugin. Thanks for pointing out this problem.
__________________

Last edited by Arkshine; 08-30-2012 at 08:47.
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-30-2012 , 08:56   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #94

You're right, but the new value is set according to bound, in my case 1, and the admincmd shows the actual value you typed, eg. 12 and not the bound.
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 08-30-2012 at 09:03.
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2012 , 09:37   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #95

You come back just to find some bugs on my awesome module, after all this time ?!
Time to debug. There is something weird, hope it's not related to the amxx buffer.
__________________
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-30-2012 , 09:53   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #96

Well yea, that's the main reason ... nah, just makin' some plugin and came across of your awesome module that seems to have a bug. No problem, take your time mate
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 08-30-2012 at 09:55.
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2012 , 16:56   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #97

Well, I'm afraid as I've said, the problem is the AMXX buffer.
You use a string in a special situation where the buffer is overwritten.
The AMXX buffer is really poorly implemented.

To understand better, here the flow of execution :
  • amx_cvar >
  • set_pcvar_string > buffer written a first time with get_amxstring and the value is saved in a "static" pointer. Then it calls pfnCvar_DirectSet >
  • My module hooks this call > ExecuteForwards is executed >
  • OnImmunityChange called > read_flags( "a" ) uses a second time the buffer with get_amxstring, and since the pointer is "static", the new data is copied in the same pointer.

So, the problem is there. The pointer has now as value "a", and since it's the same pointer which is passed in pfnCvar_DirectSet and since the forward is hooked as pre in my module, it means, the cvar value will be set to "a".

Basically any native using the AMXX buffer (through get_amxstring) in your OnImmunityChange callback, will overwrite the cvar value.
Such problem is a more or less known issue and can happen easily with others forward/natives.

In your situation, you could replace read_flags by ADMIN_IMMUNITY ; but I'm not sure how to somehow-tricky-fix such issue.
If someone has an idea, I would gladly hear it.

By the way, will release a new version soon, I've fixed some others bugs and done some minor adjustments.
__________________

Last edited by Arkshine; 08-30-2012 at 17:02.
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-30-2012 , 17:02   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #98

Ah, i understand...talked with ConnorMcNoob too. Well if i'll use ADMIN_IMMUNITY will have it's value, isn't practically the same? Oh well, then i must find some other way :-( . Thank you Arkshine for explanation and time.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-30-2012 , 17:05   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #99

isn't practically the same It's exactly the same, except you avoid the use of a native, which is better because your code is faster.
Will still try to fix the problem, he should have some random workaround.

EDIT: well, I've done a fast-fix and not sure if it will be ok, but it works. I just copy the current value in a new pointer before ExecuteForwards is sent, then after that, I copy the pointer to the current one.
__________________

Last edited by Arkshine; 08-30-2012 at 17:22.
Arkshine is offline
Daniel Bogdan
New Member
Join Date: Aug 2012
Old 09-02-2012 , 10:02   Re: Module: Cvar Utilities (v1.3.1)
Reply With Quote #100

And you will post the fix ?
Daniel Bogdan is offline
Reply


Thread Tools
Display Modes

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:56.


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