Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › DoD Plugins › Non Developer Plugins › stickgrenade_ex bug fix
14 posts, 3 people · 10,598 views Thread Rating: ★★★★★
closedstickgrenade_ex bug fix
Started by Vet on 05-05-2009, 10:38 PM
Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-05-2009, 10:38 PM #1

The bug:rnIf you pick up and rethrow a stickgrenade, the invprev and invnext commands don't work properly in that it hangs at the lowest/highest available weapon instead of 'wrapping around' to the next weapon as usual. This bug also assumes you use hud_fastswitch. Otherwise it wraps around, but displays a 'blank' weapon in between (Thanks Fysiks).rnrnI experience this bug on both Windows and Linux servers. I haven't found anything addressing it on any forum I've searched.rnrnI have a plugin that fixes this bug as stated (takes all of 2 lines of code), but I need to know if there's more to the bug. So before I post the fix, I'd like to know... are others having this problem or is it just me? Are there other circumstances involved? All I ask is if you have anything to add, please be thorough in you explanation.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
05-06-2009, 12:10 AM #2

i think i know what youre talking about... never had any idea why it was happening..nnbut it surely pisses me off when i scroll my mouse wheel one way and i cant get to the weapon i want because it just stops short of it.. and i have to go the other way to get to it...nn(my server is linux btw)

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-06-2009, 12:17 AM #3

It happens because pev_weapons doesn't get updated when you throw a stickgrenade_ex. So its trying to switch to a non-existant weapon. The fix is simply to reset pev_weapons:rnrn

#include <amxmisc>rn#include <fakemeta>rn#include <dodfun>rnrn#define PLUGIN "DOD_stick_ex_fix"rn#define VERSION "1.2"rn#define AUTHOR "Vet(3TT3V)"rnrn#define STICK_EX  32768	// (1<<DODW_STICKGRENADE_EX)rnrnpublic plugin_init()rn{rn	register_plugin(PLUGIN, VERSION, AUTHOR)rn}rnrnpublic grenade_throw(id, entid, type)rn{rn	static w_temprn	if (type == DODW_STICKGRENADE_EX) {rn		w_temp = pev(id, pev_weapons) - STICK_EXrn		set_pev(id, pev_weapons, w_temp)rn	}rn}
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
05-07-2009, 10:38 PM #4

doesnt seem to be fixing it for me on a local win32 server

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-07-2009, 11:35 PM #5

Try it with a separate variable for pev_weapons as shown. Seems to be more stable that way.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
05-07-2009, 11:51 PM #6

i figured id add some client_prints and see if it wasnt going all the way thru the code..nni tried this:n

npublic grenade_throw(id, entid, type)n{n    client_print(id,print_chat,"throw 1")nn    if (type == DODW_STICKGRENADE_EX)n        {n        client_print(id,print_chat,"throw 2")n        n        set_pev(id, pev_weapons, pev(id, pev_weapons) - STICK_EX)n        }n}
and only 'throw 1' shows up for me.. 'throw 2' does not

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-08-2009, 01:15 AM #7

I bet you're using v1.8 of the dod_fun module. It returns the wrong type value for stickgrenade and stickgrenade_ex. Use v1.76b of the dod_fun module and you should be OK.

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

alright ill give that a try..nnis there anything else different between the 2 versions.. like was anything fixed in the new one instead of broken lol

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-08-2009, 08:51 AM #9

I'm not sure what all changed. I suppose a guy could wallow throught the change logs. I see that Zor has THIS THREAD going. But I haven't seen any new activity lately.

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

where is the source code for dodfun and dodx ?

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
05-08-2009, 12:59 PM #11
where is the source code for dodfun and dodx ?
nnnhttp://svn.alliedmods.net/viewvc.cgi/trunk/dlls/dod/?root=amxmodx

Vet
started this thread
Posts: 229
Threads: 24
Joined: Oct 2006
05-09-2009, 12:03 AM #12

I submitted a bug report at alliedmods and put a post in Zor's bug thread.

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
09-06-2009, 11:56 PM #13

i forgot to post this a long time ago.. so ill do it now :Pnnon my linux server.. the grenade_throw (with dodx 1.8.1.3746) forward returns DODW_HANDGRENADE for the initial grenade throw no matter what kind of nade you throw, and it also returns DODW_HANDGRENADE_EX for a primed nade no matter what kind of nade it is

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
09-07-2009, 02:09 AM #14

i probably should have posted what code im using too lolnn

#include <amxmisc>n#include <engine>n#include <dodfun>nn#define PLUGIN "DOD_stick_ex_fix"n#define VERSION "1.2"n#define AUTHOR "Vet(3TT3V)"nn#define STICK_EX    (1<<DODW_STICKGRENADE_EX)nnnew is_linuxnnpublic plugin_init()n    register_plugin(PLUGIN, VERSION, AUTHOR)nnpublic plugin_cfg()n    if(is_linux_server())n        is_linux = truennpublic grenade_throw(id,entid,type)n{n    switch(is_linux)n        {n        case false:n            {n            if(type == DODW_STICKGRENADE_EX)n                entity_set_int(id,EV_INT_weapons,entity_get_int(id,EV_INT_weapons) - STICK_EX)n            }n        case true:n            {n            if(type == DODW_HANDGRENADE_EX)n                {n                static classname[32]n                entity_get_string(entid,EV_SZ_classname,classname,31)n            n                if(equal(classname,"grenade2"))n                    entity_set_int(id,EV_INT_weapons,entity_get_int(id,EV_INT_weapons) - STICK_EX)n                }n            }n        }n}
nnif i had any idea how to compile linux binaries id just post the fixed dodfun module.. but ehh idk what im doing when it comes to compiling for linux :)

Archive › Old Forum Threads › DoD Plugins › Non Developer Plugins › stickgrenade_ex bug fix
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC