[HL2:DM] Killsound
Posted: Mon Apr 13, 2020 9:08 am
Hello SourcePython Team and Community,
could somebody turn that into SP for me?
If possible, the burning corpse option should be excluded.
Thanks in Advance.
could somebody turn that into SP for me?
If possible, the burning corpse option should be excluded.
Syntax: Select all
# =============================================================================
# >> CONFIG (Start)
# =============================================================================
# Waffen, die einen Effekt erzeugen sollen. Bsp.:
# '<Klassenname der Waffe>: (<0 oder 1>, <None oder Soundpfad>),
# Die 0 bzw. 1 gibt an, ob die Leiche brennen soll. None gibt an, dass kein
# Sound abgespielt werden soll. Wenn einer abgespielt werden soll, einfach den
# Pfad zum Sound angeben. Der Soundordner wird nicht mit angegeben. Also
# statt 'sound/ambient/...' musst du 'ambient/...' eintragen.
WEAPONS = {
'grenade_frag': (0, 'effects/levelup2.mp3'),
'slam': (0, 'effects/levelup2.mp3'),
'pistol': (0, 'effects/bonus.mp3'),
'rpg_missile': (0, 'effects/rocket.mp3'),
'combine_ball': (0, 'effects/perfects.mp3'),
}
# Soundlautstaerke
VOLUME = 1.0
# Soundreichweite - 0.0 == Ueberall auf der Map, 1.0 nur der tote Spieler
ATTENUATION = 0.5
# =============================================================================
# >> CONFIG (ENDE)
# =============================================================================
import es
info = es.AddonInfo()
info.name = "RocKs Player Level"
info.version = "1.0"
info.author = "Ayuto"
info.url = "www.rocks-clan.de"
info.description = "RocKs Player Level"
es.ServerVar(info.name, info.version, info.description).makepublic()
def player_death(ev):
weapon = ev['weapon']
if weapon not in WEAPONS:
return
userid = ev['userid']
burn, sound = WEAPONS[weapon]
if sound:
es.emitsound('player', userid, sound, VOLUME, ATTENUATION)
if not burn:
return
handle = es.getplayerhandle(userid)
classname, playerprop = ragdoll.getRagdollData()
for index in es.getEntityIndexes(classname):
if handle != es.getindexprop(index, playerprop):
continue
es.setentityname(index, index)
es.fire(userid, index, 'Ignite')
break
class Ragdoll(object):
ragdolldata = None
def getRagdollData(self):
if self.ragdolldata:
return self.ragdolldata
for index, entity in es.createentitylist().iteritems():
classname = entity['classname']
if not classname.endswith('_ragdoll'):
continue
for prop in entity:
if not prop.endswith('m_hPlayer'):
continue
data = self.ragdolldata = (classname, prop)
return data
raise NameError('Cannot find player property')
raise NameError('Cannot find game ragdoll')
ragdoll = Ragdoll()
Thanks in Advance.