AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cvars (https://forums.alliedmods.net/showthread.php?t=229363)

daniel46 11-06-2013 10:13

cvars
 
can i use cvar in a switch func somthnig like this?

switch( num )
{
case get_pcvar_num( hello ) .. 100:...

also i want to make a cvar for admin flag like ADMIN_BAN possible?

^SmileY 11-06-2013 10:19

Re: cvars
 
Quote:

Originally Posted by daniel46 (Post 2057531)
can i use cvar in a switch func somthnig like this?

switch( num )
{
case get_pcvar_num( hello ) .. 100:...

also i want to make a cvar for admin flag like ADMIN_BAN possible?

Explain better.

daniel46 11-06-2013 15:51

Re: cvars
 
ok so first thing can i do a cvar for admin flag?

like

register_cvar("admin_flag_req", "ADMIN_BAN") or somthing like that

second can i use cvar in a switch function?

i mean register_cvar("chance", "30")

switch( odds )
{
case get_pcvar_num of this car

can i do it?

Blizzard_87 11-06-2013 16:54

Re: cvars
 
ADMIN_BAN is an integer. Not a string.

Your better off using

switch( random_num( 0, 30 ) )
{
Case 0:

Etc.

daniel46 11-07-2013 13:56

Re: cvars
 
no i know but i want to do like win chance in somthing and i want a cvar for it to make it wasy to pick

akcaliberg 11-07-2013 16:31

Re: cvars
 
Why don't you just try it by yourself ?

It doesn't even compile. It must be a constant expression as compiler says. You can't use non-constant variables.

daniel46 11-08-2013 07:17

Re: cvars
 
so there is no way to to cvar for switch func?

YamiKaitou 11-08-2013 10:37

Re: cvars
 
Quote:

Originally Posted by daniel46 (Post 2058283)
so there is no way to to cvar for switch func?

No, as it is not a constant value that the compiler requires


All times are GMT -4. The time now is 23:19.

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