AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cvar changing help... (https://forums.alliedmods.net/showthread.php?t=10550)

Sp4rt4n 02-22-2005 18:37

cvar changing help...
 
im very new to this... i was wondering what the code would be for me to make an admin with an access of ADMIN_LEVEL_A change the cvar ping_max

and is this code right to make a new cvar?

Code:
register_cvar("ping_max","175",FCVAR_PRINTABLEONLY)

Dizzy 02-22-2005 18:48

Code:
    register_cvar("sv_cvar","1", ADMIN_LEVEL_A)

That Should Be right

Just change the sv_cvar into yours

cause ADMIN_LEVEL_A is the Level of Admin you must have :D

Sp4rt4n 02-22-2005 18:53

ok, and i would replace the '1' with the default i want it at right?

and what would the code be for me to make an admin with an access of ADMIN_LEVEL_A change the cvar ping_max? any extra code? or just that?

EDIT: and would i have to make this line even if i register the new cvar:

Code:
new ping_max[30]

Dizzy 02-22-2005 18:55

yes

Code:
    register_cvar("amx_ping","175", ADMIN_LEVEL_A)

Tell me if you get any errors

I am pretty sure though

:D

Dizzy 02-22-2005 18:57

Quote:

Originally Posted by Sp4rt4n
ok, and i would replace the '1' with the default i want it at right?

and what would the code be for me to make an admin with an access of ADMIN_LEVEL_A change the cvar ping_max? any extra code? or just that?

EDIT: and would i have to make this line even if i register the new cvar:

Code:
new ping_max[30]

What Is That For In The Plugin?

XxAvalanchexX 02-22-2005 18:59

Dizzy, that is incorrect.

The third parameter is the cvar flags, not the access level.

You would have to register a console command for admins with ADMIN_LEVEL_A that uses cvar_set_int or something to set the cvar. Keep the cvar registering line as you had it before.

Sp4rt4n 02-22-2005 19:00

very cool, it worked.... thank you

Dizzy 02-22-2005 19:01

isn't the cvar automatically ADMIN encrypted?

A regualar Client can't change cvars without rcon

soo...

with admin you can already use the cvar

Just don't give your rcon away to anyone :D

the cvar doesn't need to be ADMIN_LEVEL_A'ed

just the concmd

register_concmd("amx_maxping","maxping", ADMIN_LEVEL_A)

Like that

Or just have a Cvar :D

Sp4rt4n 02-22-2005 19:27

ah, much easier... thank you

Dizzy 02-22-2005 20:08

np glad that Avalance and I could help ya :D


All times are GMT -4. The time now is 13:58.

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