Привет народ. Пытаюсь сделать ограничение на покупку хп. Но не получается, много ошибок, да и почьти ничего не понимаю, помогите. Хотелось бы чтоб maxhp было 1050 и потом в следуюшей покупке было типа вы больше не можете покупать. а еще чтоб больше лимита не покупалось и денег не снимало, пардон за ошибки. Короче мне нужно чтобы больше 1050 хп не устанавливалось.
C-подобный:
// Uncomment this to enable Unlimited Money support by Ramono
//#define UL_COMPAT
#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_pCtGunsMenuCvars[6]
new g_pTeGunsMenuCvars[5]
new g_pInvisibilityMenuCvars[3]
new g_pGravityMenuCvars[4]
new g_pHealthMenuCvars[4]
new g_pSpeedMenuCvars[5]
new g_pSkinsMenuCvars[2]
// Menu vars
new g_iHasSpeed[MAX_PLAYERS+1] = { -1, ... }
new bool:g_bHasCustomModel[MAX_PLAYERS+1] = { false, ... }
// Menus Items
new g_szMainShopMenu[][] =
{
"Меню оружия CT",
"Меню оружия Т",
"Меню невидимости",
"Меню гравитации",
"Меню здоровья",
"Меню скорости",
"Меню скинов"
}
new g_szCTGunsMenu[][] =
{
"M4A1",
"Bullpup",
"TMP",
"Five Seven",
"Famas",
"Shield"
}
new g_szTGunsMenu[][] =
{
"Ak 47",
"Krieg 552",
"Mac 10",
"Dual Elites",
"Galil"
}
new g_szInvisibilityMenu[][] =
{
"Слабая",
"Средняя",
"Высокая"
}
new g_szGravityMenu[][] =
{
"Грав. 500",
"Грав.400",
"Грав. 300",
"Грав. 200"
}
new g_szHealthMenu[][] =
{
"Здоровье +15",
"Здоровье +35",
"Здоровье +65",
"Здоровье +95"
}
new g_szSpeedMenu[][] =
{
"Скорость 260",
"Скорость 300",
"Скорость 340",
"Скорость 380",
"Скорость 420"
}
new g_szSkinsMenu[][] =
{
"Скин Т",
"Скин CT"
}
// Menus Data
new g_szCTGunsWeapons[][] =
{
"weapon_m4a1",
"weapon_aug",
"weapon_tmp",
"weapon_fiveseven",
"weapon_famas",
"weapon_shield"
}
new g_szTGunsWeapons[][] =
{
"weapon_ak47",
"weapon_sg552",
"weapon_mac10",
"weapon_elite",
"weapon_galil"
}
new g_szCTGunsAmmo[][] = { "556nato", "556nato", "9mm", "57mm", "556nato" }
new g_szTGunsAmmo[][] = { "762nato", "556nato", "45acp", "9mm", "556nato" }
new g_iCTGunsLoad[] = { 90, 90, 120, 100, 90 }
new g_iTGunsLoad[] = { 90, 90, 100, 120, 90 }
new g_iCTGunsMaxAmmo[] = { 90, 90, 120, 100, 90 }
new g_iTGunsMaxAmmo[] = { 90, 90, 100, 120, 90 }
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 }
new g_szSkinsName[][] = { "gign", "leet" }
// 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[0] = register_cvar("amx_shop_ct", "1")
g_pCtGunsMenuCvars[0] = register_cvar("amx_shop_m4a1", "3100")
g_pCtGunsMenuCvars[1] = register_cvar("amx_shop_bullpup", "3500")
g_pCtGunsMenuCvars[2] = register_cvar("amx_shop_tmp", "1250")
g_pCtGunsMenuCvars[3] = register_cvar("amx_shop_fiveseven", "750")
g_pCtGunsMenuCvars[4] = register_cvar("amx_shop_famas", "2250")
g_pCtGunsMenuCvars[5] = register_cvar("amx_shop_shield", "2200")
g_pMenuEnableCvars[1] = register_cvar("amx_shop_t", "1")
g_pTeGunsMenuCvars[0] = register_cvar("amx_shop_ak47", "2500")
g_pTeGunsMenuCvars[1] = register_cvar("amx_shop_sg552", "3500")
g_pTeGunsMenuCvars[2] = register_cvar("amx_shop_mac10", "1400")
g_pTeGunsMenuCvars[3] = register_cvar("amx_shop_elites", "800")
g_pTeGunsMenuCvars[4] = register_cvar("amx_shop_galil", "2000")
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")
g_pMenuEnableCvars[6] = register_cvar("amx_shop_skins", "1")
g_pSkinsMenuCvars[0] = register_cvar("amx_shop_tskin", "9000")
g_pSkinsMenuCvars[1] = register_cvar("amx_shop_ctskin", "9000")
}
public plugin_precache()
{
new sModels[128]
for (new i = 0; i < sizeof(g_szSkinsName); i++)
{
format(sModels, sizeof(sModels)-1, "models/player/%s/%s.mdl", g_szSkinsName[i], g_szSkinsName[i])
precache_model(sModels)
}
}
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 файл [%s] не найден!", 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 меню", "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 Cts_Menu = menu_create("\rОружие CT", "CtMenu_Handler")
new Items[32], PriceString[32], Position[3]
for (new i = 0; i < sizeof(g_szCTGunsMenu); i++)
{
formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pCtGunsMenuCvars[i]))
formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pCtGunsMenuCvars[i]) > 0 ? "\w" : "\d", g_szCTGunsMenu[i], get_pcvar_num(g_pCtGunsMenuCvars[i]) > 0 ? PriceString : "")
num_to_str(i, Position, charsmax(Position))
menu_additem(Cts_Menu, Items, Position)
}
menu_setprop(Cts_Menu, MPROP_EXIT, MEXIT_ALL)
if (!get_pcvar_num(g_pMenuEnableCvars[0]))
{
client_print_c(id, "%L", id, "SHOP_CT_OFF")
return PLUGIN_HANDLED;
}
else
menu_display(id, Cts_Menu, 0)
}
case 1:
{
new Ts_Menu = menu_create("\rОружие Т", "TeMenu_Handler")
new Items[32], PriceString[32], Position[3]
for (new i = 0; i < sizeof(g_szTGunsMenu); i++)
{
formatex(PriceString, charsmax(PriceString), "- $%d", get_pcvar_num(g_pTeGunsMenuCvars[i]))
formatex(Items, charsmax(Items), "%s%s %s", get_pcvar_num(g_pTeGunsMenuCvars[i]) > 0 ? "\w" : "\d", g_szTGunsMenu[i], get_pcvar_num(g_pTeGunsMenuCvars[i]) > 0 ? PriceString : "")
num_to_str(i, Position, charsmax(Position))
menu_additem(Ts_Menu, Items, Position)
}
menu_setprop(Ts_Menu, MPROP_EXIT, MEXIT_ALL)
if (!get_pcvar_num(g_pMenuEnableCvars[1]))
{
client_print_c(id, "%L", id, "SHOP_T_OFF")
return PLUGIN_HANDLED
}
else
menu_display(id, Ts_Menu, 0)
}
case 2:
{
new Inv_Menu = menu_create("\rМеню невидимости", "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 3:
Последнее редактирование модератором: