bz_setBZDBDouble

From BZFlagWiki
Jump to: navigation, search

bool bz_setBZDBDouble (const char* variable, double val, int perms = 0, bool persistent = false)


Sets a BZDB variable to a given double value.

Parameters:
variable  -  Variable name (E.g. "_shockOutRadius")
val  -  The value to set the variable to.
perms = 0  -  What to set the permission value to. (Range: 1-3. Using 0 sets it to the default [2], and using a higher number sets it to 3.)
persistent = false  -  Whether or not the variable will be persistent.
Returns:
Whether or not the set was successful.

Example[edit]

Sets the tank speed to a random decimal value between the range of 25.00 - 50.00.

bz_setBZDBDouble("_tankSpeed",rand()%25+25+((double)(rand()%100) * 0.01));
bz_sendTextMessagef(BZ_SERVER,BZ_ALLUSERS,"Tank Speed is now set to %.lf",bz_getBZDBDouble("_tankSpeed"));