Here is the code of the plugin, if you can tell me why is on first and not last, thanks guskis
Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <cs_weapons_api>
#include <amx_settings_api>
#include <ttt>
#define WEAPON_CSWID CSW_HEGRENADE
#define WEAPON_NAME "weapon_hegrenade"
new g_iItemID;
new cvar_weapon_price;
new cvar_weapon_damage;
public plugin_init()
{
register_plugin("[TTT] Item: HE Grenade", TTT_VERSION, TTT_AUTHOR);
cvar_weapon_price = register_cvar("ttt_price_he", "1");
cvar_weapon_damage = my_register_cvar("ttt_he_damage", "1.0", "HE Grenade Damage Multiplier (Default: 1.0)");
new name[TTT_ITEMLENGHT];
formatex(name, charsmax(name), "%L", LANG_PLAYER, "TTT_ITEM_ID19");// TTT_ITEM_ID12 reemplazalo por otro aca y en el lang , ejemplo TTT_ITEM_ID16 = HE GRENADE
g_iItemID = ttt_buymenu_add(name, get_pcvar_num(cvar_weapon_price), PC_TRAITOR); // en PC_TRAIDOR podes poner PC_DETECTIVE si es que queres que sea para detectives solamente
}
public ttt_item_selected(id, item, name[], price)
{
if(g_iItemID == item)
{
if(user_has_weapon(id, WEAPON_CSWID))
ham_strip_weapon(id, WEAPON_NAME);
static data[STOREABLE_STRUCTURE];
if(!data[STRUCT_CSWA_CSW])
{
data[STRUCT_CSWA_ITEMID] = g_iItemID;
data[STRUCT_CSWA_CSW] = WEAPON_CSWID;
data[STRUCT_CSWA_DAMAGE] = _:get_pcvar_float(cvar_weapon_damage);
}
ham_give_weapon(id, "weapon_hegrenade");
client_print_color(id, print_team_default, "%s %L", TTT_TAG, id, "TTT_ITEM2", name, id, "TTT_ITEM5");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}