Raised This Month: $ Target: $400
 0% 

get_weaponname help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 08-28-2008 , 13:23   get_weaponname help
Reply With Quote #1

Im using get_weaponname, but its returing weapon_* names and i want my own names:
  • p228
  • scout
  • hegrenade
  • xm1014
  • mac10
  • aug
  • smokegrenade
  • elite
  • fiveseven
  • ump45
  • sg550
  • galil
  • famas
  • usp
  • glock18
  • awp
  • mp5navy
  • m249
  • m3
  • m4a1
  • tmp
  • shield
  • g3sg1
  • flashbang
  • deagle
  • sg552
  • ak47
  • p90
Code:
static wname[32] get_weaponname(Killer, wname, sizeof wname - 1)
[X]-RayCat is offline
fxfighter
Veteran Member
Join Date: Feb 2007
Location: Trollhättan
Old 08-28-2008 , 13:25   Re: get_weaponname help
Reply With Quote #2

why not get the weapon id and use it in a array whit your names?
__________________
If one of my plugins become broken, contact me by mail. [email protected]
fxfighter is offline
Send a message via MSN to fxfighter
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 08-28-2008 , 13:30   Re: get_weaponname help
Reply With Quote #3

Quote:
Originally Posted by fxfighter View Post
why not get the weapon id and use it in a array whit your names?
Demonstrate?
[X]-RayCat is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-28-2008 , 13:42   Re: get_weaponname help
Reply With Quote #4

Quote:
static wname[32]
get_weaponname(Killer, wname, sizeof wname - 1)
After retrieving the name, just use 'wname[6]' in your next code to ignore 'weapon_' .
__________________
Arkshine is offline
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 08-28-2008 , 14:06   Re: get_weaponname help
Reply With Quote #5

Quote:
Originally Posted by arkshine View Post
After retrieving the name, just use 'wname[6]' in your next code to ignore 'weapon_' .
You meant wname[7]? And by the way its returning false names. o_O
[X]-RayCat is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-28-2008 , 14:09   Re: get_weaponname help
Reply With Quote #6

You can use replace()... "weapon_" with "".
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-28-2008 , 14:12   Re: get_weaponname help
Reply With Quote #7

Depending its code, it's useless to use a native when you can do what i've said.

w e a p o n _
0 1 2 3 4 5 6 so, wname[6] will show your weapon name without "weapon_"
__________________
Arkshine is offline
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 08-28-2008 , 14:18   Re: get_weaponname help
Reply With Quote #8

Quote:
Originally Posted by arkshine View Post
Depending its code, it's useless to use a native when you can do what i've said.

w e a p o n _
0 1 2 3 4 5 6 so, wname[6] will show your weapon name without "weapon_"
w e a p o n _
0 1 2 3 4 5 6 7 = wname[7] right?

Last edited by [X]-RayCat; 08-28-2008 at 14:29.
[X]-RayCat is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-28-2008 , 14:25   Re: get_weaponname help
Reply With Quote #9

You're right. Forget to count the character after _.
__________________
Arkshine is offline
Old 08-28-2008, 14:28
fxfighter
This message has been deleted by fxfighter. Reason: arkshine
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 08-28-2008 , 14:32   Re: get_weaponname help
Reply With Quote #10

Quote:
Originally Posted by fxfighter View Post
dont know what your conclusion is of what i wrote.
but will just say what i ment so enyone can understand it.

weaponid wpname
PHP Code:
 1   weapon_p228
 0    weapon_shield         
 3   weapon_scout                         
 4   weapon_hegrenade              
 5   weapon_xm1014
 6   weapon_c4     
 7   weapon_mac10 
 8   weapon_aug 
 9   weapon_smokegrenade      
10   weapon_elite                   
11   weapon_fiveseven   
12   weapon_ump45                      
13   weapon_sg550             
14   weapon_galil           
15   weapon_famas              
16   weapon_usp       
17   weapon_glock18        
18   weapon_awp          
19   weapon_mp5navy      
20   weapon_m249                        
21   weapon_m3
22   weapon_m4a1
23   weapon_tmp
24   weapon_g3sg1
25   weapon_flashbang
26   weapon_deagle
27   weapon_sg552
28   weapon_ak47
29   weapon_knife
30   weapon_p90 
so just get the wpid of the gun instead of name.
make an array
PHP Code:
new array[][]={
"nothing and shield name",
"p228",
"scout",
"he",
...

use the wpid to acces the new name like
array[weaponid]
This is usefull if you wanna use other names if you just wanna remove weapon or add it do as arkshine said
Yeah i thought of that in the first place.

@Arkshine i dont know why, but it returns wrong names.. :O

Last edited by [X]-RayCat; 08-28-2008 at 14:41.
[X]-RayCat 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 09:28.


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