Page 1 of 1

Hook Player Spray

Posted: Thu Apr 02, 2020 9:59 pm
by decompile
Hello,

could you tell me how I can hook player sprays in CS:S?

I just need the information which index used the spray.

Thanks

Re: Hook Player Spray

Posted: Thu Apr 02, 2020 10:05 pm
by VinciT
I believe you can use the player_decal event for that.

Syntax: Select all

from events import Event
from players.entity import Player


@Event('player_decal')
def player_spray(event):
player = Player.from_userid(event['userid'])

Re: Hook Player Spray

Posted: Thu Apr 02, 2020 10:42 pm
by decompile
Thank you :)

Re: Hook Player Spray

Posted: Wed May 26, 2021 11:30 pm
by Zeus
Would implementing a "spray ban" feature be as simple as just blocking this event with a pre-event hook?

(also sry if i'm not supposed to necro old posts, i can make a seperate post if nessessary)

Re: Hook Player Spray

Posted: Wed May 26, 2021 11:52 pm
by L'In20Cible
Zeus wrote:Would implementing a "spray ban" feature be as simple as just blocking this event with a pre-event hook?


Syntax: Select all

from effects.hooks import TempEntityPreHook
from messages import SayText2

denied_message = SayText2('Sorry, you cannot use spray on this server.')

@TempEntityPreHook('Player Decal')
def pre_player_decal(te, recipients):
denied_message.send(te.player_index)
return False