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
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
PHP Code:
void ShowMenuBuyPrimary(int id) { Menu menu = new Menu(h_MenuPrimary) menu.SetTitle("Primary Weapons:")
public int h_MenuPrimary(Menu menu, MenuAction action, int id, int item) { if (action == MenuAction_Select) { char info[32] bool found = menu.GetItem(item, info, sizeof(info)) //LogMessage("Found:%d Info:%s", found, info) if (found) { //int wpnid = CS_WeaponNameToId_Pri(info) //my own method CSWeaponID wpnid = CS_AliasToWeaponID(info) //info is weapon entity name, example: weapon_ak47 //LogMessage("CSWeaponID:%d", wpnid) if (wpnid) { int price = CS_GetWeaponPrice(id, wpnid) //LogMessage("Price:%d", price) if (TakePlayerMoney(id, price)) { //get weapon ent in current slot int wpnent = GetPlayerWeaponSlot(id, CS_SLOT_PRIMARY) //LogMessage("EntDrop:%d", wpnent) if (wpnent != -1) { //drop current slot first CS_DropWeapon(id, wpnent, true)
//give new weapon int wpnnew = GivePlayerItem(id, info) //LogMessage("EntGive:%d", wpnnew) if (wpnnew != -1) { //give bpammo too Client_SetWeaponPlayerAmmoEx(id, wpnnew, 999) } } } } } } }