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

Implement this on 1.8.3


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 11-10-2016 , 05:34   Implement this on 1.8.3
Reply With Quote #1

This is useful as owner dont want to give permission of certain cvars to admin only basic sv_restart 1 etc
PHP Code:
 cvar_on register_cvar("testing_cvar","1"); 
this should be like this
PHP Code:
 cvar_on register_cvar("testing_cvar","1",ADMIN_IMMUNITY); 
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"
    } 

Link : https://forums.alliedmods.net/showthread.php?t=289402
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 12-05-2016 , 11:07   Re: Implement this on 1.8.3
Reply With Quote #2

working on 1.8.2 ??
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 12-05-2016 , 11:08   Re: Implement this on 1.8.3
Reply With Quote #3

and 1.8.1 ???
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-05-2016 , 21:19   Re: Implement this on 1.8.3
Reply With Quote #4

Quote:
Originally Posted by shehzad1234 View Post
working on 1.8.2 ??
Quote:
Originally Posted by shehzad1234 View Post
and 1.8.1 ???
No. This will never be implemented because it doesn't really make any sense.

A better method would be to modify the amx_cvar command validate a request to change a cvar. The command can check a file to check permissions and allow or deny the request.
__________________
fysiks is offline
shehzad1234
BANNED
Join Date: Jan 2016
Location: https://t.me/pump_upp
Old 12-06-2016 , 04:15   Re: Implement this on 1.8.3
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
No. This will never be implemented because it doesn't really make any sense.

A better method would be to modify the amx_cvar command validate a request to change a cvar. The command can check a file to check permissions and allow or deny the request.
thanks bro
shehzad1234 is offline
Send a message via ICQ to shehzad1234 Send a message via AIM to shehzad1234 Send a message via Yahoo to shehzad1234
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-06-2016 , 07:57   Re: Implement this on 1.8.3
Reply With Quote #6

That's not necessarily a bad request. amx_cvar hard codes a check to enforce the use of sv_password with ADMIN_PASSWORD flag. I guess it would be possible to generalize that at cvar registration scope (or a new native) in order to tailor the permissions of this command and having the access flags generated in a cvaraccess:ini file similar to the commands.
__________________
Arkshine is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-06-2016 , 13:12   Re: Implement this on 1.8.3
Reply With Quote #7

If you do exactly has he is suggesting, you'd have to pass the entity index (id) to all of the [get|set]_[p]cvar_[]() functions. Then, you'd have to find a way to pass out the success or failure without completely destroying backwards compatibility.

For these reasons, I don't think it should be implemented in a native like this. The only place that permissions is relevant (the way that he's suggesting) is when using the amx_cvar command. Therefore, this should be implemented in the amx_cvar command with the permissions list coming from a file similar to cmdaccess.ini.
__________________
fysiks is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-06-2016 , 20:57   Re: Implement this on 1.8.3
Reply With Quote #8

> to find a way to pass out the success or failure without completely destroying backwards compatibility.

Break the plugin execution when someone call the cvar without the required access level. It would be something like, there is no cvar registered error when someone try to access an nonexisting cvar. It kinda makes sense, if you do not have access to the cvar, it is like the cvar does not exist to you and the exception should be throw. But in our case, we do not literally throw an exception, we just cut the execution.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-06-2016 , 21:49   Re: Implement this on 1.8.3
Reply With Quote #9

Stopping execution if it fails is not an option. What if I have code that I need to run regardless of it passing or failing?? Therefore, that is not an option.
__________________
fysiks is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 12-07-2016 , 10:48   Re: Implement this on 1.8.3
Reply With Quote #10

You right, easily can leak to memory leaks as not closing a file pointer. Therefore it can be done on plugin level the the programmer checking the the user has the specific flag before call the `cvar`. This way the programmer may handle correctly to close file pointers or whatever he needs to.

Moreover sticking with the option to add the access level on the cvar creation to restrict the access on the command `amx_cvar` seems a good option. We may instead of receive the level on the `register_cvar` command and use it, later will get some work to propagate it until `amx_cvar` hard coded value for `ADMIN_CVAR`.

Anyways I do not know whether it is worth to implement right away or not. I would say check the Issue Tracker and see what is on the queue prioritizing the bugs Issues as I prefer a not so big project/features working good than a big project/features filled bugs.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz 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 09:21.


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