Raised This Month: $ Target: $400
 0% 

cvars


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
daniel46
Senior Member
Join Date: Dec 2011
Old 11-06-2013 , 10:13   cvars
Reply With Quote #1

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?

Last edited by daniel46; 11-06-2013 at 10:16.
daniel46 is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 11-06-2013 , 10:19   Re: cvars
Reply With Quote #2

Quote:
Originally Posted by daniel46 View Post
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.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
daniel46
Senior Member
Join Date: Dec 2011
Old 11-06-2013 , 15:51   Re: cvars
Reply With Quote #3

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?
daniel46 is offline
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 11-06-2013 , 16:54   Re: cvars
Reply With Quote #4

ADMIN_BAN is an integer. Not a string.

Your better off using

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

Etc.
__________________
Blizzard_87 is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 11-07-2013 , 13:56   Re: cvars
Reply With Quote #5

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
daniel46 is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 11-07-2013 , 16:31   Re: cvars
Reply With Quote #6

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.
akcaliberg is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 11-08-2013 , 07:17   Re: cvars
Reply With Quote #7

so there is no way to to cvar for switch func?
daniel46 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-08-2013 , 10:37   Re: cvars
Reply With Quote #8

Quote:
Originally Posted by daniel46 View Post
so there is no way to to cvar for switch func?
No, as it is not a constant value that the compiler requires
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 23:19.


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