Cvars ->


(Panzer III) #1

Hello.
Can someone tell mi how can I create cvar with more than one Value ?
like:

/plz_helpme 16 32

I know how to create a ‘normal’ cvar … but now i need to create a cvar with more than one value.

Im tried:


extern vmCvar_t plz_helpme[2] ...etc.
if (plz_helpme[1].integer == ......etc.

but it doesn’t work :frowning:


(*The*Redster*) #2

For all I know there might be an easier way, but Cvars still have the original string as a member, i.e. *(plz_helpme.string) would be the string “16 32” .

As long as you know how to manipulate strings, breaking that down shouldn’t be a problem.


(Azyu) #3

use ‘sscanf’ function. :slight_smile:


vmCvar_t blahblah;  // ex: the value of blahblah is '16 32'.
int plz_helpme[2];
sscanf( blahblah.string, "%d %d", &plz_helpme[0], &plz_helpme[1]);

if( plz_helpme[0] == ...


(Panzer III) #4

Thank You, it’s working good from config… but there is small problem when im trying to change values inside the game from console,it only read’s first value :eek3:


(Shanks) #5

When you change the value make sure you put it in quotes.