Mam bardzo dziwny problem otóż nie działa na serwerze (Mod CsDm 2.1) plugin sklepu.
Plugin zaczerpnąłem stąd http://forums.allied...ead.php?t=78224
A wygląda on po mojej obróbce tak:
#include <amxmodx> #include <cstrike> #include <fakemeta> #include <hamsandwich> #include <fun> #if defined UL_COMPAT #include <money_ul> #endif /*================================================================================ [Defines & Variables] =================================================================================*/ // Plugin Info #define PLUGIN_NAME "CS Shop" #define PLUGIN_VERS "5.0" #define PLUGIN_AUTH "iNeedHelp" // Old Name :( // Weapons BitSum (drop stocks) #define PRIMARY_WEAPONS_BITSUM ((1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)) // Max Players #define MAX_PLAYERS 32 // Compatibility with Unlimited Money #if defined UL_COMPAT #define get_user_money(%1) cs_get_user_money_ul(%1) #define set_user_money(%1,%2) cs_set_user_money_ul(%1,%2) #else #define set_user_money(%1,%2) cs_set_user_money(%1,%2) #define get_user_money(%1) cs_get_user_money(%1) #endif // Pointers new g_pGravityCvarPointer // Main Cvars new g_pCvarEnable new g_pCvarMessage new g_pCvarPrefix // Menu Cvars new g_pMenuEnableCvars[7] new g_pInvisibilityMenuCvars[3] new g_pGravityMenuCvars[4] new g_pHealthMenuCvars[4] new g_pSpeedMenuCvars[5] // Menu vars new g_iHasSpeed[MAX_PLAYERS+1] = { -1, ... } new bool:g_bHasCustomModel[MAX_PLAYERS+1] = { false, ... } // Menus Items new g_szMainShopMenu[][] = { "Niewidka", "Grawitacja", "Dodatkowe HP", "Szybkosc" } new g_szInvisibilityMenu[][] = { "Slaba niewidka", "Srednia niewidka", "Dobra niewidka" } new g_szGravityMenu[][] = { "500 Grawitacji", "400 Grawitacji", "300 Grawitacji", "200 Grawitacji" } new g_szHealthMenu[][] = { "+15 Hp", "+35 Hp", "+65 Hp", "+95 Hp" } new g_szSpeedMenu[][] = { "260 Szybkosci", "300 Szybkosci", "340 Szybkosci", "380 Szybkosci", "420 Szybkosci" } new g_iInvisibilityLevel[] = { 150, 100, 25 } new g_iHealthLevel[] = { 15, 35, 65, 95 } new Float:g_flGravityLevel[] = { 500.0, 400.0, 300.0, 200.0 } new Float:g_flSpeedLevel[] = { 260.0, 300.0, 340.0, 380.0, 420.0 } // Message Hooks new g_iMsgSayText // Others new const g_szShopFile[] = "shop.cfg"; // Shop file /*================================================================================ [Init] =================================================================================*/ public plugin_init() { register_plugin(PLUGIN_NAME, PLUGIN_VERS, PLUGIN_AUTH) // Multi-Lingual register_dictionary("shop.txt") // Commands register_clcmd("say /shop", "ClCmd_Say") register_clcmd("say_team /shop", "ClCmd_Say") // Ham Forwards RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1) // FM Forwards register_forward(FM_SetClientKeyValue, "Fwd_SetClientKeyValue") // Events register_event("CurWeapon", "Event_CurWeapon", "be", "1=1") // Variables.... // Messages Hooks g_iMsgSayText = get_user_msgid("SayText") // Cvars g_pGravityCvarPointer = get_cvar_pointer("sv_gravity") g_pCvarEnable = register_cvar("amx_shop_enable", "1") g_pCvarMessage = register_cvar("amx_shop_msg", "1") g_pCvarPrefix = register_cvar("amx_shop_prefix", "[CS Shop]") g_pMenuEnableCvars[2] = register_cvar("amx_shop_invis", "1") g_pInvisibilityMenuCvars[0] = register_cvar("amx_shop_low", "3000") g_pInvisibilityMenuCvars[1] = register_cvar("amx_shop_medium", "6000") g_pInvisibilityMenuCvars[2] = register_cvar("amx_shop_high", "12000") g_pMenuEnableCvars[3] = register_cvar("amx_shop_grav", "1") g_pGravityMenuCvars[0] = register_cvar("amx_shop_g500", "1500") g_pGravityMenuCvars[1] = register_cvar("amx_shop_g400", "3000") g_pGravityMenuCvars[2] = register_cvar("amx_shop_g300", "4500") g_pGravityMenuCvars[3] = register_cvar("amx_shop_g200", "6000") g_pMenuEnableCvars[4] = register_cvar("amx_shop_hp", "1") g_pHealthMenuCvars[0] = register_cvar("amx_shop_15hp", "1500") g_pHealthMenuCvars[1] = register_cvar("amx_shop_35hp", "3000") g_pHealthMenuCvars[2] = register_cvar("amx_shop_65hp", "6000") g_pHealthMenuCvars[3] = register_cvar("amx_shop_95hp", "7500") g_pMenuEnableCvars[5] = register_cvar("amx_shop_speed", "1") g_pSpeedMenuCvars[0] = register_cvar("amx_shop_260speed", "3000") g_pSpeedMenuCvars[1] = register_cvar("amx_shop_300speed", "6000") g_pSpeedMenuCvars[2] = register_cvar("amx_shop_340speed", "9000") g_pSpeedMenuCvars[3] = register_cvar("amx_shop_380speed", "12000") g_pSpeedMenuCvars[4] = register_cvar("amx_shop_420speed", "15000") } public plugin_cfg() { new ConfigsDir[64] get_localinfo("amxx_configsdir", ConfigsDir, charsmax(ConfigsDir)) format(ConfigsDir, charsmax(ConfigsDir), "%s/%s", ConfigsDir, g_szShopFile) if (!file_exists(ConfigsDir)) { server_print("CS Shop file [%s] doesn't exists!", ConfigsDir) return; } server_cmd("exec ^"%s^"", ConfigsDir) } /*================================================================================ [Menus] =================================================================================*/ public ClCmd_Say(id) { if (!is_user_alive(id)) { client_print_c(id, "%L", id, "SHOP_DEAD") return PLUGIN_HANDLED } if (!get_pcvar_num(g_pCvarEnable)) { client_print_c(id, "%L", id, "SHOP_DISABLED") return PLUGIN_HANDLED } Create_Menu(id) return PLUGIN_HANDLED } Create_Menu(id) { new Menu = menu_create("\rCS Shop Menu", "MainMenu_Handler") new Items[32], Position[3] for (new i = 0; i < sizeof(g_szMainShopMenu); i++) { formatex(Items, charsmax(Items), "%s%s", get_pcvar_num(g_pMenuEnableCvars[i]) ? "\w" : "\d", g_szMainShopMenu[i]) num_to_str(i, Position, charsmax(Position)) menu_additem(Menu, Items, Position) } menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL) menu_display(id, Menu, 0) } public MainMenu_Handler(id, Menu, item) { if (item == MENU_EXIT) { menu_destroy(Menu) return PLUGIN_HANDLED } new Data[6], Name[64]; new Access, Callback; menu_item_getinfo(Menu, item, Access, Data, 5, Name, 63, Callback) new Key = str_to_num(Data); switch (Key) { case 0: { new Inv_Menu = menu_create("\rNiewidka", "InvisibilityMenu_Handler") new Items[32], PriceString[32], Position[3] for (new i = 0; i < sizeof(g_szInvisibilityMenu); i++) { formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pInvisibilityMenuCvars[i])) formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pInvisibilityMenuCvars[i]) > 0 ? "\w" : "\d", g_szInvisibilityMenu[i], get_pcvar_num(g_pInvisibilityMenuCvars[i]) > 0 ? PriceString : "") num_to_str(i, Position, charsmax(Position)) menu_additem(Inv_Menu, Items, Position) } menu_setprop(Inv_Menu, MPROP_EXIT, MEXIT_ALL) if (!get_pcvar_num(g_pMenuEnableCvars[2])) { client_print_c(id, "%L", id, "SHOP_INVIS_OFF") return PLUGIN_HANDLED } else menu_display(id, Inv_Menu, 0) } case 1: { new Grav_Menu = menu_create("\rGrawitacja", "GravityMenu_Handler") new Items[32], PriceString[32], Position[3] for (new i = 0; i < sizeof(g_szGravityMenu); i++) { formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pGravityMenuCvars[i])) formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pGravityMenuCvars[i]) > 0 ? "\w" : "\d", g_szGravityMenu[i], get_pcvar_num(g_pGravityMenuCvars[i]) > 0 ? PriceString : "") num_to_str(i, Position, charsmax(Position)) menu_additem(Grav_Menu, Items, Position) } menu_setprop(Grav_Menu, MPROP_EXIT, MEXIT_ALL) if (!get_pcvar_num(g_pMenuEnableCvars[3])) { client_print_c(id, "%L", id, "SHOP_GRAV_OFF") return PLUGIN_HANDLED } else menu_display(id, Grav_Menu, 0) } case 2: { new Hp_Menu = menu_create("\rDodatkowe HP", "HealthMenu_Handler") new Items[32], PriceString[32], Position[3] for (new i = 0; i < sizeof(g_szHealthMenu); i++) { formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pHealthMenuCvars[i])) formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pHealthMenuCvars[i]) > 0 ? "\w" : "\d", g_szHealthMenu[i], get_pcvar_num(g_pHealthMenuCvars[i]) > 0 ? PriceString : "") num_to_str(i, Position, charsmax(Position)) menu_additem(Hp_Menu, Items, Position) } menu_setprop(Hp_Menu, MPROP_EXIT, MEXIT_ALL) if (!get_pcvar_num(g_pMenuEnableCvars[4])) { client_print_c(id, "%L", id, "SHOP_HEALTH_OFF") return PLUGIN_HANDLED } else menu_display(id, Hp_Menu, 0) } case 3: { new Speed_Menu = menu_create("\rSzybkosc", "SpeedMenu_Handler") new Items[32], PriceString[32], Position[3] for (new i = 0; i < sizeof(g_szSpeedMenu); i++) { formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pSpeedMenuCvars[i])) formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pSpeedMenuCvars[i]) > 0 ? "\w" : "\d", g_szSpeedMenu[i], get_pcvar_num(g_pSpeedMenuCvars[i]) > 0 ? PriceString : "") num_to_str(i, Position, charsmax(Position)) menu_additem(Speed_Menu, Items, Position) } menu_setprop(Speed_Menu, MPROP_EXIT, MEXIT_ALL) if (!get_pcvar_num(g_pMenuEnableCvars[5])) { client_print_c(id, "%L", id, "SHOP_SPEED_OFF") return PLUGIN_HANDLED } else menu_display(id, Speed_Menu, 0) } } menu_destroy(Menu) return PLUGIN_HANDLED } public InvisibilityMenu_Handler(id, Inv_Menu, item) { if (item == MENU_EXIT) { menu_destroy(Inv_Menu) return PLUGIN_HANDLED } new Data[6], Name[64] new Access, Callback; menu_item_getinfo(Inv_Menu, item, Access, Data, 5, Name, 63, Callback) new Key = str_to_num(Data) new Money = get_user_money(id) new Pcvar = get_pcvar_num(g_pInvisibilityMenuCvars[Key]) if (!Pcvar) { client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED") return PLUGIN_HANDLED } if (Money < Pcvar) client_print_c(id, "%L", id, "SHOP_ITEM_MONEY") else { client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szInvisibilityMenu[Key]) set_user_money(id, Money-Pcvar) set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, g_iInvisibilityLevel[Key]) } menu_destroy(Inv_Menu) return PLUGIN_HANDLED } public GravityMenu_Handler(id, Grav_Menu, item) { if (item == MENU_EXIT) { menu_destroy(Grav_Menu) return PLUGIN_HANDLED } new Data[6], Name[64] new Access, Callback; menu_item_getinfo(Grav_Menu, item, Access, Data, 5, Name, 63, Callback) new Key = str_to_num(Data) new Money = get_user_money(id) new Pcvar = get_pcvar_num(g_pGravityMenuCvars[Key]) if (!Pcvar) { client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED") return PLUGIN_HANDLED } if (Money < Pcvar) client_print_c(id, "%L", id, "SHOP_ITEM_MONEY") else { client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szGravityMenu[Key]) set_user_money(id, Money-Pcvar) set_user_gravity(id, (g_flGravityLevel[Key] / get_pcvar_float(g_pGravityCvarPointer))) } menu_destroy(Grav_Menu) return PLUGIN_HANDLED } public HealthMenu_Handler(id, Hp_Menu, item) { if (item == MENU_EXIT) { menu_destroy(Hp_Menu) return PLUGIN_HANDLED } new Data[6], Name[64] new Access, Callback menu_item_getinfo(Hp_Menu, item, Access, Data, 5, Name, 63, Callback) new Key = str_to_num(Data) new Money = get_user_money(id) new Pcvar = get_pcvar_num(g_pHealthMenuCvars[Key]) new Health = get_user_health(id) if (!Pcvar) { client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED") return PLUGIN_HANDLED } if (Money < Pcvar) client_print_c(id, "%L", id, "SHOP_ITEM_MONEY") else { client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szHealthMenu[Key]) set_user_money(id, Money-Pcvar) set_user_health(id, Health+g_iHealthLevel[Key]) } menu_destroy(Hp_Menu) return PLUGIN_HANDLED } public SpeedMenu_Handler(id, Speed_Menu, item) { if (item == MENU_EXIT) { menu_destroy(Speed_Menu) return PLUGIN_HANDLED } new Data[6], Name[64] new Access, Callback; menu_item_getinfo(Speed_Menu, item, Access, Data, 5, Name, 63, Callback) new Key = str_to_num(Data) new Money = get_user_money(id) new Pcvar = get_pcvar_num(g_pSpeedMenuCvars[Key]) if (!Pcvar) { client_print_c(id, "%L", id, "SHOP_ITEM_DISABLED") return PLUGIN_HANDLED } if (Money < Pcvar) client_print_c(id, "%L", id, "SHOP_ITEM_MONEY") else { g_iHasSpeed[id] = Key client_print_c(id, "%L", id, "SHOP_ITEM_BUY", g_szSpeedMenu[Key]) set_user_money(id, Money-Pcvar) set_user_maxspeed(id, g_flSpeedLevel[Key]) } menu_destroy(Speed_Menu) return PLUGIN_HANDLED } /*================================================================================ [Forwards] =================================================================================*/ public Fwd_PlayerSpawn_Post(id) { if (is_user_alive(id)) { set_user_rendering(id) set_user_gravity(id, 1.0) if (g_iHasSpeed[id]) { set_user_maxspeed(id, 250.0) g_iHasSpeed[id] = -1 } if (get_pcvar_num(g_pCvarEnable)) if (get_pcvar_num(g_pCvarMessage)) client_print_c(id, "%L", id, "SHOP_PRINT") } } public Fwd_SetClientKeyValue(id, const infobuffer[], const key[]) { if (g_bHasCustomModel[id] && equal(key, "model")) return FMRES_SUPERCEDE return FMRES_IGNORED } public Event_CurWeapon(id) { if (!is_user_alive(id)) return switch (g_iHasSpeed[id]) { case 0: set_user_maxspeed(id, 260.0) case 1: set_user_maxspeed(id, 300.0) case 2: set_user_maxspeed(id, 340.0) case 3: set_user_maxspeed(id, 380.0) case 4: set_user_maxspeed(id, 420.0) } } /*================================================================================ [Stocks] =================================================================================*/ stock client_print_c(index, const Msg[], {Float, Sql, Result,_}:...) { if (!is_user_connected(index)) return; new Buffer[512], Buffer2[512], Prefix[32] get_pcvar_string(g_pCvarPrefix, Prefix, charsmax(Prefix)) formatex(Buffer2, charsmax(Buffer2), "^x04%s ^x01%s", Prefix, Msg); vformat(Buffer, charsmax(Buffer), Buffer2, 3); message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, index); write_byte(index); write_string(Buffer); message_end(); }
Zedytowałem go, poprzez usunięcie nie interesujących mnie opcji. Kompilacja bez najmniejszego błędu, a na serwerze kicha. Po wpisaniu sklep nie otwiera się okno wyboru.
Czy byłby mi ktoś w stanie pomóc, albo chociaż wskazać rozwiązanie tego problemu? Lecą plusy oczywiście, nawet za chęci.