- Added three new ACS functions:
* int GetUserCVar(int playernum, "cvarname")
* bool SetCVar("cvarname", newvalue)
* bool SetUserCVar(int playernum, "cvarname", newvalue)
GetUserCVar is analogous to GetCVar, except it returns the value of a user cvar for a
specific player. (All user cvars can be examined using the playerinfo console command.)
SetCVar sets a cvar to a new value. If the cvar is floating point, then newvalue is treated
as a fixed point number, otherwise it's treated as an integer. SetUserCVar is the same, but
for a specific player's user cvar.
SetCVar and SetUserCVar can only change cvars created via CVARINFO. They cannot alter built-in cvars.
If you use GetCVar or SetCVar with a user cvar, they will act on the copy of the user cvar
for the player who activated the script. e.g.
GetCVar("gender")
is the same as
GetUserCVar(PlayerNumber(), "gender")
If you get the value of a floating point cvar, it will be returned as a fixed point number.
Otherwise, it will be returned as an integer.
SVN r4283 (trunk)
This commit is contained in:
parent
567fbace22
commit
167ee9e7fb
4 changed files with 168 additions and 17 deletions
|
|
@ -430,7 +430,7 @@ void userinfo_t::Reset()
|
|||
case NAME_PlayerClass: type = CVAR_Int; break;
|
||||
default: type = cvar->GetRealType(); break;
|
||||
}
|
||||
newcvar = C_CreateCVar(NULL, type, 0);
|
||||
newcvar = C_CreateCVar(NULL, type, cvar->GetFlags() & CVAR_MOD);
|
||||
newcvar->SetGenericRepDefault(cvar->GetGenericRepDefault(CVAR_String), CVAR_String);
|
||||
Insert(cvarname, newcvar);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue