Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin

Sandbag deploy fix

by Vet · 2009-02-19 · 20 replies · 13658 views · 56 downloads

Read the thread (21 posts)

From the first post

Requested in THIS THREAD. No CVars or commands. Prevents the player from being able to deploy a weapon when turned away from a deployable sandbag.
rn
rnUpdated version 1.11 (4/16/09)
rn-

Files

dod_sandbag_deploy_fix.sma Plugin Source 3 KB 56 dl Download Compile

The thread

All 21 posts from 4 people on Sandbag deploy fix, kept as they were written.

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
02-19-2009, 07:46 PM #1

Requested in THIS THREAD. No CVars or commands. Prevents the player from being able to deploy a weapon when turned away from a deployable sandbag.rnrnUpdated version 1.11 (4/16/09)rn-

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
02-19-2009, 09:46 PM #2

awesome.. ill check this out soon.nnthanks alot as this is something that really annoys me sometimes when ppl deploy facing the wrong way right near the enemy spawn exit lol (tho i guess its not much different then being on the other side of the sandbag and deploying lol)

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
02-22-2009, 02:19 PM #3

Updated code to v1.8. A couple of maps returned array 'out of range' errors so I had to increase the size of an array.rnNo other changes were made.

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
03-15-2009, 08:27 AM #4

good job on this vet

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
03-18-2009, 07:18 PM #5

works nice..nnonly issue ive seen so far is sometimes if youre in a deploy zone and you turn (far enough where it stops you from deploying [hence stopping you from turning around and deploying real fast]) then you turn back facing the proper way.. you sometimes cant deploy when you should be able to.. but all you gotta do is back up a few steps then go forward again or such..nnbut thats a very small issue thats well worth the trade off of not being able to deploy facing the opposite direction of the sandbagsnn:D

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
03-24-2009, 01:21 AM #6

I suppose its for the same reason that allowed the deployment outside of range. The game only checks the relationship once per second. So I recon you need to be outside the cone of deployment to reset it too. I'll look into it soon. Hopfully, monitoring and setting it manually all the time won't cause too much burden.

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
03-26-2009, 12:42 AM #7

I updated the code to always check the player's position while touching the sandbags. This should cure the 'wait to deploy' problem. Hopefuly it doesn't introduce others.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
03-27-2009, 03:40 AM #8

hey vet, something major went wrong after the last update... nn

L 03/27/2009 - 02:36:03: [DODX] Player out of range (308)nL 03/27/2009 - 02:36:03: [AMXX] Run time error 10 (plugin "dod_sandbag_deploy_fix.amxx") (native "get_user_weapon") - debug not enabled!nL 03/27/2009 - 02:36:03: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
havent had a chance to put it in debug mode yet, i will if you arent able to 'assume' where or what might be causing this without the debug mode.. (since the get_user_weapon is only called on the is_deployable function, which is only called in one place in the code)nnim guessing it might just need a pev_valid(player) or player < 33 check before the is_deployable(id) is called..nnbut it made an error log of about 12mb lol.. pretty large number there ahhahahnnnand btw this is on a linux server, which lately ive noticed usually needs pev_valid checks that dont seem to always be needed on a win32 server for some reason

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
03-27-2009, 11:48 AM #9

Hmmm, I figured checking if the entity was crouched or prone would be plenty good. I didn't know of any other entity type that would set those flags. Oh well, back to the ol' drawing board.

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
03-29-2009, 09:27 PM #10

I found out it wasn't a Linux only problem. I had big error logs too. I just didn't think to check them.rnrnAnyway, lets try this version (1.10). It tests OK without errors on my Windows server.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
03-31-2009, 12:44 PM #11

seemed fine for a bit, but then got this:nn

L 03/31/2009 - 08:29:04: Info (map "dod_sturm") (file "addons/amxmodx/logs/error_20090331.log")nL 03/31/2009 - 08:29:04: [DODX] Player out of range (28)nL 03/31/2009 - 08:29:04: [AMXX] Displaying debug trace (plugin "dod_sandbag_deploy_fix.amxx")nL 03/31/2009 - 08:29:04: [AMXX] Run time error 10: native error (native "get_user_weapon")nL 03/31/2009 - 08:29:04: [AMXX] [0] dod_sandbag_deploy_fix.sma::HAM_dts_Touch (line 79)
Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
03-31-2009, 02:04 PM #12

I've got it checking as:rn

if (pev_valid(player) && (0 < player < 33)) 
rnIDK what else to try. Maybe I'll have to set up a Linux server to start testing things.

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
03-31-2009, 03:41 PM #13

maybe a stupid question, but why do we care about the touch if the users weapon isnt a deployable one? every error i get is when i go to a sandbag and kill myself...

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
03-31-2009, 04:34 PM #14
I've got it checking as:n
if (pev_valid(player) && (0 < player < 33)) 
IDK what else to try. Maybe I'll have to set up a Linux server to start testing things.
nnwhats strange is its giving me the error when player==28 (Player out of range (28))nnwhich i dont think should happen anyway.. i mean yeah my server is only 25 slots, but i always thought 1-32 are reserved for players even if you dont have a 32 slot server...nnnmaybe set a maxplayers = get_maxplayers() or whatever global on like plugin_init and then check 0 < player < maxplayersnnidk, im confused as to how an entity had an id of 28 for me anyway since with 25 slots it shouldnt even be used

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
03-31-2009, 05:15 PM #15

nevermind (:

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
03-31-2009, 06:59 PM #16

so far i have only got that error on sturm

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
04-01-2009, 02:15 PM #17

Good idea about setting the check for the max number of players the server can hold instead of figuring its always 32. In fact, maybe that ought to be kind of a 'standard'. Perhaps another plugin is creating an entity (I know I've written several that do) and the first 'open' entity slot is <32.

F Fysiks
posted here
Posts: 108
Threads: 3
Joined: Aug 2007
04-07-2009, 09:44 AM #18

At AlliedModders, Exolent said that the first map entity number is maxplayers +1. I don't know if that is true or even just true for CS (since he doesn't play DOD).

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
04-07-2009, 01:07 PM #19
At AlliedModders, Exolent said that the first map entity number is maxplayers +1. I don't know if that is true or even just true for CS (since he doesn't play DOD).
nnhmm in that case i would say its probably safe to assume that its for all half-life 1 based games thennnnbut its wierd i only get this error on sturm, but i get it almost constantly on that map.. so there must be an entity that touches one of the sandbag deploy thingys that gets an id of 28 on my server

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
04-13-2009, 09:35 PM #20

If that error is still showing tryrnrn

#define IsPlayer(%1)    ( 1 <= %1 <= gMaxPlayers )rnrn// -> And in plugin_initrnrngMaxPlayers = get_maxplayers() rnrn// -> In the functionrnrnif(!IsPlayer(id))rn       return HAM_IGNORED
Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
04-16-2009, 10:53 PM #21

Updated to check for server max players.

DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC