Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <fakemeta>
#include <engine>
#include <colorchat>
#define FL_WATERJUMP (1<<11)
#define FL_ONGROUND (1<<9)
#define PLUGIN "Shop for Knife"
#define VERSION "0.1beta"
#define AUTHOR "-NegaTiV-"
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_0
new Gravity[33], Speed[33], Health[33], HeGrenade[33], FreezGrenade[33], Deagle[33], Rendering[33], Bhop[33], Bunny_Hop[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_menu("Menu 1", keys, "func_menu")
register_clcmd("say /shop", "ShopKnife")
RegisterHam(Ham_Spawn, "player", "player_spawn", 1)
}
public player_spawn(id)
{
Gravity[id] = 0
Speed[id] = 0
Health[id] = 0
HeGrenade[id] = 0
FreezGrenade[id] = 0
Deagle[id] = 0
Rendering[id] = 0
Bhop[id] = 0
Bunny_Hop[id] = false
}
public client_connect(id)
{
Bunny_Hop[id] = false
}
public ShopKnife(id)
{
static menu[1024], len
len = 0
new my_money = cs_get_user_money(id)
// Menu
if(get_user_flags(id) & ADMIN_LEVEL_A) {
len += formatex(menu[len], charsmax(menu) - len, "\r[\yShopMenu\r] \wМагазин | Скидка: \yЕсть^n^n")
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r[\yShopMenu\r] \wМагазин | Скидка: \rНету^n^n")
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 5000 || Gravity[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r1. \dГравитация (\r5000$\d)^n")
keys &= ~MENU_KEY_1
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wГравитация \d(\r5000$\d)^n")
keys |= MENU_KEY_1
}
} else {
if(!is_user_alive(id) || my_money < 10000 || Gravity[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r1. \dГравитация (\r10000$\d)^n")
keys &= ~MENU_KEY_1
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wГравитация \d(\r10000$\d)^n")
keys |= MENU_KEY_1
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 5000 || Speed[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r1. \dСкорость (\r5000$\d)^n")
keys &= ~MENU_KEY_2
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wСкорость \d(\r5000$\d)^n")
keys |= MENU_KEY_2
}
} else {
if(!is_user_alive(id) || my_money < 10000 || Speed[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r1. \dСкорость (\r10000$\d)^n")
keys &= ~MENU_KEY_2
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r1. \wСкорость \d(\r10000$\d)^n")
keys |= MENU_KEY_2
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 8000 || Health[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r3. \d+100 HP (\r8000$\d)^n")
keys &= ~MENU_KEY_3
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r3. \w+100 HP \d(\r8000$\d)^n")
keys |= MENU_KEY_3
}
} else {
if(!is_user_alive(id) || my_money < 16000 || Health[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r3. \d+100 HP (\r16000$\d)^n")
keys &= ~MENU_KEY_3
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r3. \w+100 HP \d(\r16000$\d)^n")
keys |= MENU_KEY_3
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 4500 || HeGrenade[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r4. \dВзрывная граната (\r4500$\d)^n")
keys &= ~MENU_KEY_4
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r4. \wВзрывная граната \d(\r4500$\d)^n")
keys |= MENU_KEY_4
}
} else {
if(!is_user_alive(id) || my_money < 9000 || HeGrenade[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r4. \dВзрывная граната (\r9000$\d)^n")
keys &= ~MENU_KEY_4
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r4. \wВзрывная граната \d(\r9000$\d)^n")
keys |= MENU_KEY_4
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 4500 || FreezGrenade[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r4. \dЗамораживающая гараната (\r4500$\d)^n")
keys &= ~MENU_KEY_5
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r4. \wЗамораживающая гараната \d(\r4500$\d)^n")
keys |= MENU_KEY_5
}
} else {
if(!is_user_alive(id) || my_money < 16000 || FreezGrenade[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r4. \dЗамораживающая гараната (\r9000$\d)^n")
keys &= ~MENU_KEY_5
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r4. \wЗамораживающая гараната \d(\r9000$\d)^n")
keys |= MENU_KEY_5
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 10000 || Rendering[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r6. \dНевидимость (\r10000$\d)^n")
keys &= ~MENU_KEY_6
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r6. \wНевидимость \d(\r10000$\d)^n")
keys |= MENU_KEY_6
}
} else {
if(!is_user_alive(id) || my_money < 20000 || Rendering[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r6. \dНевидимость (\r20000$\d)^n")
keys &= ~MENU_KEY_6
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r6. \wНевидимость \d(\r20000$\d)^n")
keys |= MENU_KEY_6
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 8000 || Deagle[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r7. \dДигл 3 патрона (\r8000$\d)^n")
keys &= ~MENU_KEY_7
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r7. \wДигл 3 патрона \d(\r8000$\d)^n")
keys |= MENU_KEY_7
}
} else {
if(!is_user_alive(id) || my_money < 16000 || Deagle[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r7. \dДигл 3 патрона (\r16000$\d)^n")
keys &= ~MENU_KEY_7
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r7. \wДигл 3 патрона \d(\r16000$\d)^n")
keys |= MENU_KEY_7
}
}
if(get_user_flags(id) & ADMIN_LEVEL_A)
{
if(!is_user_alive(id) || my_money < 8000 || Bhop[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r8. \dБанихоп (\r8000$\d)^n^n")
keys &= ~MENU_KEY_8
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r8. \wБанихоп \d(\r8000$\d)^n^n")
keys |= MENU_KEY_8
}
} else {
if(!is_user_alive(id) || my_money < 16000 || Health[id] >= 1)
{
len += formatex(menu[len], charsmax(menu) - len, "\r8. \dБанихоп (\r16000$\d)^n^n")
keys &= ~MENU_KEY_8
} else {
len += formatex(menu[len], charsmax(menu) - len, "\r8. \wБанихоп \d(\r16000$\d)^n^n")
keys |= MENU_KEY_8
}
}
len += formatex(menu[len], charsmax(menu) - len, "\r0. \wВыход")
keys |= MENU_KEY_0
show_menu(id, keys, menu, -1, "Menu 1")
return PLUGIN_HANDLED;
}
public func_menu(id, key)
{
new my_money = cs_get_user_money(id)
switch(key)
{
case 0:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 5000 || Gravity[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 5000)
set_user_gravity(id, 0.5)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Гравитацию")
Gravity[id]++
}
} else {
if(!is_user_alive(id) || my_money < 10000 || Gravity[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 10000)
set_user_gravity(id, 0.5)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Гравитацию")
Gravity[id]++
}
}
}
case 1:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 5000 || Speed[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 5000)
set_user_maxspeed(id, 320.0)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Скорость")
Speed[id]++
}
} else {
if(!is_user_alive(id) || my_money < 10000 || Gravity[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 10000)
set_user_maxspeed(id, 320.0)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Скорость")
Speed[id]++
}
}
}
case 2:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 8000 || Health[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 8000)
set_user_health(id, get_user_health(id) + 100)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4+100 HP")
Health[id]++
}
} else {
if(!is_user_alive(id) || my_money < 16000 || Health[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 16000)
set_user_health(id, get_user_health(id) + 100)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4+100 HP")
Health[id]++
}
}
}
case 3:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 4500 || HeGrenade[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 4500)
give_item(id, "weapon_hegrenade")
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Взрывную гранату")
HeGrenade[id]++
}
} else {
if(!is_user_alive(id) || my_money < 9000 || HeGrenade[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 9000)
give_item(id, "weapon_hegrenade")
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Взрывную гранату")
HeGrenade[id]++
}
}
}
case 4:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 4500 || FreezGrenade[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 4500)
give_item(id, "weapon_smokegrenade")
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Замораживающую гранату")
FreezGrenade[id]++
}
} else {
if(!is_user_alive(id) || my_money < 9000 || FreezGrenade[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 9000)
give_item(id, "weapon_smokegrenade")
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Замораживающую гранату")
FreezGrenade[id]++
}
}
}
case 5:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 10000 || Rendering[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 10000)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,20)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Невидимость")
Rendering[id]++
}
} else {
if(!is_user_alive(id) || my_money < 20000 || Rendering[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 20000)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,20)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Невидимость")
Rendering[id]++
}
}
}
case 6:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 8000 || Deagle[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 8000)
cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 3)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Дигл 3 патрона")
Deagle[id]++
}
} else {
if(!is_user_alive(id) || my_money < 16000 || Deagle[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 16000)
cs_set_weapon_ammo(give_item(id, "weapon_deagle"), 3)
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Дигл 3 патрона")
Deagle[id]++
}
}
}
case 7:{
if(get_user_flags(id) & ADMIN_LEVEL_A) {
if(!is_user_alive(id) || my_money < 8000 || Bhop[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 8000)
Bunny_Hop[id] = true
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Банихоп")
Bhop[id]++
}
} else {
if(!is_user_alive(id) || my_money < 16000 || Bhop[id] >= 1) {
return PLUGIN_CONTINUE;
} else {
cs_set_user_money(id, my_money - 16000)
Bunny_Hop[id] = true
ColorChat(id, NORMAL, "^1[^4Shop^1] ^3Вы купили: ^4Банихоп")
Bhop[id]++
}
}
}
}
return PLUGIN_HANDLED;
}
public client_PreThink(id)
{
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:vecVelocity[3]
entity_get_vector(id, EV_VEC_velocity, vecVelocity)
if(Bunny_Hop[id])
vecVelocity[2] += 250.0
entity_set_vector(id, EV_VEC_velocity, vecVelocity)
entity_set_int(id, EV_INT_gaitsequence, 6)
}
return PLUGIN_CONTINUE
}