Page 1 of 1

killstreaks for hl2dm

Posted: Sat May 18, 2019 7:53 pm
by daren adler
Looking for a kiillstreak plugin for my EXILE hl2dm tdm server,,was using eventscripts x,x___killstreaks_v1, http://addons.eventscripts.com/addons/view/x Please tell me what i need to do to get one or make one :smile: I tryed https://github.com/Ayuto/EventScripts-Emulator and did what it said, but still no luck. :frown:

Re: killstreaks for hl2dm

Posted: Mon May 20, 2019 11:23 am
by Painkiller
Hello test this one.

I do not remember where,
but it worked.

(I use it for Black Mesa Source maybe it's in hl2dm)

Re: killstreaks for hl2dm

Posted: Tue May 21, 2019 5:19 am
by daren adler
Thanks man.Works GREAT.

Re: killstreaks for hl2dm

Posted: Thu May 23, 2019 6:48 pm
by Kami
Thanks. (I would recognize my crappy coding everywhere ;D)

Re: killstreaks for hl2dm

Posted: Sun May 26, 2019 8:20 am
by Painkiller
You did fine.

Re: killstreaks for hl2dm

Posted: Wed May 29, 2019 3:34 pm
by daren adler

Syntax: Select all

2019-05-29 09:59:25 - sp	-	MESSAGE	[SP] Loading plugin 'country_tag'...
2019-05-29 09:59:25 - sp - MESSAGE [SP] Successfully loaded plugin 'country_tag'.
2019-05-29 09:59:25 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 09:59:25 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 09:59:25 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 09:59:25 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 09:59:25 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 09:59:25 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 09:59:26 - sp - MESSAGE [SP] Unloading plugin 'killmessage'...
2019-05-29 09:59:26 - sp - MESSAGE [SP] Successfully unloaded plugin 'killmessage'.
2019-05-29 09:59:26 - sp - MESSAGE [SP] Unloading plugin 'headshot'...
2019-05-29 09:59:26 - sp - MESSAGE [SP] Successfully unloaded plugin 'headshot'.
2019-05-29 09:59:26 - sp - MESSAGE [SP] Unloading plugin 'gamemode'...
2019-05-29 09:59:26 - sp - MESSAGE [SP] Successfully unloaded plugin 'gamemode'.
2019-05-29 09:59:27 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 09:59:27 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 09:59:27 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 09:59:27 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 09:59:27 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 09:59:27 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 09:59:41 - sp - MESSAGE [SP] Unloading plugin 'killmessage'...
2019-05-29 09:59:41 - sp - MESSAGE [SP] Successfully unloaded plugin 'killmessage'.
2019-05-29 09:59:41 - sp - MESSAGE [SP] Unloading plugin 'headshot'...
2019-05-29 09:59:41 - sp - MESSAGE [SP] Successfully unloaded plugin 'headshot'.
2019-05-29 09:59:41 - sp - MESSAGE [SP] Unloading plugin 'gamemode'...
2019-05-29 09:59:41 - sp - MESSAGE [SP] Successfully unloaded plugin 'gamemode'.
2019-05-29 09:59:42 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 09:59:42 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 09:59:42 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 09:59:42 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 09:59:42 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 09:59:42 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 09:59:56 - sp - MESSAGE [SP] Unloading plugin 'killmessage'...
2019-05-29 09:59:56 - sp - MESSAGE [SP] Successfully unloaded plugin 'killmessage'.
2019-05-29 09:59:56 - sp - MESSAGE [SP] Unloading plugin 'headshot'...
2019-05-29 09:59:56 - sp - MESSAGE [SP] Successfully unloaded plugin 'headshot'.
2019-05-29 09:59:56 - sp - MESSAGE [SP] Unloading plugin 'gamemode'...
2019-05-29 09:59:56 - sp - MESSAGE [SP] Successfully unloaded plugin 'gamemode'.
2019-05-29 09:59:57 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 09:59:57 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 09:59:57 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 09:59:57 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 09:59:57 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 09:59:57 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 10:21:12 - sp - MESSAGE [SP] Loading plugin 'country_tag'...
2019-05-29 10:21:12 - sp - MESSAGE [SP] Successfully loaded plugin 'country_tag'.
2019-05-29 10:21:12 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 10:21:12 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 10:21:12 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 10:21:12 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 10:21:12 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 10:21:12 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 10:21:13 - sp - MESSAGE [SP] Unloading plugin 'killmessage'...
2019-05-29 10:21:13 - sp - MESSAGE [SP] Successfully unloaded plugin 'killmessage'.
2019-05-29 10:21:13 - sp - MESSAGE [SP] Unloading plugin 'headshot'...
2019-05-29 10:21:13 - sp - MESSAGE [SP] Successfully unloaded plugin 'headshot'.
2019-05-29 10:21:13 - sp - MESSAGE [SP] Unloading plugin 'gamemode'...
2019-05-29 10:21:13 - sp - MESSAGE [SP] Successfully unloaded plugin 'gamemode'.
2019-05-29 10:21:13 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 10:21:13 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 10:21:13 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 10:21:13 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 10:21:13 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 10:21:13 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 10:21:26 - sp - MESSAGE [SP] Unloading plugin 'killmessage'...
2019-05-29 10:21:26 - sp - MESSAGE [SP] Successfully unloaded plugin 'killmessage'.
2019-05-29 10:21:26 - sp - MESSAGE [SP] Unloading plugin 'headshot'...
2019-05-29 10:21:26 - sp - MESSAGE [SP] Successfully unloaded plugin 'headshot'.
2019-05-29 10:21:26 - sp - MESSAGE [SP] Unloading plugin 'gamemode'...
2019-05-29 10:21:26 - sp - MESSAGE [SP] Successfully unloaded plugin 'gamemode'.
2019-05-29 10:21:26 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 10:21:26 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 10:21:26 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 10:21:26 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 10:21:26 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 10:21:26 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 10:21:34 - sp - MESSAGE [SP] Unloading plugin 'killmessage'...
2019-05-29 10:21:34 - sp - MESSAGE [SP] Successfully unloaded plugin 'killmessage'.
2019-05-29 10:21:34 - sp - MESSAGE [SP] Unloading plugin 'headshot'...
2019-05-29 10:21:34 - sp - MESSAGE [SP] Successfully unloaded plugin 'headshot'.
2019-05-29 10:21:34 - sp - MESSAGE [SP] Unloading plugin 'gamemode'...
2019-05-29 10:21:34 - sp - MESSAGE [SP] Successfully unloaded plugin 'gamemode'.
2019-05-29 10:21:34 - sp - MESSAGE [SP] Loading plugin 'killmessage'...
2019-05-29 10:21:34 - sp - MESSAGE [SP] Successfully loaded plugin 'killmessage'.
2019-05-29 10:21:34 - sp - MESSAGE [SP] Loading plugin 'headshot'...
2019-05-29 10:21:34 - sp - MESSAGE [SP] Successfully loaded plugin 'headshot'.
2019-05-29 10:21:34 - sp - MESSAGE [SP] Loading plugin 'gamemode'...
2019-05-29 10:21:34 - sp - MESSAGE [SP] Successfully loaded plugin 'gamemode'.
2019-05-29 10:28:27 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\packages\source-python\events\listener.py", line 92, in fire_game_event
callback(game_event)
File "..\addons\source-python\plugins\killmessage\killmessage.py", line 114, in player_death
attplayer = Player.from_userid(attacker)
File "..\addons\source-python\packages\source-python\players\_base.py", line 99, in from_userid
return cls(index_from_userid(userid))

ValueError: Conversion from "Userid" (0) to "Index" failed.


2019-05-29 10:28:51 - sp - EXCEPTION
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\packages\source-python\events\listener.py", line 92, in fire_game_event
callback(game_event)
File "..\addons\source-python\plugins\killmessage\killmessage.py", line 114, in player_death
attplayer = Player.from_userid(attacker)
File "..\addons\source-python\packages\source-python\players\_base.py", line 99, in from_userid
return cls(index_from_userid(userid))

ValueError: Conversion from "Userid" (0) to "Index" failed.

Re: killstreaks for hl2dm

Posted: Wed May 29, 2019 6:11 pm
by Kami
The error happens when a player dies without an attacking player (suicide). The error should not be a problem but for cosmetic reasons try this:

Syntax: Select all

from events import Event
from colors import Color
from players.entity import Player
from messages import HudMsg
import core
from listeners.tick import Delay
from filters.players import PlayerIter

from path import path as Path
import sys
import os
from configobj import ConfigObj
from stringtables.downloads import Downloadables


downloads = Downloadables()

kill_dict = {}
has_overlay = {}
cfg_list = []
#Helper Functions


def show_message(index, message):
HudMsg(
message=message,
x=0.01,
y=-0.88,
color1=Color(255,255,0),
color2=Color(255,0,0),
effect=2,
fade_in=0.01,
fade_out=1.5,
hold_time=8,
fx_time=1.0,
channel=2
).send(index)

def show_message_all(message):
HudMsg(
message=message,
x=0.01,
y=-0.88,
color1=Color(255,255,0),
color2=Color(205,0,0),
effect=2,
fade_in=0.01,
fade_out=1.5,
hold_time=8,
fx_time=1.0,
channel=2
).send()

def get_addon_path():
path = os.path.dirname(os.path.abspath(__file__))
return path

def test(index):
core.console_message(index)

def create_overlay(index, overlay):
player = Player(index)
player.client_command('r_screenoverlay %s' % overlay)
has_overlay[player.userid] = 1


def remove_overlay(index):
player = Player(index)
player.client_command('r_screenoverlay 0')


def play_sound(sound):
for player in PlayerIter("all"):
player.play_sound(sound,1.0,0.0, download=True)

#Ini Class
class InI(object):
def __init__(self):
self.path = get_addon_path()

self.config = os.path.join(self.path, 'config', 'frag.ini')

@property
def getConfigs(self):
return ConfigObj(self.config)

ini = InI()
for x in ini.getConfigs:
cfg_list.append(x)
file = ini.getConfigs[x]['attover']
file_vtf = file.replace('.vmt', '.vtf')
downloads.add('materials/' + file)
downloads.add('materials/' + file_vtf)



#Test Functions

def load():
for play in PlayerIter("all"):
kill_dict[play.userid] = 0
has_overlay[play.userid] = 0

@Event('player_connect')
def player_connect(ev):
userid = ev['userid']
kill_dict[userid] = 0
has_overlay[userid] = 0

@Event('player_death')
def player_death(ev):
victim = ev['userid']
attacker = ev['attacker']
if attacker:
attplayer = Player.from_userid(attacker)
else:
return
vicplayer = Player.from_userid(victim)
kill_dict[victim] = 0
if has_overlay[victim] == 1:
remove_overlay(vicplayer.index)
has_overlay[victim] = 0
kill_dict[attacker] += 1
if str(kill_dict[attacker]) in cfg_list:
num = str(kill_dict[attacker])
cfg = ini.getConfigs
message = cfg[num]['msg']
if "%s" in message:
message = message.replace("%s", attplayer.name)
msgto = cfg[num]['msgto']
snd = cfg[num]['snd']
attover = cfg[num]['attover']
if msgto == 'v':
msgto = Player.from_userid(victim).index
if msgto == 'a':
msgto = Player.from_userid(attacker).index
show_message_all(message)
play_sound(snd)
create_overlay(Player.from_userid(attacker).index, attover)

Re: killstreaks for hl2dm

Posted: Wed May 29, 2019 6:26 pm
by daren adler
Ok will do, thank you. Yes works great. thank you :cool:

Re: killstreaks for hl2dm

Posted: Wed May 29, 2019 7:45 pm
by satoon101
That still doesn't fully take suicides into account. I can't remember which cases happen when, but the attacker can be either 0 or the same as the victim when the death is a suicide. Not taking that into account can lead to setting a victim to 0 kills in the kill_dict, but then incrementing it by 1. To take suicide fully into account, I would recommend doing this at the top of the player_death function:

Syntax: Select all

@Event('player_death')
def player_death(ev):
victim = ev['userid']
attacker = ev['attacker']
if attacker in (0, victim):
return
attplayer = Player.from_userid(attacker)


As a critique of the plugin itself, I am not sure why you retrieve the Player instance several times in the same function. Once you have the value, use the variable you already have that set to.