Hello once again!
I was wondering if there was a way to find func_button with specific targetname and also find out who pressed that button?
Thanks in advance
finding out who used func_button?
Re: finding out who used func_button?
Something like this might work:
http://wiki.sourcepython.com/developing ... tityoutput
https://developer.valvesoftware.com/wiki/Func_button
Syntax: Select all
from listeners import OnEntityOutput
YOUR_TARGET_NAME = 'IDK'
@OnEntityOutput
def on_entity_output(output_name, activator, caller, value, delay):
if output_name != 'OnPressed':
return
if caller.classname != 'func_button':
return
if caller.targetname != YOUR_TARGET_NAME:
return
try:
player = Player(activator.index)
except ValueError:
return
print('Player {} activated the button.'.format(player.name))
http://wiki.sourcepython.com/developing ... tityoutput
https://developer.valvesoftware.com/wiki/Func_button
Re: finding out who used func_button?
Ayuto wrote:Something like this might work:Syntax: Select all
from listeners import OnEntityOutput
YOUR_TARGET_NAME = 'IDK'
@OnEntityOutput
def on_entity_output(output_name, activator, caller, value, delay):
if output_name != 'OnPressed':
return
if caller.classname != 'func_button':
return
if caller.targetname != YOUR_TARGET_NAME:
return
try:
player = Player(activator.index)
except ValueError:
return
print('Player {} activated the button.'.format(player.name))
http://wiki.sourcepython.com/developing ... tityoutput
https://developer.valvesoftware.com/wiki/Func_button
Thanks! But this gives me "AttributeError: Attribute "targetname" not found" when I press my button
But yeah this is progress so thank you! :)
Game: csgo build: 486 in case that matters
Re: finding out who used func_button?
targetname -> target_name

My plugins: Map Cycle • Killstreaker • DeadChat • Infinite Jumping • TripMines • AdPurge • Bot Damage • PLRBots • Entity AntiSpam
Hail, Companion. [...] Hands to yourself, sneak thief.

Re: finding out who used func_button?
iPlayer wrote:targetname -> target_name
This fixed it
Return to “Plugin Development Support”
Who is online
Users browsing this forum: No registered users and 65 guests