Refcount
From EventScripts Community Encyclopedia
OverviewSyntax:refcount <command>Note: Command parameters are described inside the
< and > characters. Optional parameters are contained within [ and ] characters.DescriptionIncrease, decrease or get the reference count for a variable. by Wonder
Parameters
refcount increment <var> [silent] To decrease the reference count: refcount decrement <var> [silent] To get the reference count and/or put it inside a variable: refcount count [return var] <var>
Examplesevent player_say { // Let's end the current round. if (event_var(text) == endtheround) do { // Increase the reference count silenty. // This is so clients cannot take advantage that it was enabled. refcount increment sv_cheats 1 // Now end the round. endround // Now decrease the reference count again silently. refcount decrement sv_cheats 1 } else do { // Let's get the reference count of sv_cheats. if (event_var(text) == countcheats) do { // Create a variable to hold the reference count. es_setinfo cheatcount 0 // Get the reference count of sv_cheats and put it inside cheatcount. refcount count cheatcount sv_cheats // Tell the user the reference count. es_tell event_var(userid) The reference count for sv_cheats is: server_var(cheatcount) } } } Notes
See Also |
