View Full Version : stickgrenade_ex bug fix
The bug:
If 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).
I experience this bug on both Windows and Linux servers. I haven't found anything addressing it on any forum I've searched.
I 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
05-06-2009, 01:10 AM
i think i know what youre talking about... never had any idea why it was happening..
but 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...
(my server is linux btw)
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:
#include <amxmisc>
#include <fakemeta>
#include <dodfun>
#define PLUGIN "DOD_stick_ex_fix"
#define VERSION "1.2"
#define AUTHOR "Vet(3TT3V)"
#define STICK_EX 32768 // (1<<DODW_STICKGRENADE_EX)
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
}
public grenade_throw(id, entid, type)
{
static w_temp
if (type == DODW_STICKGRENADE_EX) {
w_temp = pev(id, pev_weapons) - STICK_EX
set_pev(id, pev_weapons, w_temp)
}
}
diamond-optic
05-07-2009, 11:38 PM
doesnt seem to be fixing it for me on a local win32 server
Try it with a separate variable for pev_weapons as shown. Seems to be more stable that way.
diamond-optic
05-08-2009, 12:51 AM
i figured id add some client_prints and see if it wasnt going all the way thru the code..
i tried this:
public grenade_throw(id, entid, type)
{
client_print(id,print_chat,"throw 1")
if (type == DODW_STICKGRENADE_EX)
{
client_print(id,print_chat,"throw 2")
set_pev(id, pev_weapons, pev(id, pev_weapons) - STICK_EX)
}
}and only 'throw 1' shows up for me.. 'throw 2' does not
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
05-08-2009, 04:48 AM
alright ill give that a try..
is there anything else different between the 2 versions.. like was anything fixed in the new one instead of broken lol
I'm not sure what all changed. I suppose a guy could wallow throught the change logs. I see that Zor has THIS THREAD (http://www.dodplugins.net/forums/showthread.php?t=1226) going. But I haven't seen any new activity lately.
where is the source code for dodfun and dodx ?
diamond-optic
05-08-2009, 01:59 PM
where is the source code for dodfun and dodx ?
http://svn.alliedmods.net/viewvc.cgi/trunk/dlls/dod/?root=amxmodx
I submitted a bug report at alliedmods and put a post in Zor's bug thread.
diamond-optic
09-07-2009, 12:56 AM
i forgot to post this a long time ago.. so ill do it now :P
on 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
09-07-2009, 03:09 AM
i probably should have posted what code im using too lol
#include <amxmisc>
#include <engine>
#include <dodfun>
#define PLUGIN "DOD_stick_ex_fix"
#define VERSION "1.2"
#define AUTHOR "Vet(3TT3V)"
#define STICK_EX (1<<DODW_STICKGRENADE_EX)
new is_linux
public plugin_init()
register_plugin(PLUGIN, VERSION, AUTHOR)
public plugin_cfg()
if(is_linux_server())
is_linux = true
public grenade_throw(id,entid,type)
{
switch(is_linux)
{
case false:
{
if(type == DODW_STICKGRENADE_EX)
entity_set_int(id,EV_INT_weapons,entity_get_int(id ,EV_INT_weapons) - STICK_EX)
}
case true:
{
if(type == DODW_HANDGRENADE_EX)
{
static classname[32]
entity_get_string(entid,EV_SZ_classname,classname, 31)
if(equal(classname,"grenade2"))
entity_set_int(id,EV_INT_weapons,entity_get_int(id ,EV_INT_weapons) - STICK_EX)
}
}
}
}
if 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 :)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.