Raised This Month: $ Target: $400
 0% 

How to get actual cvar name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-22-2015 , 09:43   Re: How to get actual cvar name
Reply With Quote #1

I'd rather make it like this for now:

PHP Code:
new essentials_tpessentials_tphere
new const g_Permissions[][] = { "essentials.tp""essentials.tphere" }

essentials_tp register_cvar(g_Permissions[0], "d")
essentials_tphere register_cvar(g_Permissions[1], "d"
Adding a simple function for this would be quite useful.

PS: Is something like this possible?

PHP Code:
new essentials_tpessentials_tphere

new const g_Permissions[][] = {
    
essentials_tp"essentials.tp""d"
    
essentials_tphere"essentials.tphere""d"
}

for new(
0sizeof(g_Permissions) - 2+= 3)
    
g_Permissions[i] = register_cvar(i+1i+2
//Edit: nevermind, I found a somewhat simple way:

PHP Code:
if(!user_permission(idessentials_tphere"essentials.tphere"1))
    return 
PLUGIN_HANDLED 

Last edited by OciXCrom; 09-22-2015 at 13:43.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-22-2015 , 20:16   Re: How to get actual cvar name
Reply With Quote #2

A period (.) is not a valid word character, is it a valid character for cvars?
__________________
fysiks is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 09-23-2015 , 06:57   Re: How to get actual cvar name
Reply With Quote #3

Cvars are strings, therefore I see no reason for it to be invalid, nor I'm having any problems with it.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
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 22:12.


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