Page 1 of 1
Detecting if a DMFLAG is off or on.
Posted: Thu Oct 29, 2015 4:21 pm
by Mr. Satan
How would you go about detecting whether a particular DMFLAG (No Monsters for example) is off or on from the number outputted when you GetCvar DMFlags?
RE: Detecting if a DMFLAG is off or on.
Posted: Thu Oct 29, 2015 4:41 pm
by Ænima
Converting the number to binary might help.
RE: Detecting if a DMFLAG is off or on.
Posted: Thu Oct 29, 2015 4:56 pm
by Empyre
Do you have access to an AND operator in your expressions? If so, find out the number for that DMFLAG and then take the GetCVar DMFlags number and AND it with the number for that particular DMFLAG. The result will be 0 if the flag is off and the DMFLAG's number if it is on.
RE: Detecting if a DMFLAG is off or on.
Posted: Thu Oct 29, 2015 5:45 pm
by Dusk
Code: Select all
if (GetCVar ("sv_nomonsters"))
{
// ...
}
RE: Detecting if a DMFLAG is off or on.
Posted: Thu Oct 29, 2015 7:01 pm
by TerminusEst13
Every sum total of dmflags or dmflags2 or etc is the result of singular cvars being turned on and off. The question is just checking for that flag.
dmflags 4096, for example, means sv_nomonsters is 1. dmflags 16384 means sv_itemrespawn is 1. Etc.