Но, есть проблема...на сервере вообще не открывается магазин
- Код: Выделить всё
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <engine>
#include <ltjump>
#include <fun>
#define al(%1) is_user_alive(%1)
#define MAX_CHAR 1024
#define PLUGIN "Dr Shop"
#define VERSION "0.3"
#define AUTHOR "CaNiBaL"
new cvar[33][33]
new cvarcost[33]
new terr[33]
new bubblesprite
#define ALL_GRENADE get_pcvar_num(cvarcost[1])
#define SPEED get_pcvar_num(cvarcost[2])
#define GRAVITY get_pcvar_num(cvarcost[3])
#define GLOW get_pcvar_num(cvarcost[4])
#define HE_GRENADE get_pcvar_num(cvarcost[5])
#define ICE_GRENADE get_pcvar_num(cvarcost[6])
#define WEAPON_UZI get_pcvar_num(cvarcost[7])
#define QUIET_STEP get_pcvar_num(cvarcost[8])
#define TWO_JUMP get_pcvar_num(cvarcost[9])
#define VITALITY get_pcvar_num(cvarcost[10])
#define MODEL_ENEMY get_pcvar_num(cvarcost[11])
#define LONG_JUMP get_pcvar_num(cvarcost[12])
#define INVISE get_pcvar_num(cvarcost[13])
#define BECOME_TERR get_pcvar_num(cvarcost[14])
#define TELEPORT_TO_TERR get_pcvar_num(cvarcost[15])
#define HEALTH_AND_ARRMOR get_pcvar_num(cvarcost[16])
new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
public plugin_unit()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("say /shop", "shop_menu_one")
register_concmd("say shop", "shop_menu_one")
register_concmd("say_team /shop", "shop_menu_one")
register_concmd("say_team shop", "shop_menu_one")
register_menu("menu_one", keys, "func_menu_one")
register_menu("menu_two", keys, "func_menu_two")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("CurWeapon", "active_weapon", "be", "1=1")
}
public plugin_cfg()
{
cvarcost[1] = register_cvar("shop_all_grenade", "2500")
cvarcost[2] = register_cvar("shop_speed", "8000")
cvarcost[3] = register_cvar("shop_gravity", "10000")
cvarcost[4] = register_cvar("shop_glow", "2300")
cvarcost[5] = register_cvar("shop_he_grenade", "1000")
cvarcost[6] = register_cvar("shop_ice_grenade", "1000")
cvarcost[7] = register_cvar("shop_weapon_uzi", "12200")
cvarcost[8] = register_cvar("shop_quiet_step", "8700")
cvarcost[9] = register_cvar("shop_two_jump", "9300")
cvarcost[10] = register_cvar("shop_vitality", "15000")
cvarcost[11] = register_cvar("shop_model_enemy", "10000")
cvarcost[12] = register_cvar("shop_long_jump", "7700")
cvarcost[13] = register_cvar("shop_invise", "20000")
cvarcost[14] = register_cvar("shop_become_terr", "40000")
cvarcost[15] = register_cvar("shop_teleport_to_terr", "30000")
cvarcost[16] = register_cvar("shop_health_and_arrmor", "7500")
new configsdir[128]
get_localinfo("amxx_configsdir", configsdir, 127)
return server_cmd("exec %s/deathrun_shop.cfg", configsdir)
}
public plugin_precache()
{
precache_sound("deathrun_plague/deathrun_shop/buy.wav")
precache_sound("deathrun_plague/deathrun_shop/transfer.wav")
precache_sound("deathrun_plague/deathrun_shop/teleport.wav")
precache_sound("deathrun_plague/deathrun_shop/lottery.wav")
precache_sound("deathrun_plague/deathrun_shop/error.wav")
bubblesprite = precache_model("sprites/flare.spr")
}
public active_weapon(id)
{
if(!is_user_alive(id))
return
if(cvar[id][2])
set_user_maxspeed(id, 450.0)
if(cvar[id][3])
set_user_gravity(id, 0.7)
}
public event_round_start()
{
for (new id; id <= get_maxplayers(); id++)
{
if(cvar[id][11])
cs_reset_user_model(id)
cvar[id][1] = 0
cvar[id][2] = 0
cvar[id][3] = 0
cvar[id][4] = 0
cvar[id][5] = 0
cvar[id][6] = 0
cvar[id][7] = 0
cvar[id][8] = 0
cvar[id][9] = 0
cvar[id][10] = 0
cvar[id][11] = 0
cvar[id][12] = 0
cvar[id][13] = 0
cvar[id][14] = 0
cvar[id][15] = 0
cvar[id][16] = 0
if(terr[id])
{
cs_set_user_team(id, 1)
terr[id] = 0
}
}
}
public shop_menu_one(id)
{
static menu[MAX_CHAR], iLen
iLen = 0
new money = cs_get_user_money(id), team = get_user_team(id)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\yМагазин сервера^n\wНа вашем счету: \r%d\y$^n^n", money)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r1. %sВсе гранаты \y(\dCT\y) \y[\r%d\d$\y]^n", !cvar[id][1] && (money > ALL_GRENADE) && al(id) && (team == 2) ? "\w" : "\d", ALL_GRENADE)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r2. %sУвеличенная скорость \y[\r%d\d$\y]^n", !cvar[id][2] && (money > SPEED) && al(id) ? "\w" : "\d", SPEED)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r3. %sУвеличенная гравитация \y[\r%d\d$\y]^n", !cvar[id][3] && (money > GRAVITY) && al(id) ? "\w" : "\d", GRAVITY)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r4. %sСвечение \y[\r%d\d$\y]^n", !cvar[id][4] && (money > GLOW) && al(id) ? "\w" : "\d", GLOW)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r5. %sГраната \y(\dHE\y) \y[\r%d\d$\y]^n", !cvar[id][5] && (money > HE_GRENADE) && al(id) ? "\w" : "\d", HE_GRENADE)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r6. %sГраната \y(\dCT\y) \y(\dICE\y) \y[\r%d\d$\y]^n", !cvar[id][6] && (money > ICE_GRENADE) && al(id) && (team == 2) ? "\w" : "\d", ICE_GRENADE)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r7. %sУзи \y(\dTE\y) \y[\r%d\d$\y]^n", !cvar[id][7] && (money > WEAPON_UZI) && al(id) && (team == 1) ? "\w" : "\d", WEAPON_UZI)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r8. %sБесшумные шаги \y[\r%d\d$\y]^n", !cvar[id][8] && (money > QUIET_STEP) && al(id) ? "\w" : "\d", QUIET_STEP)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "^n\r9. \wДальше")
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "^n\r0. \wВыход")
// Блокировка кнопок
!cvar[id][1] && (money > ALL_GRENADE) && al(id) ? (keys |= MENU_KEY_1) : ( keys &= ~MENU_KEY_1)
!cvar[id][2] && (money > SPEED) && al(id) ? (keys |= MENU_KEY_2) : ( keys &= ~MENU_KEY_2)
!cvar[id][3] && (money > GRAVITY) && al(id) ? (keys |= MENU_KEY_3) : ( keys &= ~MENU_KEY_3)
!cvar[id][4] && (money > GLOW) && al(id) ? (keys |= MENU_KEY_4) : ( keys &= ~MENU_KEY_4)
!cvar[id][5] && (money > HE_GRENADE) && al(id) ? (keys |= MENU_KEY_5) : ( keys &= ~MENU_KEY_5)
!cvar[id][6] && (money > ICE_GRENADE) && al(id) ? (keys |= MENU_KEY_6) : ( keys &= ~MENU_KEY_6)
!cvar[id][7] && (money > WEAPON_UZI) && al(id) ? (keys |= MENU_KEY_7) : ( keys &= ~MENU_KEY_7)
!cvar[id][8] && (money > QUIET_STEP) && al(id) ? (keys |= MENU_KEY_8) : ( keys &= ~MENU_KEY_8)
show_menu(id, keys, menu, -1, "menu_one")
return PLUGIN_CONTINUE
}
public func_menu_one(id, key)
{
switch(key)
{
case 0:
{
give_item(id, "weapon_hegrenade")
give_item(id, "weapon_flashbang")
give_item(id, "weapon_smokegrenade")
cs_set_user_money(id, cs_get_user_money(id) - ALL_GRENADE)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gвсе гранаты")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][1]++
shop_menu_one(id)
}
case 1:
{
set_user_maxspeed(id, 450.0)
cs_set_user_money(id, cs_get_user_money(id) - SPEED)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gувеличенную скорость")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][2]++
shop_menu_one(id)
}
case 2:
{
set_user_gravity(id, 0.7)
cs_set_user_money(id, cs_get_user_money(id) - GRAVITY)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gувеличенную гравитацию")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][3]++
shop_menu_one(id)
}
case 3:
{
render(id)
cs_set_user_money(id, cs_get_user_money(id) - GLOW)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gбесшумные шаги")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][4]++
shop_menu_one(id)
}
case 4:
{
give_item(id, "weapon_hegrenade")
cs_set_user_money(id, cs_get_user_money(id) - HE_GRENADE)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: (!tHE!y) !gгранату")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][5]++
shop_menu_one(id)
}
case 5:
{
give_item(id, "weapon_smokegrenade")
cs_set_user_money(id, cs_get_user_money(id) - ICE_GRENADE)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: (!tICE!y) !gгранату")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][6]++
shop_menu_one(id)
}
case 6:
{
give_item(id, "weapon_mac10")
cs_set_user_money(id, cs_get_user_money(id) - WEAPON_UZI)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gUZI")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][7]++
shop_menu_one(id)
}
case 7:
{
set_user_footsteps(id, 1)
cs_set_user_money(id, cs_get_user_money(id) - QUIET_STEP)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gбесшумные шаги")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][8]++
shop_menu_one(id)
}
case 8:
{
shop_menu_two(id)
}
}
return PLUGIN_CONTINUE
}
public shop_menu_two(id)
{
static menu[MAX_CHAR], iLen
iLen = 0
new money = cs_get_user_money(id), team = get_user_team(id)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\yМагазин сервера^n\wНа вашем счету: \r%d\y$^n^n", money)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r1. %sДвойной прыжок \y[\r%d\d$\y]^n", !cvar[id][9] && (money > TWO_JUMP) && al(id) ? "\w" : "\d", TWO_JUMP)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r2. %sНеуязвимость \y(\r5 \dсекунд\y) \y[\r%d\d$\y]^n", !cvar[id][10] && (money > VITALITY) && al(id) ? "\w" : "\d", VITALITY)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r3. %sМодель противника \y[\r%d\d$\y]^n", !cvar[id][11] && (money > MODEL_ENEMY) && al(id) ? "\w" : "\d", MODEL_ENEMY)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r4. %sДлиный прыжок \y[\r%d\d$\y]^n", !cvar[id][12] && (money > LONG_JUMP) && al(id) ? "\w" : "\d", LONG_JUMP)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r5. %sНевидимость \y(\dCT\y) \y(\r30 \dсекунд\y) \y[\r%d\d$\y]^n", !cvar[id][13] && (money > INVISE) && al(id) && (team == 2) ? "\w" : "\d", INVISE)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r6. %sСтать террористом \y(\dCT\y) \y[\r%d\d$\y]^n", !cvar[id][14] && (money > BECOME_TERR) && al(id) && (team == 2) ? "\w" : "\d", BECOME_TERR)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r7. %sТелепорт к террористу \y(\dCT\y) \y[\r%d\d$\y]^n", !cvar[id][15] && (money > TELEPORT_TO_TERR) && al(id) && (team == 2) ? "\w" : "\d", TELEPORT_TO_TERR)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\r8. %sЗдоровье и броня \y(\d+\r150\y) \y[\r%d\d$\y]^n", !cvar[id][16] && (money > HEALTH_AND_ARRMOR) && al(id) ? "\w" : "\d", HEALTH_AND_ARRMOR)
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "^n\r9. \wНазад")
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "^n\r0. \wВыход")
// Блокировка кнопок
!cvar[id][9] && (money > TWO_JUMP) && al(id) ? (keys |= MENU_KEY_1) : ( keys &= ~MENU_KEY_1)
!cvar[id][10] && (money > VITALITY) && al(id) ? (keys |= MENU_KEY_2) : ( keys &= ~MENU_KEY_2)
!cvar[id][11] && (money > MODEL_ENEMY) && al(id) ? (keys |= MENU_KEY_3) : ( keys &= ~MENU_KEY_3)
!cvar[id][12] && (money > LONG_JUMP) && al(id) ? (keys |= MENU_KEY_4) : ( keys &= ~MENU_KEY_4)
!cvar[id][13] && (money > INVISE) && al(id) ? (keys |= MENU_KEY_5) : ( keys &= ~MENU_KEY_5)
!cvar[id][14] && (money > BECOME_TERR) && al(id) ? (keys |= MENU_KEY_6) : ( keys &= ~MENU_KEY_6)
!cvar[id][15] && (money > TELEPORT_TO_TERR) && al(id) ? (keys |= MENU_KEY_7) : ( keys &= ~MENU_KEY_7)
!cvar[id][16] && (money > HEALTH_AND_ARRMOR) && al(id) ? (keys |= MENU_KEY_8) : ( keys &= ~MENU_KEY_8)
show_menu(id, keys, menu, -1, "menu_two")
return PLUGIN_CONTINUE
}
public func_menu_two(id, key)
{
switch(key)
{
case 0:
{
set_user_twojump (id, 1)
cs_set_user_money(id, cs_get_user_money(id) - TWO_JUMP)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gдвойной прыжок")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][9]++
shop_menu_two(id)
}
case 1:
{
set_user_godmode(id, 1)
set_task(5.0, "off_god_mode", id)
cs_set_user_money(id, cs_get_user_money(id) - VITALITY)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gнеуязвимость")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][10]++
shop_menu_two(id)
}
case 2:
{
if(get_user_team(id) & 1)
cs_set_user_model(id, "gsg9")
else if(get_user_team(id) & 2)
cs_set_user_model(id, "terror")
cs_set_user_money(id, cs_get_user_money(id) - MODEL_ENEMY)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gмодель противника")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][11]++
shop_menu_two(id)
}
case 3:
{
set_user_longjump(id, 1)
cs_set_user_money(id, cs_get_user_money(id) - LONG_JUMP)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gдлиный прыжок")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][12]++
shop_menu_two(id)
}
case 4:
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 0)
set_task(30.0, "end_invis", id)
cs_set_user_money(id, cs_get_user_money(id) - INVISE)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gневидимость")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][13]++
shop_menu_two(id)
}
case 5:
{
terr[id] = 1
cs_set_user_money(id, cs_get_user_money(id) - BECOME_TERR)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gпереход за террористов")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][14]++
shop_menu_two(id)
}
case 6:
{
action_teleport(id)
cs_set_user_money(id, cs_get_user_money(id) - TELEPORT_TO_TERR)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gтелепорт к террористу")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][15]++
shop_menu_two(id)
}
case 7:
{
set_user_armor(id, get_user_armor(id) +150)
set_user_health(id, get_user_health(id) +150)
cs_set_user_money(id, cs_get_user_money(id) - HEALTH_AND_ARRMOR)
color(id, "!y[!gМагазин!y] !t%s !yвы преобрели: !gздоровье !yи !gброню")
client_cmd(id, "deathrun_plague/deathrun_shop/buy.wav")
cvar[id][16]++
shop_menu_two(id)
}
case 8: shop_menu_one(id)
}
return PLUGIN_CONTINUE
}
public end_twojump(id)
{
set_user_twojump(id, 0)
get_user_twojump(id)
color(id, "!y[!gМагазин!y] !t%s !yвы больше не можете использовать: !gдвойной прыжок")
}
public end_longjump(id)
{
set_user_longjump(id, 0)
get_user_longjump(id)
color(id, "!y[!gМагазин!y] !t%s !yвы больше не можете использовать: !gдлиный прыжок")
}
public off_god_mode(id)
{
set_user_godmode(id, 0)
color(id, "!y[!gМагазин!y] !t%s !yвы больше не можете использовать: !gнеуязвимость")
}
public end_invis(id)
{
if(is_user_connected(id))
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal, 100)
color(id, "!y[!gМагазин!y] !t%s !yвы больше не можете использовать: !gневидимку")
}
return PLUGIN_HANDLED
}
public action_teleport(pPlayer)
{
new pEntity = 0;
new Float:vecOrigin[3];
while ((pEntity = find_ent_by_class(pEntity, "info_player_deathmatch")))
{
entity_get_vector(pEntity, EV_VEC_origin, vecOrigin);
engfunc(EngFunc_TraceHull, vecOrigin, vecOrigin, DONT_IGNORE_MONSTERS, HULL_HUMAN, pEntity, 0);
if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen))
continue;
entity_set_origin(pPlayer, vecOrigin);
break;
}
new UserOrigin[3];
get_user_origin(pPlayer, UserOrigin);
new BubbleOrigin[3];
BubbleOrigin[0] = UserOrigin[0];
BubbleOrigin[1] = UserOrigin[1];
BubbleOrigin[2] = UserOrigin[2] + 40;
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITETRAIL) // TE ID
write_coord(BubbleOrigin[0]) // Start Position X
write_coord(BubbleOrigin[1]) // Start Position Y
write_coord(BubbleOrigin[2]) // Start Position Z
write_coord(UserOrigin[0]) // End Position X
write_coord(UserOrigin[1]) // End Position Y
write_coord(UserOrigin[2]) // End Position Z
write_short(bubblesprite) // Sprite Index
write_byte(30) // Count
write_byte(10) // Life
write_byte(1) // Scale
write_byte(50) // Velocity Along Vector
write_byte(10) // Rendomness of Velocity
message_end()
}
public render(id)
{
new iRed = random_num(0, 255)
new iGreen = random_num(0, 255)
new iBlue = random_num(0, 255)
set_user_rendering(id, kRenderFxGlowShell, iRed, iGreen, iBlue, kRenderNormal, 0)
}
stock color(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}