need help with my menu im creating a menu for my knifeserver the problem is when i trie to purchase the machete it just says you just purchased a katana the katana works when i purchase but not the machete what did i do wrong here is the code
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#define PLUGIN "Shop"
#define VERSION "1.0"
#define AUTHOR "Prete"
#define MEXIT_ALL 1
new bool:g_bHasBoughtKatana[33]
new bool:g_bHasBoughtMachete[33]
new g_ShopMenu;
new VIEW_Katana[] = "models/katana.mdl"
new PLAYER_Katana[] = "models/katana.mdl"
new VIEW_Machete[] = "models/machete.mdl"
new PLAYER_Machete[] = "models/machete.mdl"
new WORLD_MODEL[] = "models/w_knife.mdl"
new OLDWORLD_MODEL[] = "models/w_knife.mdl"
public plugin_precache()
{
precache_model(VIEW_Katana)
precache_model(PLAYER_Katana)
precache_model(VIEW_Machete)
precache_model(PLAYER_Machete)
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_event ("CurWeapon", "Event_CurWeapon", "b", "1=1", "2=29")
register_forward(FM_SetModel, "fw_SetModel")
register_clcmd ( "say /jbshop","ShopMenu")
register_clcmd ("say_team /jbshop", "ShopMenu")
register_cvar("amx_jail_menu", "1");
}
public Event_CurWeapon(id)
{
/* Niet nodig door "2=29" filter in register_event()
new weaponID = read_data(2)
if(weaponID != CSW_KNIFE)
return PLUGIN_CONTINUE
*/
if( g_bHasBoughtKatana[id] == true )
{
entity_set_string(id, EV_SZ_viewmodel, VIEW_Katana);
entity_set_string(id, EV_SZ_viewmodel, PLAYER_Katana);
return PLUGIN_CONTINUE;
}
if( g_bHasBoughtMachete[id] == true )
{
entity_set_string(id, EV_SZ_viewmodel, VIEW_Machete);
entity_set_string(id, EV_SZ_viewmodel, PLAYER_Machete);
return PLUGIN_CONTINUE;
}
return PLUGIN_CONTINUE;
}
public fw_SetModel(entity, model[])
{
if(!is_valid_ent(entity))
return FMRES_IGNORED
if(!equali(model, OLDWORLD_MODEL))
return FMRES_IGNORED
new className[33]
entity_get_string(entity, EV_SZ_classname, className, 32)
if(equal(className, "weaponbox") || equal(className,
"armoury_entity") || equal(className, "grenade"))
{
if(entity_set_model(entity, WORLD_MODEL) )
return FMRES_SUPERCEDE
}
return FMRES_IGNORED
}
public ShopMenu(id)
{
menu_create("ShopMenu", "ShopMenu_Handler" );
menu_additem (g_ShopMenu, "Katana", "1", 0)
menu_additem (g_ShopMenu, "Machete", "1", 0)
menu_setprop (g_ShopMenu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, g_ShopMenu, 0);
return PLUGIN_HANDLED;
}
public ShopMenu_Handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
g_bHasBoughtKatana[id] = true
client_print(id, print_chat, "You just purchased a katana knife!");
}
case 2:
{
g_bHasBoughtMachete[id] = true
client_print(id, print_chat, "You just purchased a Machete!");
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}