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

Stop a bomb defusing


Post New Thread Reply   
 
Thread Tools Display Modes
Kigen
BANNED
Join Date: Feb 2008
Old 09-24-2009 , 21:30   Re: Stop a bomb defusing
Reply With Quote #31

Well, I found my old code. Still in one piece and good to go. Just gotta upgrade it a little to newer stuff they've added since SourceMod 1.1.0. And of course add a way to stop defusing.

Here is the m_fFlags defines. Maybe you could clean it up a little.

Code:
#define	FL_ONGROUND			(1 << 0)	// At rest / on the ground
#define FL_DUCKING			(1 << 1)	// Player flag -- Player is fully crouched
#define	FL_WATERJUMP		(1 << 2)	// player jumping out of water
#define FL_ONTRAIN			(1 << 3)	// Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_INRAIN			(1 << 4)	// Indicates the entity is standing in rain
#define FL_FROZEN			(1 << 5)	// Player is frozen for 3rd person camera
#define FL_ATCONTROLS		(1 << 6)	// Player can't move, but keeps key inputs for controlling another entity
#define	FL_CLIENT			(1 << 7)	// Is a player
#define FL_FAKECLIENT		(1 << 8)	// Fake client, simulated server side; don't send network messages to them
// NOTE if you move things up, make sure to change this value
#define PLAYER_FLAG_BITS	9
// NON-PLAYER SPECIFIC (i.e., not used by GameMovement or the client .dll ) -- Can still be applied to players, though
#define	FL_INWATER					(1 << 9)	// In water
#define	FL_FLY						(1 << 10)	// Changes the SV_Movestep() behavior to not need to be on ground
#define	FL_SWIM						(1 << 11)	// Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define	FL_CONVEYOR					(1 << 12)
#define	FL_NPC						(1 << 13)
#define	FL_GODMODE					(1 << 14)
#define	FL_NOTARGET					(1 << 15)
#define	FL_AIMTARGET				(1 << 16)	// set if the crosshair needs to aim onto the entity
#define	FL_PARTIALGROUND			(1 << 17)	// not all corners are valid
#define FL_STATICPROP				(1 << 18)	// Eetsa static prop!		
#define FL_GRAPHED					(1 << 19)	// worldgraph has this ent listed as something that blocks a connection
#define FL_GRENADE					(1 << 20)
#define FL_STEPMOVEMENT				(1 << 21)	// Changes the SV_Movestep() behavior to not do any processing
#define FL_DONTTOUCH				(1 << 22)	// Doesn't generate touch functions, generates Untouch() for anything it was touching when this flag was set
#define FL_BASEVELOCITY				(1 << 23)	// Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_WORLDBRUSH				(1 << 24)	// Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_OBJECT					(1 << 25)	// Terrible name. This is an object that NPCs should see. Missiles, for example.
#define FL_KILLME					(1 << 26)	// This entity is marked for death -- will be freed by game DLL
#define FL_ONFIRE					(1 << 27)	// You know...
#define FL_DISSOLVING				(1 << 28)	// We're dissolving!
#define FL_TRANSRAGDOLL				(1 << 29)	// In the process of turning into a client side ragdoll.
#define FL_UNBLOCKABLE_BY_PLAYER	(1 << 30)	// pusher that can't be blocked by the player
Kigen is offline
Kigen
BANNED
Join Date: Feb 2008
Old 09-24-2009 , 21:38   Re: Stop a bomb defusing
Reply With Quote #32

http://docs.sourcemod.net/api/index....ad=file&id=47&

m_fFlags has a wrapper for it in SourceMod called entitiy_prop_stocks. Interesting.
Kigen is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 09-24-2009 , 21:46   Re: Stop a bomb defusing
Reply With Quote #33

What are these?
Quote:
#define IN_USE (1 << 5)
#define IN_CANCEL (1 << 6)
__________________

Timiditas is offline
Kigen
BANNED
Join Date: Feb 2008
Old 09-24-2009 , 21:49   Re: Stop a bomb defusing
Reply With Quote #34

The IN_ defines are for the buttons. Obviously if we could define the buttons that would be a much cleaner way to do this.
Kigen is offline
Kigen
BANNED
Join Date: Feb 2008
Old 09-25-2009 , 00:00   Re: Stop a bomb defusing
Reply With Quote #35

I've been playing around with m_fFlags to stop defusing. Well, if the player holds down the use key you get a very annoying sound.


You may not defuse the bomb through the wall.
Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
set if the crosshair needs to aim onto the entity

That is the debug info I got from my plugin when testing your defuse stop.

Seems that you are setting the flags FL_ONTRAIN and FL_AIMTARGET. By default a player has FL_ONGROUND, FL_CLIENT, FL_INWATER, and FL_AIMTARGET set. I personally don't know why FL_INWATER is set. Either way, I personally think if you just remove the FL_ONGROUND from the list that the bomb defusing would stop.
Kigen is offline
Kigen
BANNED
Join Date: Feb 2008
Old 09-25-2009 , 01:03   Re: Stop a bomb defusing
Reply With Quote #36

Seems that just removing FL_ONGROUND doesn't work entirely. Since IN_USE is processed every frame it'll work for one frame then the ones that come after the person will be able to defuse. Setting m_fFlags to 8 does work in stopping the defusing successfully for every frame though on each of those frames a new defuse attempt is done causing the server to lag as your code for testing for the defuse and then stopping it is executed each and every frame the player has their use key pressed. I've tried a multitude of ways to prevent this but it seems that even hooking OnGameFrame() and setting m_fFlags to 8 when the player is in range to defuse doesn't work in preventing the defusing from happening in the first place.

In the end I think a hook onto ProcessUserCmds() is need in order to effectively stop the defusing either that or find a function CS:S is using to test if the player can defuse and hook into that.
Kigen is offline
Kigen
BANNED
Join Date: Feb 2008
Old 09-25-2009 , 01:07   Re: Stop a bomb defusing
Reply With Quote #37

Also, to note, this appears to be in effect in SourceMod 1.3. So I'll go ahead and build a proper plugin to patch this bug on SourceMod 1.3 and see if it works correctly.

OnPlayerRunCmd() for the win!
Kigen is offline
Timiditas
Senior Member
Join Date: Apr 2009
Old 09-25-2009 , 09:56   Re: Stop a bomb defusing
Reply With Quote #38

On TF2 its possible to "disable" the flag, maybe something similar is possible with the C4. Don't know how OnPlayerRunCmd will perform though.
__________________

Timiditas is offline
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 21:31.


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