PHP Code:
public ShopT (id, menu, item){
new alive = is_user_alive(id)
new team = get_user_team(id)
new user_money = get_user_frags(id)
new CostT1 = get_pcvar_num(T_item_1)
new CostT2 = get_pcvar_num(T_item_2)
new CostT3 = get_pcvar_num(T_item_3)
new CostT4 = get_pcvar_num(T_item_4)
new CostT5 = get_pcvar_num(T_item_5)
new CostT7 = get_pcvar_num(T_item_7)
new CostT8 = get_pcvar_num(T_item_8)
new CostT9 = get_pcvar_num(T_item_9)
new CostTa = get_pcvar_num(T_item_a)
new CostT10 = get_pcvar_num(T_item_10)
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
static dst[64], data[32], access, callback
menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback)
menu_destroy(menu)
switch(data[0]) {
case('1'):
{
if(user_money >= CostT1 && alive && team == 1 && get_bit(g_PlayerWanted, id)) {
clear_bit(g_PlayerWanted, id)
entity_set_int(id, EV_INT_skin, random_num(0, 2))
Color_Print(id, "^1[^4JAIL-RAW^1] Вы успешно дали взятку!")
set_user_frags(id, user_money - CostT1)
}
}
case('2'):
{
if(user_money >= CostT2 && alive && team == 1 && !g_HasWeapon[id]) {
engclient_cmd(id, "weapon_knife")
set_pev(id, pev_viewmodel2, g_chain_viewmodel)
set_pev(id, pev_weaponmodel2, g_chain_weaponmodel)
g_Chain[id] = true
g_HasWeapon[id] = true
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили бензопилу!")
set_user_frags(id, user_money - CostT2)
}
else if(g_HasWeapon[id]) {
Color_Print(id, "^1[^4JAIL-RAW^1] у вас уже есть оружие!")
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case('3'):
{
if(user_money >= CostT3 && alive && team == 1 && !g_HasWeapon[id]) {
engclient_cmd(id, "weapon_knife")
set_pev(id, pev_viewmodel2, g_electro_viewmodel)
set_pev(id, pev_weaponmodel2, g_electro_weaponmodel)
g_Electro[id] = true
g_HasWeapon[id] = true
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили электрошокер!")
set_user_frags(id, user_money - CostT3)
}
else if(g_HasWeapon[id]) {
Color_Print(id, "^1[^4JAIL-RAW^1] у вас уже есть оружие!")
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case('4'):
{
if(user_money >= CostT4 && alive && team == 1) {
set_user_maxspeed(id, 600.0)
g_speed[id] = true
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили скорость!")
set_user_frags(id, user_money - CostT4)
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case('5'):
{
if(user_money >= CostT5 && alive && team == 1) {
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили гранаты!")
set_user_frags(id, user_money - CostT5)
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case('6'):
{
if(user_money >= CostT7 && alive & team == 1) {
set_user_gravity(id, 0.2)
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили гравитацию!")
set_user_frags(id, user_money - CostT7)
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case('7'):
{
if(user_money >= CostT8 && alive & team == 1) {
give_item(id, "weapon_usp")
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили Секретное оружие!")
set_user_frags(id, user_money - CostT8)
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case('8'):
{
if(user_money >= CostT9 && alive & team == 1 && fdcooldown[id] == 0) {
set_bit(g_FreedayAuto, id)
Color_Print(id, "^1[^4JAIL-RAW^1] Вы купили отпуск в следуюзем раунде!")
set_user_frags(id, user_money - CostT9)
fdcooldown[id] = 7
}
else if(fdcooldown[id] > 0) Color_Print(id, "^1[^4JAIL-RAW^1] Нельзя так часто в отпуск!")
else Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
case('9'):
{
if(user_money >= CostTa && alive & team == 1) {
set_bit(g_uniform, id)
client_infochanged(id)
Color_Print(id, "^1[^4JAIL-RAW^1] Ты спёр форму охранника!")
set_user_frags(id, user_money - CostTa)
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
case ('10'):
{
if(user_money >= CostT10 && alive & team == 1) {
set_bit(g_Fonarik, id)
Color_Print(id, "^1[^4JAIL-RAW^1] Ты получил фонарик!")
set_user_frags(id, user_money - CostT10)
}
else {
Color_Print(id, "^1[^4JAIL-RAW^1] Не хватает авторитета")
}
}
}
return PLUGIN_CONTINUE
}