Raised This Month: $ Target: $400
 0% 

Get cvar value and set it to other cvar value + number


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mordi
Senior Member
Join Date: Jul 2007
Location: o rly?
Old 10-18-2007 , 16:36   Get cvar value and set it to other cvar value + number
Reply With Quote #1

OK, very short:

What I need to do is to get two client's (or server) cvar values (A and B) and set cvar A to: cvar B + a number. This must be possible in some kind of way!
__________________
Quote:
Originally Posted by Alka View Post
engine ?! 0o... *barf*
mordi is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-18-2007 , 16:51   Re: Get cvar value and set it to other cvar value + number
Reply With Quote #2

Server CVARs:
PHP Code:
new not_a_random_number 100
    set_cvar_num
("cvar_a"get_cvar_num("cvar_b") + not_a_random_number
__________________
M249-M4A1 is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 10-19-2007 , 03:29   Re: Get cvar value and set it to other cvar value + number
Reply With Quote #3

Check if the cvars are server-side or not ( get_cvar_pointer() will fail if server cvar does not exists )
_Master_ is offline
mordi
Senior Member
Join Date: Jul 2007
Location: o rly?
Old 10-19-2007 , 05:49   Re: Get cvar value and set it to other cvar value + number
Reply With Quote #4

How would I do for the client cmd's then? That's the most important thing..
__________________
Quote:
Originally Posted by Alka View Post
engine ?! 0o... *barf*
mordi is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 10-19-2007 , 05:53   Re: Get cvar value and set it to other cvar value + number
Reply With Quote #5

I do believe you mean "client cvars"...
Read this

Also I would like to make some clarifications regarding my previos post:
If the cvar is NOT server-side then it may or may not be client-side. Having said this you would have to make sure that the cvar you're testing exists either server or client-side.

Last edited by _Master_; 10-19-2007 at 06:17.
_Master_ is offline
mordi
Senior Member
Join Date: Jul 2007
Location: o rly?
Old 10-19-2007 , 06:01   Re: Get cvar value and set it to other cvar value + number
Reply With Quote #6

I know! Already read that, the point is to get some cvar and add a number to it and set another cvar to the other with the number (hard to read, that's why I used A & B as examples on first post)
__________________
Quote:
Originally Posted by Alka View Post
engine ?! 0o... *barf*
mordi is offline
_Master_
Senior Member
Join Date: Dec 2006
Old 10-19-2007 , 06:21   Re: Get cvar value and set it to other cvar value + number
Reply With Quote #7

1. Get cvar values
2. If cvar to set is server-side then do a set_pcvar_*() - this would work because get_cvar_pointer did not fail. If the cvar is client-side then do a client_cmd( id, "%s %X", cvar_name, new_cvar_value )
_Master_ 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 13:01.


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