Raised This Month: $ Target: $400
 0% 

Stack error with hook_cvar_change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PartialCloning
Senior Member
Join Date: Dec 2015
Old 12-26-2015 , 20:58   Re: Stack error with hook_cvar_change
Reply With Quote #1

Code:
#include <amxmisc>

#if AMXX_VERSION_NUM < 183 
    #assert AMX Mod X v1.8.3 or later library required!
#endif 

new cvarhook:rconhandle;
public plugin_init()
{
  	register_plugin
  	(
  	  	.plugin_name = "Block changing rcon_password",
  	  	.version     = "1.0",
  	  	.author      = "lüxor"
  	);

  	rconhandle = hook_cvar_change(get_cvar_pointer("rcon_password"), "setDefaultValue");
}

public setDefaultValue(PointerCvar, const OldValue[], const NewValue[])
{
  	 if(!equal(NewValue, OldValue))
  	{
  	  	disable_cvar_hook(rconhandle);
  	  	set_pcvar_string(PointerCvar, OldValue);
  	  	enable_cvar_hook(rconhandle);
  	}
}

Last edited by PartialCloning; 12-27-2015 at 09:26.
PartialCloning 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 17:52.


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