Raised This Month: $ Target: $400
 0% 

Weapon name


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sutar
Senior Member
Join Date: Sep 2010
Old 08-03-2013 , 13:35   Weapon name
Reply With Quote #1

Hi, I get a code of arms, and how do I translate it in the name?
I tried through get_weaponname
but that is not

for example
if index weapon 29 but function gives "weapon_knife" but need to "knife"
delete the line weapon_ impossible, because some of the names do not match weapons
Sutar is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-03-2013 , 14:29   Re: Weapon name
Reply With Quote #2

Code:
new wpnIndex = 29, wpnName[32]; get_weaponname(wpnIndex, wpnName, 31); copy(wpnName, 31, wpnName[7]); server_print(wpnName);
Code:
knife

or

Code:
new wpnIndex = 29, wpnName[32]; get_weaponname(wpnIndex, wpnName, 31); if ( equal(wpnName[7], "knife") )     server_print("true");

Code:
true
__________________

Last edited by Black Rose; 08-03-2013 at 14:35.
Black Rose is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 08-03-2013 , 14:30   Re: Weapon name
Reply With Quote #3

You can remove specific strings from a source string . If that is what you are asking about ?

Code:
new szWeaponName[] = "weapon_knife"; format(szWeaponName, charsmax(szWeaponName), szWeaponName[7]) // szWeaponName will be "knife"

Last edited by akcaliberg; 08-03-2013 at 14:31.
akcaliberg is offline
DWIGHTpN
Senior Member
Join Date: Jan 2013
Location: Romania.
Old 08-03-2013 , 14:40   Re: Weapon name
Reply With Quote #4

Example:
PHP Code:
public client_PreThink(id) {
           new 
weaponID,ammo,clip;
           
weaponID get_user_weapon(idclip,ammo);
           
// get_user_weapon return CSW_ + weapon ID.

          // Now get weapon name from id.
          
new szWeapon[50];
          
get_weaponname(weaponIDszWeaponcharsmax(szWeapon));
          
// Now we have weapon name (weapon_knife for ex).

          
replace(szWeaponcharsmax(szWeapon), "weapon_""");
          
// Now we have weapon name without "weapon_".


Last edited by DWIGHTpN; 08-03-2013 at 14:53.
DWIGHTpN is offline
Sutar
Senior Member
Join Date: Sep 2010
Old 08-03-2013 , 16:42   Re: Weapon name
Reply With Quote #5

I said that if you remove the prefix "weapon_" can not get
for example, the weapon can not match the name of the desired
Sutar is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-03-2013 , 18:11   Re: Weapon name
Reply With Quote #6

Quote:
Originally Posted by Sutar View Post
I said that if you remove the prefix "weapon_" can not get
for example, the weapon can not match the name of the desired
If you're not matching the weapons you obviously need to edit your input to match it.
Here's a list of weapon names in the game. The mp5 differs from mp5 and mp5navy depending on what function is used.

Code:
new const g_Weapons[33][] = {     "", "p228", "shield", "scout", "hegrenade",     "xm1014","c4", "mac10", "aug", "smokegrenade",     "elite", "fiveseven", "ump45", "sg550", "galil",     "famas", "usp", "glock18", "awp", "mp5",     "m249", "m3", "m4a1", "tmp", "g3sg1",     "flashbang", "deagle", "sg552", "ak47", "knife",     "p90", "kevlar", "assault" };
__________________
Black Rose is offline
Sutar
Senior Member
Join Date: Sep 2010
Old 08-04-2013 , 06:46   Re: Weapon name
Reply With Quote #7

You can link to where there is a list of weapons and their names?
Sutar is offline
DWIGHTpN
Senior Member
Join Date: Jan 2013
Location: Romania.
Old 08-04-2013 , 08:02   Re: Weapon name
Reply With Quote #8

http://wiki.amxmodx.org/CS_Weapons_Information
DWIGHTpN is offline
Sutar
Senior Member
Join Date: Sep 2010
Old 08-04-2013 , 08:05   Re: Weapon name
Reply With Quote #9

Quote:
Originally Posted by DWIGHTpN View Post
thank you
Sutar 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 15:46.


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