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

[solved ] change cvar only by IMMUNITY


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 10-22-2016 , 04:01   [solved ] change cvar only by IMMUNITY
Reply With Quote #1

is there any way this cvar should be change by who has ADMIN_IMMUNITY else it wont change

PHP Code:
#include <amxmodx>

new cvar_on;

public 
plugin_init()
{
    
register_clcmd("say /test","show_test");
    
//this cvar should be change by ADMIN_IMMUNITY ONLY
    
cvar_on register_cvar("testing_cvar","1");
}

public 
show_test(id)
{
    if(
get_pcvar_num(cvar_on))
    {
        
client_print(id,print_chat,"command is working");
    }
    else
    {
        
client_print(id,print_chat,"command is not working")
    }

__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 10-22-2016 at 14:01.
indraraj striker is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 10-22-2016 , 04:32   Re: change cvar only by IMMUNITY
Reply With Quote #2

No, only if you create a command wich will change the cvar ( by using register_concmd ).

And insteand of a cvar you should use a global variable with the same purpose as the cvar.

That's what you can do or just check in plugin_cfg the value of the cvar/g variable and change it if is not convenable.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 10-22-2016 , 07:39   Re: change cvar only by IMMUNITY
Reply With Quote #3

Craxor btw thanks
but i want to change cvar any time as plugin_cfg execute only on map change i dont think cvar will be updated during game can you give me example may be i m not understanding you
but this feature should be in 1.8.3
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 10-22-2016 , 08:46   Re: change cvar only by IMMUNITY
Reply With Quote #4

You can:

register_clcmd("amx_cvar my_cvar", "check_flag")

public check_flag( id )
{
if(!get_user_flags( id ) & ADMIN_IMMUNITY)
return PLUGIN_HANDLED;

return PLUGIN_CONTINUE;
}

put this plugin on the top in plugins.ini and it will block cvar if he doesn't have right flag.
siriusmd99 is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 10-22-2016 , 09:06   Re: change cvar only by IMMUNITY
Reply With Quote #5

What I'm saying is to forgot about cvars and use global variables, change the value by registering an admin command with admin immunity flag and that's all.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 10-22-2016 , 14:01   Re: change cvar only by IMMUNITY
Reply With Quote #6

Quote:
Originally Posted by siriusmd99 View Post
You can:

register_clcmd("amx_cvar my_cvar", "check_flag")

public check_flag( id )
{
if(!get_user_flags( id ) & ADMIN_IMMUNITY)
return PLUGIN_HANDLED;

return PLUGIN_CONTINUE;
}

put this plugin on the top in plugins.ini and it will block cvar if he doesn't have right flag.
siriusmd99
This is what i want xD Thanks you saved me
Craxor thanks for the idea
Algorithm
1.register_concmd check flag
2.using args get input from admin
3.check global variable if its 1 or 0
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 08-26-2018 , 08:31   Re: [solved ] change cvar only by IMMUNITY
Reply With Quote #7

can someone explain this code more?
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
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 15:38.


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