View Full Version : Detecting weapons
=|[76AD]|= TatsuSaisei
12-29-2006, 07:39 AM
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("CurWeapon", "check_weapon","be")
}
public check_weapon(id)
{
new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)
new gunName[32],gunNam[32]
xmod_get_wpnlogname( myWeapon, gunName, 32)
xmod_get_wpnname ( myWeapon, gunNam, 32 )
client_print(id,print_chat,"Detected Weapon (%s)(%s) Clip (%d) Ammo (%d)",gunName,gunNam, clip, ammo)
}
How come when I do this I get strange returns on some weapons ?? Suggestions ??
I started out trying to find a way to detect when a player was holding the Scoped Enfield...
|= TatsuSaisei;3039']
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("CurWeapon", "check_weapon","be")
}
public check_weapon(id)
{
new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)
new gunName[32],gunNam[32]
xmod_get_wpnlogname( myWeapon, gunName, 32)
xmod_get_wpnname ( myWeapon, gunNam, 32 )
client_print(id,print_chat,"Detected Weapon (%s)(%s) Clip (%d) Ammo (%d)",gunName,gunNam, clip, ammo)
}
How come when I do this I get strange returns on some weapons ?? Suggestions ??
I started out trying to find a way to detect when a player was holding the Scoped Enfield...
Well first off...you have declared gunName twice this wont work. Try the following:
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("CurWeapon", "check_weapon","be")
}
public check_weapon(id)
{
new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)
new logName[32],gunNam[32]
xmod_get_wpnlogname( myWeapon, logName, 32)
xmod_get_wpnname ( myWeapon, gunNam, 32 )
client_print(id,print_chat,"Detected Weapon (%d)(%s)(%s) Clip (%d) Ammo (%d)", myWeapon, logName, gunNam, clip, ammo)
}
=|[76AD]|= TatsuSaisei
12-29-2006, 09:59 AM
Well first off...you have declared gunName twice this wont work
actually if you look closer they are slightly different.. gunName and gunNam (missing an e) ... try the code and see what you think of what it reports...
=|[76AD]|= TatsuSaisei
12-29-2006, 10:41 AM
ok Zor, you NEED to know this... the code works perfect when I run the "official" dodx (1.76c), the issues I had come from using your dodx.dll !! I put back the "official" dodx and everything is reported properly...
Ok Im looking into it now...
Cheers!
|= TatsuSaisei;3049']ok Zor, you NEED to know this... the code works perfect when I run the "official" dodx (1.76c), the issues I had come from using your dodx.dll !! I put back the "official" dodx and everything is reported properly...
Ok this error has been fixed...I love it now that I know how to attach to a process and do real time debugging on the server and client as it plays!
Cheers!
diamond-optic
12-29-2006, 10:33 PM
great zor is breaking everything!!
:-P
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.