Sandbag deploy fix
by Vet · 2009-02-19 · 20 replies · 13658 views · 56 downloads
From the first post
rn
rnUpdated version 1.11 (4/16/09)
rn-
The thread
All 21 posts from 4 people on Sandbag deploy fix, kept as they were written.
Threads: 24
Joined: Oct 2006
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-
Threads: 103
Joined: May 2005
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)
Threads: 24
Joined: Oct 2006
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.
Threads: 75
Joined: Nov 2007
good job on this vet
Threads: 103
Joined: May 2005
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
Threads: 24
Joined: Oct 2006
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.
Threads: 24
Joined: Oct 2006
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.
Threads: 103
Joined: May 2005
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
Threads: 24
Joined: Oct 2006
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.
Threads: 24
Joined: Oct 2006
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.
Threads: 103
Joined: May 2005
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)
Threads: 24
Joined: Oct 2006
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.Threads: 75
Joined: Nov 2007
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...
Threads: 103
Joined: May 2005
I've got it checking as:nnnwhats 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 usedIDK what else to try. Maybe I'll have to set up a Linux server to start testing things.if (pev_valid(player) && (0 < player < 33))
Threads: 103
Joined: May 2005
so far i have only got that error on sturm
Threads: 24
Joined: Oct 2006
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.
Threads: 3
Joined: Aug 2007
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).
Threads: 103
Joined: May 2005
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
Threads: 75
Joined: Nov 2007
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_IGNOREDThreads: 24
Joined: Oct 2006
Updated to check for server max players.

