Code: Select all
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\plugins\es_emulator\eventscripts\es.py", line 284, in triggerEvent
self.EventListeners[eventname][listener](event_var)
File "..\addons\source-python\plugins\es_emulator\eventscripts\x___fragcloud_v2\x___fragcloud_v2.py", line 90, in player_spawn
for index in weaponlib.getIndexList("env_ar2explosion"):
NameError: name 'weaponlib' is not defined
How or what do i have to add to this line
Code: Select all
def player_spawn(ev):
for index in weaponlib.getIndexList("env_ar2explosion"):
Thank you and have a great week.
![Big Grin :grin:](./images/smilies/biggrin.png)
The whole script is here
Code: Select all
MATERIAL1 = 'materials/particle/fire.vmt'
MATERIAL2 = 'materials/particle/particle_noisesphere.vmt'
MATERIAL3 = 'materials/Effects/fleck_cement1.vmt'
MATERIAL4 = 'materials/Sprites/heatwavedx70.vmt'
#
import es
import usermsg
import gamethread
#
def load():
es.msg('loaded')
addDownloadables()
#
def addDownloadables():
es.stringtable('downloadables', MATERIAL1)
es.stringtable('downloadables', MATERIAL1[:-3] + 'vtf')
es.stringtable('downloadables', MATERIAL2)
es.stringtable('downloadables', MATERIAL2[:-3] + 'vtf')
es.stringtable('downloadables', MATERIAL3)
es.stringtable('downloadables', MATERIAL3[:-3] + 'vtf')
es.stringtable('downloadables', MATERIAL4)
es.stringtable('downloadables', MATERIAL4[:-3] + 'vtf')
#
def es_map_start(ev):
addDownloadables()
#
def player_death(ev):
weapon = ev["weapon"]
attacker = ev["attacker"]
userid = ev["userid"]
#
if weapon == "combine_ball":
usermsg.shake(attacker, 5.1, 7)
usermsg.fade(attacker, 1, 0.15, 0, 255, 11, 11, 160)
fragcloud1(userid)
#
if weapon == "smg1_grenade":
usermsg.shake(attacker, 7.1, 7)
usermsg.fade(attacker, 1, 0.15, 0, 255, 11, 11, 160)
fragcloud2(userid)
#
if weapon == "grenade_frag":
usermsg.shake(attacker, 9.3, 7)
usermsg.fade(attacker, 1, 0.15, 0, 255, 11, 11, 160)
fragcloud3(userid)
#
if weapon == "rpg_missile":
usermsg.shake(attacker, 11.5, 7)
usermsg.fade(attacker, 1, 0.15, 0, 255, 11, 11, 160)
fragcloud4(userid)
#
def fragcloud1(userid):
clouds = es.createentitylist("env_ar2explosion")
es.server.queuecmd("es_xgive %s env_ar2explosion"% userid)
es.server.queuecmd("es_fire %s env_ar2explosion addoutput \"material %s\""% (userid, MATERIAL1.split('/', 1)[1]))
es.server.queuecmd("es_fire %s env_ar2explosion explode"% userid)
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s env_ar2explosion Kill"% userid))
for cloud in clouds:
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s %s Kill"% (userid, cloud)))
#
def fragcloud2(userid):
clouds = es.createentitylist("env_ar2explosion")
es.server.queuecmd("es_xgive %s env_ar2explosion"% userid)
es.server.queuecmd("es_fire %s env_ar2explosion addoutput \"material %s\""% (userid, MATERIAL2.split('/', 1)[1]))
es.server.queuecmd("es_fire %s env_ar2explosion explode"% userid)
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s env_ar2explosion Kill"% userid))
for cloud in clouds:
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s %s Kill"% (userid, cloud)))
#
def fragcloud3(userid):
clouds = es.createentitylist("env_ar2explosion")
es.server.queuecmd("es_xgive %s env_ar2explosion"% userid)
es.server.queuecmd("es_fire %s env_ar2explosion addoutput \"material %s\""% (userid, MATERIAL3.split('/', 1)[1]))
es.server.queuecmd("es_fire %s env_ar2explosion explode"% userid)
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s env_ar2explosion Kill"% userid))
for cloud in clouds:
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s %s Kill"% (userid, cloud)))
#
#
def fragcloud4(userid):
clouds = es.createentitylist("env_ar2explosion")
es.server.queuecmd("es_xgive %s env_ar2explosion"% userid)
es.server.queuecmd("es_fire %s env_ar2explosion addoutput \"material %s\""% (userid, MATERIAL4.split('/', 1)[1]))
es.server.queuecmd("es_fire %s env_ar2explosion explode"% userid)
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s env_ar2explosion Kill"% userid))
for cloud in clouds:
gamethread.delayed(0.1, es.server.queuecmd, ("es_fire %s %s Kill"% (userid, cloud)))
#
def player_spawn(ev):
for index in weaponlib.getIndexList("env_ar2explosion"):
if es.getindexprop(index, 'CBaseEntity.m_hOwnerEntity') == -1:
es.server.queuecmd('es_xremove %s' % index)
#
def unload():
es.msg('unloaded')
#