This wiki is archived and useful information is being migrated to the main bzflag.org website
Difference between revisions of "Bz setBZDBDouble"
From BZFlagWiki
(Created new API Function page with example.) |
(Ugh, completely forgot about the return...Will have to backtrack through a few functions to fix every page's template.) |
||
Line 1: | Line 1: | ||
{{apicall | {{apicall | ||
| name = bz_setBZDBDouble | | name = bz_setBZDBDouble | ||
+ | | returns = Whether or not the set was successful. | ||
+ | | returntype = bool | ||
| description = Sets a BZDB variable to a given '''double''' value. | | description = Sets a BZDB variable to a given '''double''' value. | ||
| param1 = variable | | param1 = variable |
Latest revision as of 05:50, 19 October 2011
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"));