How could you create a sayhook with sp?
Code: Select all
_sayHooks = {}
def addSayHook(userid, function):
userid = int(userid)
if not callable(function):
es.dbmsg(0, "ERROR: Tried to add sayhook on userid '%s' but function is not callable" % userid)
return
_sayHooks[userid] = function
def removeSayHook(userid):
if userid in _sayHooks:
del _sayHooks[userid]
def sayFilter(userid, oltext, teamonly):
if userid in _sayHooks:
text = oltext.strip('"')
_fu = _sayHooks[userid]
removeSayHook(userid)
_fu(userid, text)
return 0,0,0
return userid, oltext, teamonly
@Event
def es_map_start(event):
_sayHooks.clear()
Thats what i have written in es.
To my questions:
What is the event called which executes every time the map changes? Also how can i get the current mapname?
On Es it was es_map_start and es.ServerVar('eventscripts_currentmap')
Im sorry i didnt checked the forums/wiki too often
