Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › Help › Scripting Help › Detecting weapons
7 posts, 3 people · 827 views Thread Rating: ★★★★★
closedDetecting weapons
Started by =|[76AD]|= TatsuSaisei on 12-29-2006, 07:39 AM
=|[76AD]|= TatsuSaisei
started this thread
Posts: 794
Threads: 54
Joined: May 2005
12-29-2006, 07:39 AM #1
 npublic plugin_init()n{n register_plugin(PLUGIN, VERSION, AUTHOR)n register_event("CurWeapon", "check_weapon","be")n}n npublic check_weapon(id)n{n new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)n new gunName[32],gunNam[32]n xmod_get_wpnlogname( myWeapon, gunName, 32) n xmod_get_wpnname ( myWeapon, gunNam, 32 ) n client_print(id,print_chat,"Detected Weapon (%s)(%s) Clip (%d) Ammo (%d)",gunName,gunNam, clip, ammo)n}n
n nHow come when I do this I get strange returns on some weapons ?? Suggestions ?? n nI started out trying to find a way to detect when a player was holding the Scoped Enfield...

Zor
posted here
Posts: 688
Threads: 75
Joined: Jun 2006
12-29-2006, 09:37 AM #2
|= TatsuSaisei;3039']
 npublic plugin_init()n{n register_plugin(PLUGIN, VERSION, AUTHOR)n register_event("CurWeapon", "check_weapon","be")n}n npublic check_weapon(id)n{n new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)n new gunName[32],gunNam[32]n xmod_get_wpnlogname( myWeapon, gunName, 32) n xmod_get_wpnname ( myWeapon, gunNam, 32 ) n client_print(id,print_chat,"Detected Weapon (%s)(%s) Clip (%d) Ammo (%d)",gunName,gunNam, clip, ammo)n}n
How come when I do this I get strange returns on some weapons ?? Suggestions ?? n nI started out trying to find a way to detect when a player was holding the Scoped Enfield...
nnWell first off...you have declared gunName twice this wont work. Try the following:nnn
 npublic plugin_init()n{n register_plugin(PLUGIN, VERSION, AUTHOR)n register_event("CurWeapon", "check_weapon","be")n}n npublic check_weapon(id)n{n new clip, ammo, myWeapon = dod_get_user_weapon(id,clip,ammo)n new logName[32],gunNam[32]n xmod_get_wpnlogname( myWeapon, logName, 32) n xmod_get_wpnname ( myWeapon, gunNam, 32 ) n client_print(id,print_chat,"Detected Weapon (%d)(%s)(%s) Clip (%d) Ammo (%d)", myWeapon, logName, gunNam, clip, ammo)n}n
=|[76AD]|= TatsuSaisei
started this thread
Posts: 794
Threads: 54
Joined: May 2005
12-29-2006, 09:59 AM #3
Well first off...you have declared gunName twice this wont work
n nactually 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
started this thread
Posts: 794
Threads: 54
Joined: May 2005
12-29-2006, 10:41 AM #4

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

Zor
posted here
Posts: 688
Threads: 75
Joined: Jun 2006
12-29-2006, 01:05 PM #5

Ok Im looking into it now...nnCheers!

Zor
posted here
Posts: 688
Threads: 75
Joined: Jun 2006
12-29-2006, 02:36 PM #6
|= 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...
nnOk 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!nnCheers!

diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
12-29-2006, 10:33 PM #7

great zor is breaking everything!!nn:-P

Archive › Old Forum Threads › Help › Scripting Help › Detecting weapons
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC