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

[Help] CSGO: How to properly use CS_AliasToWeaponID?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
metal_upa
Senior Member
Join Date: Jun 2016
Old 11-11-2016 , 14:20   [Help] CSGO: How to properly use CS_AliasToWeaponID?
Reply With Quote #1

How to properly use this native? it always return 0.

PHP Code:
#include <sourcemod>
#include <cstrike>

#pragma newdecls required

#define WPN_ENT "weapon_famas"

public Plugin myinfo 
{
    
name "Test",
    
author "metal_upa",
    
description "test",
    
version "0.0.1",
    
url "https://forums.alliedmods.net"
}

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_test2"CmdTest)
}

public 
Action CmdTest(int idint arg)
{
    
CSWeaponID wpnid CS_AliasToWeaponID(WPN_ENT)
    
LogMessage("CSWeaponID:%d"wpnid)
    return 
Plugin_Handled;


Last edited by metal_upa; 11-12-2016 at 08:54.
metal_upa is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 11-11-2016 , 19:12   Re: [Help] How to properly use CS_AliasToWeaponID?
Reply With Quote #2

Try it with just famas. Or use it the CS_WeaponIDToAlias function to Print the alias from CSWeapon_FAMAS. Alternatively you could just print out the CSWeapon_FAMAS itself to retrieve the value. Here is a list of all CSWeapon definitions available. https://sm.alliedmods.net/new-api/cstrike/CSWeaponID
xerox8521 is offline
metal_upa
Senior Member
Join Date: Jun 2016
Old 11-12-2016 , 08:44   Re: [Help] How to properly use CS_AliasToWeaponID?
Reply With Quote #3

Quote:
Originally Posted by xerox8521 View Post
Try it with just famas. Or use it the CS_WeaponIDToAlias function to Print the alias from CSWeapon_FAMAS. Alternatively you could just print out the CSWeapon_FAMAS itself to retrieve the value. Here is a list of all CSWeapon definitions available. https://sm.alliedmods.net/new-api/cstrike/CSWeaponID
Errmm i'm sorry but that is not what i mean, the question is how to properly use this native?
I'm creating a custom buymenu for csgo. It pass a weapon entity name, so i need the weaponid by using the weapon_* string.

Here is my partial code:
Spoiler
metal_upa 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 13:03.


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