AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] NS_GET_WEAPON - Useless? Bug? Alternative? (https://forums.alliedmods.net/showthread.php?t=127803)

mysticssjgoku4 05-25-2010 02:40

[SOLVED] NS_GET_WEAPON - Useless? Bug? Alternative?
 
Trying to figure out which weapon the user has selected currently. As in, are they using their pistol? Are they using fade swipe? Are they using parasite? Are they using spit?

This returns some random number only when I kill someone using the gorge/fade.
http://www.amxmodx.org/funcwiki.php?go=func&id=1162
Code:
new spit = ns_get_weapon(iAttacker,WEAPON_SPIT);//gorge weapon new swipe = ns_get_weapon(iAttacker,WEAPON_SWIPE);//fade weapon

also tried

This doesn't return anything.
Code:
new weaponid = 0; ns_get_weapon(iAttacker,weaponid);

also tried

This will always return 1 if I have the weapon available. Even though I kill someone with heal spray, it will say Spit?: 1 if I am the gorge since I do have the wepaon.
http://www.amxmodx.org/doc/index.htm...has_weapon.htm
Code:
new spit = ns_has_weapon(iAttacker,WEAPON_SPIT); new swipe = ns_has_weapon(iAttacker,WEAPON_SWIPE);

-------------
Update:
also tried

Only returns 0.
Code:
register_event("DeathMsg", "client_killed_2", "a") public client_killed_2() {     new Killer = read_data(1) //get the first message parameter     new Victim = read_data(2) //get the second message parameter     new headshot = read_data(3) //was this a headshot?     new weapon[32]     read_data(4, weapon, 31)  //get the weapon name     server_print("Weapon: %d",weapon); }
--------------------
Update #2
......couple hours later and some time away from the computer, I went back to the basics. This is for all those cannot figure out how to compare the users selected weapon with the NS_CONST.inc definitions.

Use this line.
Code:
new weaponid = get_user_weapon(iAttacker);

/feelslikeanewb


All times are GMT -4. The time now is 05:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.