Es.getAddonPath

From EventScripts Community Encyclopedia



Method: getAddonPath

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

Method Overview

Table of Contents

Contents


Description

Gets the Path of the given addon name.

Arguments

addonname - the name of the addon


Examples

import es
 
es.msg(es.getAddonPath("test")) # would print the path to the addon test, which ends like ../addons/eventscripts/test/
 
import es
import time
 
filepath = es.getAddonPath("test") + '/attackerfile.txt' # the path to the file
 
def player_death(event_var):
    """ If someone dies write it down to a file """
    reason = "%s killed %s" % (event_var['es_attackername'],event_var['es_username']) 
    currenttime = time.strftime('%x %X') # gets the current time in <date> <time>
    f = open(filepath,'a') # opens the file
    f.write(currenttime + " - " + reason + "\n") # writes down the time and the reason and adds a new line
    f.close() # closes the file 

Notes

Doesn't work with subaddons.

See Also

blog comments powered by Disqus