/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <hamsandwich>
#include <fakemeta>
#include <dhudmessage>
#include <colorchat>
#define PLUGIN "bb_shop"
#define VERSION "1.0"
#define AUTHOR "CaNiBaL"
#if cellbits == 32
const OFFSET_CLIPAMMO = 51
#else
const OFFSET_CLIPAMMO = 65
#endif
const OFFSET_LINUX_WEAPONS = 4
new const MAXCLIP[] = { -1, 13, -1, 10, 1, 7, -1, 30, 30, 1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, 2, 7, 30, 30, -1, 50 }
new g_has_unlimited_clip[33]
new bool:gravity[33]
new szThreeJump[33], szThreeJumpNum[33], szDoThreeJump[33]
new HasBhop[33], HasGrava[33], HasHP[33], HasAmmo[33], HasLot[33], HasInvis[33], HasJump[33]
new userspeed[33]
new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MEN
U_KEY_8|MENU_KEY_9|MENU_KEY_0
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /shop", "shop")
register_menu("shopmenu", keys, "func_menu")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
RegisterHam(Ham_Spawn, "player", "event_PlayerSpawn_post",1)
register_forward(FM_PlayerPreThink, "ThreeJump")
register_forward(FM_PlayerPostThink, "PostThreeJump")
register_concmd("money", "give_money")
return PLUGIN_HANDLED
}
public give_money(id)
{
if(get_user_flags(id) & ADMIN_IMMUNITY)
{
cs_set_user_money(id, cs_get_user_money(id) + 100000)
}
return PLUGIN_HANDLED
}
public event_PlayerSpawn_post(id)
{
if(is_user_connected(id) && is_user_alive(id))
{
HasGrava[id] = 0
HasBhop[id] = 0
HasAmmo[id] = 0
HasHP[id] = 0
HasLot[id] = 0
HasInvis[id] = 0
HasJump[id] = 0
gravity[id] = false
szThreeJump[id] = false
}
return PLUGIN_HANDLED
}
public buy(id)
{
g_has_unlimited_clip[id] = true
}
public event_round_start()
{
for (new id; id <= 32; id++)
g_has_unlimited_clip[id] = false;
}
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
if (!g_has_unlimited_clip[msg_entity])
return;
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
return;
static weapon, clip
weapon = get_msg_arg_int(2)
clip = get_msg_arg_int(3)
if (MAXCLIP[weapon] > 2)
{
set_msg_arg_int(3, get_msg_argtype(3), MAXCLIP[weapon])
if (clip < 2) // refill when clip is nearly empty
{
static wname[32], weapon_ent
get_weaponname(weapon, wname, sizeof wname - 1)
weapon_ent = fm_find_ent_by_owner(-1, wname, msg_entity)
fm_set_weapon_ammo(weapon_ent, MAXCLIP[weapon])
}
}
}
stock fm_find_ent_by_owner(entity, const classname[], owner)
{
while ((entity = engfunc(EngFunc_FindEntityByString, entity, "classname", classname)) && pev(entity, pev_owner) != owner) {}
return entity;
}
stock fm_set_weapon_ammo(entity, amount)
{
set_pdata_int(entity, OFFSET_CLIPAMMO, amount, OFFSET_LINUX_WEAPONS);
}
public shop(id)
{
new money = cs_get_user_money(id)
new name[32]
get_user_name(id, name, 31)
static menu[650], iLen
iLen = 0
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\yПривет: \r%s.^n\yВашы деньги: \r%d$.^n\wУдачного приобритения!^n^n",name, money)
if(!is_user_alive(id) || HasGrava[id] >= 1 || money < 4000 || get_user_team(id) != 2)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d1. Гравитация \w[\y4000$\w]^n")
keys |= MENU_KEY_1
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r1. \yГравитация \w[\y4000$\w]^n")
keys |= MENU_KEY_1
}
if(!is_user_alive(id) || HasHP[id] >= 1 || money < 10000 || get_user_team(id) != 2)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d2. Бронь и жизнь \w(\y255AP | 255HP\w) [\y10000$\w]^n")
keys |= MENU_KEY_2
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r2. \yБронь и жизнь \w(\y255AP | 255HP\w) [\y10000$\w]^n")
keys |= MENU_KEY_2
}
if(!is_user_alive(id) || HasAmmo[id] >= 1 || money < 20000 || get_user_team(id) != 2)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d3. Бессконечные патроны \w[\y20000$\w]^n")
keys |= MENU_KEY_3
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r3. \yБессконечные патроны \w[\y20000$\w]^n")
keys |= MENU_KEY_3
}
if(!is_user_alive(id) || HasInvis[id] >= 1 || money < 6000)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d4. Невидимость \w[\y6000$\w]^n")
keys |= MENU_KEY_4
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r4. \yНевидимость \w[\y6000$\w]^n")
keys |= MENU_KEY_4
}
if(!is_user_alive(id) || HasLot[id] >= 1 || money < 4000)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d5. Лотерея \w[\y4000$\w]^n")
keys |= MENU_KEY_5
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r5. \yЛотерея \w[\y4000$\w]^n")
keys |= MENU_KEY_5
}
if(!is_user_alive(id) || HasBhop[id] >= 1 || money < 9500)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d6. Банихоп \w[\y9500$\w]^n")
keys |= MENU_KEY_6
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r6. \yБанихоп \w[\y9500$\w]^n")
keys |= MENU_KEY_6
}
if(!is_user_alive(id) || HasJump[id] >= 1 || money < 7000)
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\d7. Тройной прижок)\w[\y7000$\w]^n^n")
keys |= MENU_KEY_7
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r7. \yТройной прижок \w[\y7000$\w]^n^n")
keys |= MENU_KEY_7
}
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r0. \wВыход")
keys |= MENU_KEY_0
show_menu(id, keys, menu, -1, "shopmenu")
return PLUGIN_HANDLED
}
public func_menu(id, key)
{
new name[32]
get_user_name(id, name, 31)
new money = cs_get_user_money(id)
switch(key)
{
case 0:
{
if(!is_user_alive(id) || HasGrava[id] >= 1 || money < 4000 || get_user_team(id) != 2)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 4000)
set_user_gravity(id, 0.5)
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Вы купили^x04 гравитацию", name)
gravity[id] = true
HasGrava[id]++
}
}
case 1:
{
if(!is_user_alive(id) || HasHP[id] >= 1 || money < 10000 || get_user_team(id) != 2)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 10000)
set_user_armor(id, 255)
set_user_health(id, 255)
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Вы купили^x04 255брони и жизни ", name)
HasHP[id]++
}
}
case 2:
{
if(!is_user_alive(id) || HasAmmo[id] >= 1 || money < 20000 || get_user_team(id) != 2)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 20000)
buy(id)
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Вы купилио^x04 бес.патроны на 1 раунд", name)
HasAmmo[id]++
}
}
case 3:
{
if(!is_user_alive(id) || HasInvis[id] >= 1 || money < 6000)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 6000)
set_user_rendering(id,kRenderFxNone, 0,0,0, kRenderTransAdd,0)
set_task(20.0, "OffInvis", id)
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Вас не видно^x04 на 20 секунд", name)
HasInvis[id]++
}
}
case 4:
{
if(!is_user_alive(id) || HasLot[id] >= 1 || money < 4000)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 4000)
set_task(9.0, "loter", id)
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Результат^x04 через 10 секунд", name)
HasLot[id]++
}
}
case 5:
{
if(!is_user_alive(id) || HasBhop[id] >= 1 || money < 9500)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 9500)
userspeed[id] = 1
set_task(1500.0, "Offbhop", id)
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Вы купили банихоп^x04 на 25 минут", name)
HasBhop[id]++
}
}
case 6:
{
if(!is_user_alive(id) || HasJump[id] >= 1 || money < 7000)
{
return PLUGIN_CONTINUE
}
else
{
cs_set_user_money(id, cs_get_user_money(id) - 7000)
szThreeJump[id] = true
ColorChat(id, GREEN, "[Магазин]^x03 %s ^x01Вы купили тройной прижок^x04 на 1 роунд", name)
HasJump[id]++
}
}
}
return PLUGIN_HANDLED
}
public client_PreThink(id)
{
if(is_user_alive(id))
{
if(userspeed[id] == 1)
{
entity_set_float(id, EV_FL_fuser2, 0.0)
if(entity_get_int(id, EV_INT_button) & 2)
{
new flags = entity_get_int(id, EV_INT_flags)
if (flags & FL_WATERJUMP)
return PLUGIN_CONTINUE
if (entity_get_int(id, EV_INT_waterlevel) >= 2 )
return PLUGIN_CONTINUE
if (!(flags & FL_ONGROUND))
return PLUGIN_CONTINUE
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
velocity[2] += 250.0
entity_set_vector(id, EV_VEC_velocity, velocity)
entity_set_int(id, EV_INT_gaitsequence, 6)
}
}
}
return PLUGIN_CONTINUE
}
public Offbhop(id)
{
if(is_user_connected(id))
{
userspeed[id]=0
new name[32]
get_user_name(id, name, 31)
ColorChat(id, GREEN, "[Невидимка]^x03 %s ^x01Вас стало^x04 Видно", name)
}
return PLUGIN_HANDLED
}
public loter(id)
{
if(is_user_connected(id) )
{
new shans
shans = random_num(200, 16000)
cs_set_user_money(id, cs_get_user_money(id) + shans)
new name[32]
get_user_name(id, name, 31)
ColorChat(id, GREEN, "[Лотерейка]^x03 %s ^x01Вы виграли^x04 %d$", name, shans)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public OffInvis(id)
{
if(is_user_connected(id))
{
set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderNormal,100)
new name[32]
get_user_name(id, name, 31)
ColorChat(id, GREEN, "[Нивидимка]^x03 %s ^x01Вы Стали^x04 видны.", name)
}
return PLUGIN_HANDLED
}
public ThreeJump(id)
{
if(szThreeJump[id])
{
new szButton = pev(id, pev_button)
new szOldButton = pev(id, pev_oldbuttons)
if((szButton & IN_JUMP) && !(pev(id, pev_flags) & FL_ONGROUND) && !(szOldButton & IN_JUMP))
{
if(szThreeJumpNum[id] < 2)
{
szDoThreeJump[id] = true
szThreeJumpNum[id]++
return PLUGIN_CONTINUE
}
}
if((szButton & IN_JUMP) && (pev(id, pev_flags) & FL_ONGROUND))
{
szThreeJumpNum[id] = 0
}
}
return PLUGIN_CONTINUE
}
public PostThreeJump(id)
{
if(szThreeJump[id])
{
if(!is_user_alive(id))
return PLUGIN_CONTINUE
if(szDoThreeJump[id])
{
new Float:szVelocity[3]
pev(id, pev_velocity, szVelocity)
szVelocity[2] = random_float(295.0,305.0)
set_pev(id, pev_velocity, szVelocity)
szDoThreeJump[id] = false
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/