Es.ServerVar

From EventScripts Community Encyclopedia



Method: es.ServerVar

Module: es
Class: (no class)
EventScripts version: 2.0

Method Overview

Table of Contents

Contents


Description

Stores a server variable.

Arguments

  • variable - name of the CVAR


Examples

import es
def load():
    friendlyfire = es.ServerVar('mp_friendlyfire')
    if friendlyfire == '1':
        es.msg('#default', 'Friendlyfire is ON')
    else:
        es.msg('#default', 'Friendlyfire is OFF')
Instances of this class have no value unless coerced or cast to a value:
>>> import es
 
>>> friendlyfire = es.ServerVar('mp_friendlyfire')
>>> friendlyfire.set(1)
 
# Cast to a value
>>> int(friendlyfire)
1
>>> str(friendlyfire)
'1'
 
# Coerce to a value
>>> friendlyfire == '1'
True
>>> friendlyfire == 1
True
>>> friendlyfire == 0
False

Notes

Instances of this class have no value unless coerced or cast to a value.

See Also

blog comments powered by Disqus