| closedstickgrenade_ex bug fix |
| Started by Vet on 05-05-2009, 10:38 PM |
Threads: 24
Joined: Oct 2006
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.
Threads: 103
Joined: May 2005
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)
Threads: 24
Joined: Oct 2006
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}Threads: 103
Joined: May 2005
doesnt seem to be fixing it for me on a local win32 server
Threads: 24
Joined: Oct 2006
Try it with a separate variable for pev_weapons as shown. Seems to be more stable that way.
Threads: 103
Joined: May 2005
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 notThreads: 24
Joined: Oct 2006
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.
Threads: 103
Joined: May 2005
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
Threads: 24
Joined: Oct 2006
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.
Threads: 75
Joined: Nov 2007
where is the source code for dodfun and dodx ?
Threads: 103
Joined: May 2005
where is the source code for dodfun and dodx ?nnnhttp://svn.alliedmods.net/viewvc.cgi/trunk/dlls/dod/?root=amxmodx
Threads: 24
Joined: Oct 2006
I submitted a bug report at alliedmods and put a post in Zor's bug thread.
Threads: 103
Joined: May 2005
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
Threads: 103
Joined: May 2005
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 :)
