killstreaks for hl2dm

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
User avatar
daren adler
Senior Member
Posts: 328
Joined: Sat May 18, 2019 7:42 pm

killstreaks for hl2dm

Postby daren adler » Sat May 18, 2019 7:53 pm

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:
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: killstreaks for hl2dm

Postby Painkiller » Mon May 20, 2019 11:23 am

Hello test this one.

I do not remember where,
but it worked.

(I use it for Black Mesa Source maybe it's in hl2dm)
Attachments
killmessage.rar
(1.68 KiB) Downloaded 566 times
User avatar
daren adler
Senior Member
Posts: 328
Joined: Sat May 18, 2019 7:42 pm

Re: killstreaks for hl2dm

Postby daren adler » Tue May 21, 2019 5:19 am

Thanks man.Works GREAT.
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Re: killstreaks for hl2dm

Postby Kami » Thu May 23, 2019 6:48 pm

Thanks. (I would recognize my crappy coding everywhere ;D)
User avatar
Painkiller
Senior Member
Posts: 725
Joined: Sun Mar 01, 2015 8:09 am
Location: Germany
Contact:

Re: killstreaks for hl2dm

Postby Painkiller » Sun May 26, 2019 8:20 am

You did fine.
User avatar
daren adler
Senior Member
Posts: 328
Joined: Sat May 18, 2019 7:42 pm

Re: killstreaks for hl2dm

Postby daren adler » Wed May 29, 2019 3:34 pm

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.
User avatar
Kami
Global Moderator
Posts: 263
Joined: Wed Aug 15, 2012 1:24 am
Location: Germany

Re: killstreaks for hl2dm

Postby Kami » Wed May 29, 2019 6:11 pm

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)
User avatar
daren adler
Senior Member
Posts: 328
Joined: Sat May 18, 2019 7:42 pm

Re: killstreaks for hl2dm

Postby daren adler » Wed May 29, 2019 6:26 pm

Ok will do, thank you. Yes works great. thank you :cool:
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: killstreaks for hl2dm

Postby satoon101 » Wed May 29, 2019 7:45 pm

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.
Image

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 31 guests