PDA

View Full Version : Sandbag deploy fix


Vet
02-19-2009, 07:46 PM
Requested in THIS THREAD (http://www.dodplugins.net/forums/showthread.php?t=1527). No CVars or commands. Prevents the player from being able to deploy a weapon when turned away from a deployable sandbag.

Updated version 1.11 (4/16/09)
-

diamond-optic
02-19-2009, 09:46 PM
awesome.. ill check this out soon.

thanks 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
02-22-2009, 02:19 PM
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.
No other changes were made.

Dr.G
03-15-2009, 09:27 AM
good job on this vet

diamond-optic
03-18-2009, 08:18 PM
works nice..

only 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..

but thats a very small issue thats well worth the trade off of not being able to deploy facing the opposite direction of the sandbags

:D

Vet
03-24-2009, 02:21 AM
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
03-26-2009, 01:42 AM
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
03-27-2009, 04:40 AM
hey vet, something major went wrong after the last update...

L 03/27/2009 - 02:36:03: [DODX] Player out of range (308)
L 03/27/2009 - 02:36:03: [AMXX] Run time error 10 (plugin "dod_sandbag_deploy_fix.amxx") (native "get_user_weapon") - debug not enabled!
L 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)

im guessing it might just need a pev_valid(player) or player < 33 check before the is_deployable(id) is called..

but it made an error log of about 12mb lol.. pretty large number there ahhahah


and 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
03-27-2009, 12:48 PM
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
03-29-2009, 10:27 PM
I found out it wasn't a Linux only problem. I had big error logs too. I just didn't think to check them.

Anyway, lets try this version (1.10). It tests OK without errors on my Windows server.

diamond-optic
03-31-2009, 01:44 PM
seemed fine for a bit, but then got this:

L 03/31/2009 - 08:29:04: Info (map "dod_sturm") (file "addons/amxmodx/logs/error_20090331.log")
L 03/31/2009 - 08:29:04: [DODX] Player out of range (28)
L 03/31/2009 - 08:29:04: [AMXX] Displaying debug trace (plugin "dod_sandbag_deploy_fix.amxx")
L 03/31/2009 - 08:29:04: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 03/31/2009 - 08:29:04: [AMXX] [0] dod_sandbag_deploy_fix.sma::HAM_dts_Touch (line 79)

Vet
03-31-2009, 03:04 PM
I've got it checking as:
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.

Dr.G
03-31-2009, 04:41 PM
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
03-31-2009, 05:34 PM
I've got it checking as:
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.

whats strange is its giving me the error when player==28 (Player out of range (28))

which 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...


maybe set a maxplayers = get_maxplayers() or whatever global on like plugin_init and then check 0 < player < maxplayers

idk, 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
03-31-2009, 06:15 PM
nevermind (:

diamond-optic
03-31-2009, 07:59 PM
so far i have only got that error on sturm

Vet
04-01-2009, 03:15 PM
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.

Fysiks
04-07-2009, 10:44 AM
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
04-07-2009, 02:07 PM
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).

hmm in that case i would say its probably safe to assume that its for all half-life 1 based games then


but 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
04-13-2009, 10:35 PM
If that error is still showing try

#define IsPlayer(%1) ( 1 <= %1 <= gMaxPlayers )

// -> And in plugin_init

gMaxPlayers = get_maxplayers()

// -> In the function

if(!IsPlayer(id))
return HAM_IGNORED

Vet
04-16-2009, 11:53 PM
Updated to check for server max players.