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

Block touch in entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
quilhos
Veteran Member
Join Date: Jun 2010
Old 12-27-2014 , 00:17   Block touch in entities
Reply With Quote #1

I'm trying to block a spectator player to touch on certain amount of entities in the server
Examples
Code:
opening a door 
pick up weapons
touching a button
touch a football ball
pick up presents from the ground
Sound - USE FUNCTION (when the spectator players use "E" the other players in Terrorist / CT dont hear the sound of him using E)
As far as I tried I come up with this, but I have little understanding of the func_ and the classnames of the entities.

PHP Code:
    RegisterHam(Ham_Touch"weaponbox""blocked_entity");
    
RegisterHam(Ham_Touch"armoury_entity""blocked_entity");
    
RegisterHam(Ham_Touch"weapon_shield""blocked_entity");
    
    
RegisterHam(Ham_Touch"func_wall""blocked_entity");
    
RegisterHam(Ham_Use"func_button""blocked_entity");
    
RegisterHam(Ham_Touch"func_door""blocked_entity");
    
RegisterHam(Ham_Touch"func_door_rotation""blocked_entity");
    
RegisterHam(Ham_Touch"func_touchable""blocked_entity"); 
blocked entity public function
PHP Code:
public blocked_entity(weapon,id)
{
    if(!
is_user_connected(id))
        return 
HAM_IGNORED
        
    
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
        return 
HAM_SUPERCEDE
        
    
return HAM_IGNORED;

Note
Code:
Use buttons - working
PickUp weapons - working
touching a button - working
opening a door - working
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!

Last edited by quilhos; 12-27-2014 at 15:39.
quilhos is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2014 , 05:58   Re: Block touch in entities
Reply With Quote #2

I'm missing something ? A spectator can only spectate and can't play. Sure that a bug may happen when you change it's team without killing him, when he can move on the map.

For func_door and func_door_rotating you should hook Ham_Use and not Ham_Touch.
For eliminating the "use" sound I think than you can filter it in PlayBackEvent, if you want that he can hear the sound and the others not.
__________________
HamletEagle is offline
Old 12-27-2014, 07:58
ironskillz1
This message has been deleted by ironskillz1. Reason: Nvm
quilhos
Veteran Member
Join Date: Jun 2010
Old 12-27-2014 , 15:05   Re: Block touch in entities
Reply With Quote #3

Spectators can actually play but they are not allow to interfere with the gameplay. Like in hns /spec!
All entities blocked sucessfully, thx guys.

Just one question, how do I block the sound of a player using +use.
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!

Last edited by quilhos; 12-27-2014 at 15:38.
quilhos is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2014 , 15:07   Re: Block touch in entities
Reply With Quote #4

Then the spec is bugged as I explained above. If this is wanted then you need to filter stuff by stuff as you already did.
__________________
HamletEagle is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 12-27-2014 , 16:10   Re: Block touch in entities
Reply With Quote #5

I know that. I'm trying to understand how do I block the emit sound of:
Code:
when a spectator touch a button, that button is blocked, but emit the sound;
when a spectator jump emit the sound of him falling;
when a spectator click +use emit a sound.
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
ironskillz1
AlliedModders Donor
Join Date: Jul 2012
Location: Sweden
Old 12-27-2014 , 16:58   Re: Block touch in entities
Reply With Quote #6

Quote:
Originally Posted by quilhos View Post
I know that. I'm trying to understand how do I block the emit sound of:
Code:
when a spectator touch a button, that button is blocked, but emit the sound;
when a spectator jump emit the sound of him falling;
when a spectator click +use emit a sound.
https://forums.alliedmods.net/showthread.php?t=45461
__________________
I have many private and unique plugins for Jailbreak and Hide'N'Seek. PM me for more info.

Pm me.

Check out my roulette site.
ironskillz1 is offline
Send a message via Skype™ to ironskillz1
quilhos
Veteran Member
Join Date: Jun 2010
Old 12-28-2014 , 14:38   Re: Block touch in entities
Reply With Quote #7

Quote:
Originally Posted by ironskillz1 View Post
That doesnt help. I want some way to block what players in CT or T team hear and not only what the spectator hear.

I'll give you an example of I'm trying to do, changing the original code from hornet's jump sound blocker plugin
https://forums.alliedmods.net/showpo...8&postcount=24
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!

Last edited by quilhos; 12-28-2014 at 14:41.
quilhos is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-28-2014 , 15:14   Re: Block touch in entities
Reply With Quote #8

About sound, old code where you can grab some way: https://forums.alliedmods.net/showpo...3&postcount=10
Basically, updating movevars allows you to have mp_footstep value per client. So if you want to block footstep on specific player, you have no choice to use this method: detecting when SVC_NEWMOVEVARS message is going to be sent, blocking it, and resending it for the target player with custom value.
__________________

Last edited by Arkshine; 12-28-2014 at 15:17.
Arkshine is offline
quilhos
Veteran Member
Join Date: Jun 2010
Old 12-29-2014 , 20:28   Re: Block touch in entities
Reply With Quote #9

Quote:
Originally Posted by Arkshine View Post
About sound, old code where you can grab some way: https://forums.alliedmods.net/showpo...3&postcount=10
Basically, updating movevars allows you to have mp_footstep value per client. So if you want to block footstep on specific player, you have no choice to use this method: detecting when SVC_NEWMOVEVARS message is going to be sent, blocking it, and resending it for the target player with custom value.
I'm sorry, I'm not able to understand that code. Its too damn advanced for me =D, basicly you write the MoveVars per client, in the function sendNewMoveVars. But how should I write only the jump, and fall sounds (is the footsteps functions I suppose)?
__________________
ELO RATING SYSTEM - SQL [COMPLETE]
Quote:
Originally Posted by Liverwiz View Post
DDDRRRRAAAAMMMMAAAAA!!!???

Put this shit on pause while i go get some popcorn!!
quilhos is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-30-2014 , 05:02   Re: Block touch in entities
Reply With Quote #10

If mp_footsteps is set to 0, you don't hear sound on jump, right? If so, this method is for you.

MoveVars are synced with some mp_/sv_ server cvars. If for example you set mp_footsteps to 0, engine will check if there is a change between current movevars[footsteps] and mp_footsteps value. If so, an engine SVC_NEWMOVEVARS message with this change is sent to all clients.

You could test by setting mp_footsteps to 1, and just sending this message on you with 0 for footsteps argument, and you won't hear your own sounds. But once this message sent, if you set any others server cvars like mp_gravity/stopspeed/friction/etc.., a new message will be sent with current mp_footsteps value, and it will overwrite your previous message. That's why you need to hook some engine functions to know when this message is going to be sent, then blocking the function, and resending the message with the value you want.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

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 05:10.


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