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

[CS:GO] Get weapon name by its classname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-04-2014 , 05:22   [CS:GO] Get weapon name by its classname
Reply With Quote #1

Hello guys, I'm new to sourcemod. well I am trying to get weapon name by it's classname for example:
classname is: 'weapon_ak47', I want to format a string 'AK-47'. Thanks!
TheDS1337 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-19-2014 , 05:17   Re: [CS:GO] Get weapon name by its classname
Reply With Quote #2

bump
TheDS1337 is offline
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 06-19-2014 , 06:54   Re: [CS:GO] Get weapon name by its classname
Reply With Quote #3

If you want it in that format you may want to look at this:
StrEqual
PHP Code:
if (StrEqual(weapon"weapon_ak47"))
{
     
weapon "AK-47";

But if 'ak47' is fine you can just:
ReplaceString
PHP Code:
ReplaceString(weaponsizeof(weapon), "weapon_"""false); 
__________________

Last edited by versatile_bfg; 06-19-2014 at 06:58.
versatile_bfg is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-19-2014 , 07:49   Re: [CS:GO] Get weapon name by its classname
Reply With Quote #4

Quote:
Originally Posted by versatile_bfg View Post
If you want it in that format you may want to look at this:
StrEqual
PHP Code:
if (StrEqual(weapon"weapon_ak47"))
{
     
weapon "AK-47";

But if 'ak47' is fine you can just:
ReplaceString
PHP Code:
ReplaceString(weaponsizeof(weapon), "weapon_"""false); 
Thanks for the reply, but I don't want it to do like this, why ? because sometimes valve add new weapons/knives to the game, I don't want to update it everytime, I was thinking if I can get the full name of the item, like when you spectating someone haves skin for example, it'll show you: Karambit | Fade or something like that, I want to get that full name ;)
TheDS1337 is offline
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 06-19-2014 , 07:57   Re: [CS:GO] Get weapon name by its classname
Reply With Quote #5

Quote:
Originally Posted by DeagLe.Studio View Post
Thanks for the reply, but I don't want it to do like this, why ? because sometimes valve add new weapons/knives to the game, I don't want to update it everytime, I was thinking if I can get the full name of the item, like when you spectating someone haves skin for example, it'll show you: Karambit | Fade or something like that, I want to get that full name ;)
So you want the Full Skin name. eg: 'AK-47 | Vulcan'

Not sure how you would do that sorry.

This may push you in the right direction though. https://forums.alliedmods.net/showpo...8&postcount=13

You will also have to do something with the "paint_kits" part for that as well.

GLHF
__________________

Last edited by versatile_bfg; 06-19-2014 at 08:04.
versatile_bfg 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 04:07.


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