Raised This Month: $51 Target: $400
 12% 

Solved Block MSG_ALL SVC_TEMPENTITY for a player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-22-2021 , 19:47   Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #1

Hello, i would like to know if its possible to block SVC_TEMPENTITY Messages from some players, when the dest is MSG_ALL or MSG_BROADCAST.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-25-2021 at 15:28.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-23-2021 , 06:40   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #2

You can try to hook pfnMessageBegin, check if the second argument(msg_type) is SVC_TEMPENTITY and block the call. Then, block all subsequent calls of pfnWriteByte, pfnWriteChar, pfnWriteShort, pfnWriteLong, pfnWriteAngle, pfnWriteCoord, pfnWriteString, pfnWriteEntity until you encounter a pfnMessageEnd and then stop blocking messages. This is because the start of a message is signaled by pfnMessageBegin and the end by pfnMessageEnd. Between begin and end there are calls to pass arguments that also need to be blocked.

You can do this with orpheu, the same way you hooked pfnSetModel.
__________________

Last edited by HamletEagle; 10-23-2021 at 06:44.
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-23-2021 , 08:12   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #3

So basically i need to copy all the message subsequent values and msg type then block the message then send the message to the desired clients, right?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-23-2021 , 08:33   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #4

Use set_msg_block if unable to rewrite the source. Remember to use MSG_ONE/MSG_ONE_UNRELIABLE for 'specified clients'. What broadcast?
__________________
DJEarthQuake is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-23-2021 , 08:37   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #5

Quote:
Originally Posted by DJEarthQuake View Post
Use set_msg_block if unable to rewrite the source. Remember to use MSG_ONE/MSG_ONE_UNRELIABLE for 'specified clients'. What broadcast?
You misunderstood what i really want , i don't want to completely block the message i just want to block it from a couple of players.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-23-2021 at 11:51.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 10-23-2021 , 08:43   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #6

Can't do that with broadcast. Try it. Crash.
__________________
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-23-2021 , 11:03   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
So basically i need to copy all the message subsequent values and msg type then block the message then send the message to the desired clients, right?
Yes, so how I would do it is:
1. pfnMessageBegin called, initialize a structure to save message arguments. I would save it a list of (arg type, arg value) where arg type is short, string, entity, coord etc. Also save the message type(MSG_ALL/BROADCAST). Block the call.
2. On each call of pfnWrite* functions add an entry to your list/array, in the format (type, value). Block the calls.
3. On pfnMessageEnd block the original call, send a new message using MSG_ONE/MSG_ONE_UNRELIABLE(depending on if the original message was broadcast/all) to all players EXCEPT the ones you want to ignore. Compose the message back using the information you saved. Clear the list to prepare for a new message.
From pfnMessageEnd hook you may be unable to immediately send another message(needs to be tested). If you can't, add a small delay of 0.1 seconds.
__________________

Last edited by HamletEagle; 10-23-2021 at 11:05.
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-23-2021 , 11:35   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #8

Thanks, ill try it and be back with a feedback!

But adding a delay seems like a bad idea.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-23-2021 at 11:36.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-23-2021 , 12:21   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #9

I already mentioned the delay should be considered only if you can't immediately send another message from pfnMessageEnd. Either use a small task, a thinking entity that would allow you to think faster than 0.1 seconds or if you are using amxx 1.9+ look into http://amxmodx.org/api/amxmodx/RequestFrame
I repeat, test without any kind of delays. If the server crashes then consider adding a delay.
__________________

Last edited by HamletEagle; 10-23-2021 at 12:22.
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-25-2021 , 15:27   Re: Block MSG_ALL SVC_TEMPENTITY for a player
Reply With Quote #10

Quote:
Originally Posted by HamletEagle View Post
I already mentioned the delay should be considered only if you can't immediately send another message from pfnMessageEnd. Either use a small task, a thinking entity that would allow you to think faster than 0.1 seconds or if you are using amxx 1.9+ look into http://amxmodx.org/api/amxmodx/RequestFrame
I repeat, test without any kind of delays. If the server crashes then consider adding a delay.
Problem solved it worked there was no need for a delay since the message_end & message_begin were blocked.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 10-25-2021 at 15:27.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode