AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Get weapon name by its classname (https://forums.alliedmods.net/showthread.php?t=241475)

TheDS1337 06-04-2014 05:22

[CS:GO] Get weapon name by its classname
 
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 06-19-2014 05:17

Re: [CS:GO] Get weapon name by its classname
 
bump

versatile_bfg 06-19-2014 06:54

Re: [CS:GO] Get weapon name by its classname
 
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); 


TheDS1337 06-19-2014 07:49

Re: [CS:GO] Get weapon name by its classname
 
Quote:

Originally Posted by versatile_bfg (Post 2153973)
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 ;)

versatile_bfg 06-19-2014 07:57

Re: [CS:GO] Get weapon name by its classname
 
Quote:

Originally Posted by DeagLe.Studio (Post 2153996)
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


All times are GMT -4. The time now is 08:51.

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