Raised This Month: $51 Target: $400
 12% 

Getting weapon of what user is holding


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-01-2007 , 19:17   Getting weapon of what user is holding
Reply With Quote #1

How would I get what weapon the user is holding and get the exact weapon name in TS? I looked at Ava's include file but I'm not sure on how to use it.
wonsae is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 05-01-2007 , 19:35   Re: Getting weapon of what user is holding
Reply With Quote #2

ts_getuserwpn
http://www.amxmodx.org/funcwiki.php?go=func&id=644
Styles is offline
Send a message via AIM to Styles
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-01-2007 , 19:44   Re: Getting weapon of what user is holding
Reply With Quote #3

That only gets the current weapon. I'm trying to get every weapon the user has.
wonsae is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 05-01-2007 , 19:49   Re: Getting weapon of what user is holding
Reply With Quote #4

This doesn't work for TS?
http://www.amxmodx.org/funcwiki.php?...pons&go=search
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
wonsae
Senior Member
Join Date: Jan 2006
Location: Behind you >:D
Old 05-01-2007 , 20:23   Re: Getting weapon of what user is holding
Reply With Quote #5

Oh alright thanks, the example there taught me on how to use one of ava's functions xD. but I'm stuck again :S

PHP Code:
public DepositFireArm(id)
{
 if(!
is_user_alive(id)) return PLUGIN_HANDLED
 
 
new menu[256]
 
 new 
key = (1<<0|1<<1|1<<9)
 new 
len format(menu,sizeof(menu),"Deposit Firearm^n^n")
 
 new 
weapons[35], num 0
 
for(new i=1;i>ts_get_user_weapons(id,weapons,num);i++)
 {
  
len += format(menu[len],sizeof(menu)-len,"%i. %s^n",i,weapon_names[i])
 }
 
 
show_menu(id,key,menu,-1,"Deposit Firearm")
 return 
PLUGIN_HANDLED
}
public 
DepositFireArm_Action(id,key)
{
 switch(
key)
 {
  


// How do get on how many cases there are?? 
wonsae is offline
Drak
Veteran Member
Join Date: Jul 2005
Old 05-01-2007 , 22:16   Re: Getting weapon of what user is holding
Reply With Quote #6

It doesn't matter. Your "for" statement is wrong a tid bit. But when it's working correctly, it should display in the menu:
"i number. Weapons name"

Obviously, like you have. Well that will automatically read, and the case statement will work fine, it always has for me.
Just make the case(s) 0-9. But if you really need to get the total amount of weapons found, make a global variable to store it.

Oh and also, change your "for" statement to this:
Code:
new weapons[32],numWeapons get_user_weapons(id,weapons,numWeapons) for(new i=1; i < numWeapons ;i++)
__________________
Oh yeah

Last edited by Drak; 05-01-2007 at 22:20.
Drak is offline
Send a message via MSN to Drak
stupok
Veteran Member
Join Date: Feb 2006
Old 05-01-2007 , 23:05   Re: Getting weapon of what user is holding
Reply With Quote #7

Here's a start:

Code:
//... new const weapon_names[38][] = {     "Null", //To occupy space #0     "Glock-18",     "TSW_UNK1",     "Mini-Uzi",     "Benelli M3",     "M4A1",     "MP5SD",     "MP5K",     "Akimbo Berettas",     "SOCOM-MK23",     "Akimbo MK23",     "USAS-12",     "Desert Eagle",     "AK47",     "Five-seveN",     "STEYR-AUG",     "Akimbo Uzi",     "STEYR-TMP",     "Barrett M82A1",     "MP7-PDW",     "SPAS-12",     "Golden Colts",     "Glock-20C",     "UMP",     "M61 Grenade",     "Combat Knife",     "Mossberg 500",     "M16A4",     "Ruger-MK1",     "C4",     "Akimbo 57",     "Raging Bull",     "M60E3",     "Sawed-off",     "Katana",     "Seal Knife",     "Kung Fu",     "Seal Knife" } public DepositFireArm(id) {     //...     new menu[256], weapons[35], num, len         ts_get_user_weapons(id, weapons, num)         for(new i = 0; i < num; i++)     {         len += format(menu[len], sizeof(menu)-len, "%i. %s^n", i+1, weapon_names[weapons[i]])     }     //... }
stupok is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:33.


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