[HL2:DM] Entity View

Please post any questions about developing your plugin here. Please use the search function before posting!
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

[HL2:DM] Entity View

Postby cssbestrpg » Fri Feb 18, 2022 2:43 pm

Hi, i have issue getting my code work properly in hl2dm.
When i look at health/suit charger it doesn't get any messages when suppose to.

Syntax: Select all

from messages import HudMsg
from listeners.tick import Repeat
from filters.players import PlayerIter
from colors import CYAN

_HUDMSG_X = -1
_HUDMSG_Y = 0.60
_HUDMSG_EFFECT = 0
_HUDMSG_FADEOUT = 0
_HUDMSG_HOLDTIME = 2
_HUDMSG_FXTIME = 0
_HUDMSG_CHANNEL = 5

msg = []

def check_msg():
for player in PlayerIter('alive'):
target = player.view_entity
if target and target.classname == 'item_healthcharger':
msg = 'I am not getting executed'
hudmessage(msg, player.index, CYAN)
if target and target.classname == 'item_suitcharger':
msg = 'I am not getting executed'
hudmessage(msg, player.index, CYAN)

def hudmessage(text, index, color):
HudMsg(text, color1=color, x=_HUDMSG_X, y=_HUDMSG_Y,
effect=_HUDMSG_EFFECT,
fade_out=_HUDMSG_FADEOUT,
hold_time=_HUDMSG_HOLDTIME,
fx_time=_HUDMSG_FXTIME,
channel=_HUDMSG_CHANNEL
).send(index)

msg_check = Repeat(check_msg)
msg_check.start(0.1)
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Re: [HL2:DM] Entity View

Postby satoon101 » Fri Feb 18, 2022 11:56 pm

I'm not sure what to tell you. It works perfectly fine when I test it.
Image
User avatar
daren adler
Senior Member
Posts: 328
Joined: Sat May 18, 2019 7:42 pm

Re: [HL2:DM] Entity View

Postby daren adler » Sat Feb 19, 2022 12:27 am

I also used it and works great, i did have to change the channel number, but other then that works great.
cssbestrpg
Senior Member
Posts: 287
Joined: Sun May 17, 2020 7:56 am
Location: Finland
Contact:

Re: [HL2:DM] Entity View

Postby cssbestrpg » Sat Feb 19, 2022 10:15 am

I found the issue, i should have use elif instead if word for each check entity, after i changed it to elif it started working fine on my side

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 43 guests