Block MSG_ALL SVC_TEMPENTITY for a player
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.
|
Re: Block MSG_ALL SVC_TEMPENTITY for a player
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. |
Re: Block MSG_ALL SVC_TEMPENTITY for a player
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?
|
Re: Block MSG_ALL SVC_TEMPENTITY for a player
Use set_msg_block if unable to rewrite the source. Remember to use MSG_ONE/MSG_ONE_UNRELIABLE for 'specified clients'. What broadcast?
|
Re: Block MSG_ALL SVC_TEMPENTITY for a player
Quote:
|
Re: Block MSG_ALL SVC_TEMPENTITY for a player
Can't do that with broadcast. Try it. Crash.
|
Re: Block MSG_ALL SVC_TEMPENTITY for a player
Quote:
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. |
Re: Block MSG_ALL SVC_TEMPENTITY for a player
Thanks, ill try it and be back with a feedback!
But adding a delay seems like a bad idea. |
Re: Block MSG_ALL SVC_TEMPENTITY for a player
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. |
Re: Block MSG_ALL SVC_TEMPENTITY for a player
Quote:
|
All times are GMT -4. The time now is 12:59. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.