TauJIeP
Пользователь
- Регистрация
- 12 Июн 2017
- Сообщения
- 41
- Симпатии
- 1
- Пол
- Мужской
Автор: MakapoH.
Название плагина: VIP+Gold Menu
Версия: 1.0
Описание:
Типичный VIP+Gold плагин со встроенным дамагером (отключаемо). Все настройки и описания в исходнике.
Команды для привилегий:
Название плагина: VIP+Gold Menu
Версия: 1.0
Описание:
Типичный VIP+Gold плагин со встроенным дамагером (отключаемо). Все настройки и описания в исходнике.
Команды для привилегий:
- say /vipmenu
Код:
#include <amxmodx>
#include <reapi>
#include <fakemeta>
#include <cstrike>
#define FLAG_1 ADMIN_LEVEL_H // Флаг обычного випа
#define FLAG_2 ADMIN_LEVEL_D // Флаг золотого випа
#define BLOCK_MAP "awp_", "aim_", "$", "35hp_", "fy_" // Блокируемые карты
#define ROUND_ACCESS 3 // После ROUND_ACCESS раунда - доступно меню
#define BUY_TIME 15 // Сколько секунд можно использовать меню
#define AK_COST 4000 // Стоимость AK-47
#define DGL_COST 2000 // Стоимость DEAGLE
#define AK_DAMAGE 2.0 // Множитель урона AK-47 [ дробное! ]
#define DGL_DAMAGE 2.0 // Множитель урона DEAGLE [ дробное! ]
#define HP_BODY 5.0 // +HP_BODY за убийство в тело [ дробное! ]
#define HP_HS 10.0 // +HP_HS за убийство в голову [ дробное! ]
#define MSG_ROUND "^1Меню доступно после ^3%d ^1раунда!"
#define MSG_AK_ERROR "^1Для покупки оружия необходимо ^3%d ^4$!"
#define MSG_DGL_ERROR "^1Для покупки оружия необходимо ^3%d ^4$!"
#define MSG_MAP "^3Запрещено ^1на данной карте!"
#define MSG_ONLY_GOLD "^1Доступно только ^3GOLD ^1игрокам!"
#define MSG_SECOND "^1Время покупки ^3%d ^1секунд истекло!"
#define MSG_INFO "^1Золотое оружие наносит в ^32 ^1раза больше урона!"
#define MSG_ALIVE "^1Доступно только ^3живым^1 игрокам!"
#define MSG_ACCESS "^1Приобретите ^3Gold или ^3VIP ^1привилегии! Подробнее: ^4/buy"
#define MSG_BLOCK_WPN "^1Достуно^3 1 ^1раз за раунд!"
/* Пути до моделей */
new const AK_V_MODEL[] = "models/custom/v_ak47.mdl"
new const AK_P_MODEL[] = "models/custom/p_ak47.mdl"
new const AK_W_MODEL[] = "models/custom/w_ak47.mdl"
new const DGL_V_MODEL[] = "models/custom/v_deagle.mdl"
new const DGL_P_MODEL[] = "models/custom/p_deagle.mdl"
new const DGL_W_MODEL[] = "models/custom/w_deagle.mdl"
new isAlive[MAX_PLAYERS + 1]
new Damager[MAX_PLAYERS + 1]
new Has_AK[MAX_PLAYERS + 1]
new Has_DGL[MAX_PLAYERS + 1]
new PlayerPos[MAX_PLAYERS + 1]
new Block_Weapon[MAX_PLAYERS + 1]
new bool:Map_Blocked
new BuyTime
new HookChain:TakeDamage
new HookChain:Killed
new HookChain:Spawn
static Float:hp_add
new const Float:Coordinats[][] =
{
{0.50, 0.45},
{0.55, 0.50},
{0.50, 0.55},
{0.45, 0.50}
}
public plugin_init()
{
register_plugin("VIP+Gold Menu", "1.0", "MakapoH.")
register_clcmd("vipmenu", "vip_menu")
register_clcmd("say /vipmenu", "vip_menu")
register_clcmd("say_team /vipmenu", "vip_menu")
register_event("WeapPickup", "checkModel", "b", "1=19")
register_event("CurWeapon", "checkWeapon", "be", "1=1")
register_forward(FM_SetModel, "fw_SetModel")
EnableHookChain((Spawn = RegisterHookChain(RG_CBasePlayer_Spawn, "Event_Spawn", 1)))
RegisterHookChain(RG_CBasePlayer_PreThink, "Player_PreThink", 1)
EnableHookChain((TakeDamage = RegisterHookChain(RG_CBasePlayer_TakeDamage, "Event_TakeDamage", 0)))
EnableHookChain((TakeDamage = RegisterHookChain(RG_CBasePlayer_TakeDamage, "Event_TakeDamagePost", 1)))
EnableHookChain((Killed = RegisterHookChain(RG_CBasePlayer_Killed, "Event_Killed", 1)))
new PrefixMap[][] = { BLOCK_MAP }
new map[32]; get_mapname(map, charsmax(map))
for(new i; i < sizeof PrefixMap; i++)
if(containi(map, PrefixMap[i]) != -1) Map_Blocked = true
state Enable
if(Map_Blocked)
{
DisableHookChain(Spawn)
DisableHookChain(TakeDamage)
DisableHookChain(Killed)
state Disable
}
}
public plugin_precache()
{
precache_model(AK_V_MODEL)
precache_model(AK_P_MODEL)
precache_model(AK_W_MODEL)
precache_model(DGL_V_MODEL)
precache_model(DGL_P_MODEL)
precache_model(DGL_W_MODEL)
}
public client_putinserver(id)
{
if(!(get_user_flags(id) & FLAG_1)) return
isAlive[id] = 0
Damager[id] = true
}
public Event_Spawn(const id)
{
isAlive[id] = is_user_alive(id)
if(!(get_user_flags(id) & FLAG_1) || !isAlive[id]) return
if(get_member(id, m_iTeam) == TEAM_CT) rg_give_defusekit(id)
rg_set_user_armor(id, 100, ARMOR_VESTHELM)
rg_give_item(id, "weapon_deagle", GT_REPLACE)
rg_give_item(id, "weapon_hegrenade", GT_APPEND)
rg_give_item(id, "weapon_flashbang", GT_APPEND)
rg_give_item(id, "weapon_smokegrenade", GT_APPEND)
rg_set_user_bpammo(id, WEAPON_DEAGLE, 35)
rg_set_user_bpammo(id, WEAPON_FLASHBANG, 2)
rg_instant_reload_weapons(id, 0);
Block_Weapon[id] = false
BuyTime = get_systime()
}
public vip_menu(id)
{
if(!(get_user_flags(id) & FLAG_1))
return client_print_color(id, id, MSG_ACCESS)
if(Map_Blocked)
return client_print_color(id, id, MSG_MAP)
if(get_member_game(m_iTotalRoundsPlayed) < ROUND_ACCESS)
return client_print_color(id, id, MSG_ROUND, ROUND_ACCESS)
if(!isAlive[id])
return client_print_color(id, id, MSG_ALIVE)
if(get_systime() >= (BuyTime + BUY_TIME))
return client_print_color(id, id, MSG_SECOND, BUY_TIME)
new menu = menu_create("\yVIP \rМеню", "vip_menu_handler")
menu_additem(menu, "\wM4A1", "0")
menu_additem(menu, "\wAK-47", "1")
menu_additem(menu, "\wAWP", "2")
menu_additem(menu, "\wFamas^n", "3")
Damager[id] ? menu_additem(menu, "\yGold Дамагер \r[\wВКЛ\r]", "4") : menu_additem(menu, "\yGold Дамагер \r[\wВЫКЛ\r]", "4")
menu_additem(menu, "\yGold \rоружейка", "5")
menu_setprop(menu, MPROP_EXITNAME, "\rВыход")
menu_display(id, menu, 0)
return PLUGIN_CONTINUE
}
public vip_menu_handler(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new m_access, m_data[6], m_callback
menu_item_getinfo(menu, item, m_access, m_data, charsmax(m_data), _, _, m_callback)
new key = str_to_num(m_data)
switch(key)
{
case 0:
{
if(Block_Weapon[id])
return client_print_color(id, id, MSG_BLOCK_WPN)
rg_give_item(id, "weapon_m4a1", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_M4A1, 90)
Block_Weapon[id] = true
}
case 1:
{
if(Block_Weapon[id])
return client_print_color(id, id, MSG_BLOCK_WPN)
rg_give_item(id, "weapon_ak47", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_AK47, 90)
Block_Weapon[id] = true
}
case 2:
{
if(Block_Weapon[id])
return client_print_color(id, id, MSG_BLOCK_WPN)
rg_give_item(id, "weapon_awp", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_AWP, 30)
Block_Weapon[id] = true
}
case 3:
{
if(Block_Weapon[id])
return client_print_color(id, id, MSG_BLOCK_WPN)
rg_give_item(id, "weapon_famas", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_FAMAS, 90)
Block_Weapon[id] = true
}
case 4:
{
switch(Damager[id])
{
case true:Damager[id] = false
case false:Damager[id] = true
}
vip_menu(id)
}
case 5:gold_menu(id)
}
return PLUGIN_HANDLED
}
public gold_menu(id) <Enable>
{
if(!(get_user_flags(id) & FLAG_2))
return client_print_color(id, id, MSG_ONLY_GOLD)
new Line[64], Line2[64]
new menu = menu_create("\yGold \rМеню", "gold_menu_handler")
formatex(Line, charsmax(Line), "\yGold \wAK-47 \r[\y%d\r]", AK_COST)
menu_additem(menu, Line, "0")
formatex(Line2, charsmax(Line2), "\yGold \wDeagle \r[\y%d\r]", DGL_COST)
menu_additem(menu, Line2, "1")
menu_setprop(menu, MPROP_EXITNAME, "\rМеню")
menu_display(id, menu, 0)
return PLUGIN_CONTINUE
}
public gold_menu(id) <Disable> return PLUGIN_HANDLED
public gold_menu_handler(id, menu, item) <Enable>
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
vip_menu(id)
return PLUGIN_HANDLED
}
new m_access, m_data[2], m_callback
menu_item_getinfo(menu, item, m_access, m_data, charsmax(m_data), _, _, m_callback)
new my_money = cs_get_user_money(id)
new key = str_to_num(m_data)
switch(key)
{
case 0:
{
if(!(my_money >= AK_COST))
return client_print_color(id, id, MSG_AK_ERROR, AK_COST)
if(Block_Weapon[id])
return client_print_color(id, id, MSG_BLOCK_WPN)
rg_give_item(id, "weapon_ak47", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_AK47, 90)
cs_set_user_money(id, my_money - AK_COST)
client_print_color(id, id, MSG_INFO, floatround(AK_DAMAGE))
Block_Weapon[id] = true
Has_AK[id] = true
}
case 1:
{
if(!(my_money >= DGL_COST))
return client_print_color(id, id, MSG_DGL_ERROR, DGL_COST)
if(Block_Weapon[id])
return client_print_color(id, id, MSG_BLOCK_WPN)
rg_give_item(id, "weapon_deagle", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_DEAGLE, 35)
cs_set_user_money(id, my_money - DGL_COST)
client_print_color(id, id, MSG_INFO, floatround(DGL_DAMAGE))
Block_Weapon[id] = true
Has_DGL[id] = true
}
}
return PLUGIN_HANDLED
}
public gold_menu_handler(id, menu, item) <Disable> return PLUGIN_HANDLED
public checkModel(id) <Enable>
{
switch(read_data(2))
{
case CSW_AK47:
{
if(!Has_AK[id]) return
set_pev(id, pev_viewmodel2, AK_V_MODEL)
set_pev(id, pev_weaponmodel2, AK_P_MODEL)
}
case CSW_DEAGLE:
{
if(!Has_DGL[id]) return
set_pev(id, pev_viewmodel2, DGL_V_MODEL)
set_pev(id, pev_weaponmodel2, DGL_P_MODEL)
}
}
}
public checkModel(id) <Disable> return
public checkWeapon(id) <Enable>
{
static weapon; weapon = read_data(2)
if((weapon == CSW_AK47 && Has_AK[id]) || (weapon == CSW_DEAGLE && Has_DGL[id]))
checkModel(id)
}
public checkWeapon(id) <Disable> return
public fw_SetModel(entity, model[]) <Enable>
{
if(!pev_valid(entity)) return FMRES_IGNORED
new className[33]; pev(entity, pev_classname, className, charsmax(className))
new id = pev(entity, pev_owner)
if(Has_AK[id])
{
if(equali(model, "models/w_ak47.mdl"))
{
if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
{
engfunc(EngFunc_SetModel, entity, AK_W_MODEL)
return FMRES_SUPERCEDE
}
}
}
if(Has_DGL[id])
{
if(equali(model, "models/w_deagle.mdl"))
{
if(equal(className, "weaponbox") || equal(className, "armoury_entity") || equal(className, "grenade"))
{
engfunc(EngFunc_SetModel, entity, DGL_W_MODEL)
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
public fw_SetModel(entity, model[]) <Disable> return PLUGIN_HANDLED
public Event_TakeDamagePost(const Victim, Inflictor, Attacker, Float:flDamage)
get_member(Victim, m_lastDamageAmount)
public Event_TakeDamage(const Victim, Inflictor, Attacker, Float:flDamage)
{
if(!is_user_connected(Attacker) || !(get_user_flags(Attacker) & FLAG_2) ||
!Damager[Attacker] || get_member(Attacker, m_iTeam) == get_member(Victim, m_iTeam))
return HC_CONTINUE;
if(1 <= Attacker <= MAX_PLAYERS)
{
new iPos = ++PlayerPos[Attacker]
if(iPos == sizeof(Coordinats)) iPos = PlayerPos[Attacker] = 0
set_hudmessage(0, 255, 0, Float:Coordinats[iPos][0], Float:Coordinats[iPos][1], 0, 0.1, 2.5, 0.02, 0.02, -1)
show_hudmessage(Attacker, "%.0f", flDamage)
}
switch(get_user_weapon(Attacker))
{
case CSW_AK47:
{
if(Has_AK[Attacker])
{
SetHookChainArg(4, ATYPE_FLOAT, flDamage * AK_DAMAGE);
SetHookChainReturn(ATYPE_INTEGER, 1);
}
}
case CSW_DEAGLE:
{
if(Has_DGL[Attacker])
{
SetHookChainArg(4, ATYPE_FLOAT, flDamage * DGL_DAMAGE)
SetHookChainReturn(ATYPE_INTEGER, 1);
}
}
}
return HC_CONTINUE;
}
public Event_Killed(const Victim, Attacker)
{
if(!is_user_connected(Victim) || !is_user_connected(Attacker)) return
isAlive[Victim] = 0
if(!(get_user_flags(Attacker) & FLAG_1)) return
static Float:AttackerHP; AttackerHP = get_entvar(Attacker, var_health)
get_member(Victim, m_bHeadshotKilled) ? (hp_add = HP_HS) : (hp_add = HP_BODY)
AttackerHP += hp_add
if(AttackerHP > 100.0) AttackerHP = 100.0
set_entvar(Attacker, var_health, AttackerHP)
Has_AK[Victim] = false
Has_DGL[Victim] = false
}
public Player_PreThink(const id)
{
if(!isAlive[id] || !(get_user_flags(id) & FLAG_1) || ~get_entvar(id, var_button) & IN_USE || get_entvar(id, var_flags) & FL_ONGROUND)
return
static Float:velocity[3]; get_entvar(id, var_velocity, velocity)
if(velocity[2] < 0)
{
velocity[2] = (velocity[2] + 40.0 < -100) ? velocity[2] + 40.0 : -100.0
set_entvar(id, var_velocity, velocity)
}
}
Вложения
-
12,7 KB Просмотры: 120
Последнее редактирование: