Hook Player Spray

Please post any questions about developing your plugin here. Please use the search function before posting!
decompile
Senior Member
Posts: 387
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Hook Player Spray

Postby decompile » Thu Apr 02, 2020 9:59 pm

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
User avatar
VinciT
Senior Member
Posts: 315
Joined: Thu Dec 18, 2014 2:41 am

Re: Hook Player Spray

Postby VinciT » Thu Apr 02, 2020 10:05 pm

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'])
ImageImageImageImageImage
decompile
Senior Member
Posts: 387
Joined: Sat Oct 10, 2015 10:37 am
Location: Germany
Contact:

Re: Hook Player Spray

Postby decompile » Thu Apr 02, 2020 10:42 pm

Thank you :)
User avatar
Zeus
Member
Posts: 51
Joined: Sat Mar 24, 2018 5:25 pm
Location: Chicago
Contact:

Re: Hook Player Spray

Postby Zeus » Wed May 26, 2021 11:30 pm

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)
User avatar
L'In20Cible
Project Leader
Posts: 1435
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Hook Player Spray

Postby L'In20Cible » Wed May 26, 2021 11:52 pm

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

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 6 guests