Код за потвърждение: Избери целия код
#include <amxmodx>
#include <reapi>
#define VERSION "1.0.1 - 14.02.2024"
enum eCvars
{
Float:SPAWN_HP,
SPAWN_AP,
SPAWN_HE,
SPAWN_FLASH,
SPAWN_SMOKE,
SPAWN_DEAGLE,
SPAWN_DEFUSEKIT,
INFINITE_AMMO,
INFINITE_BPAMMO,
RELOAD_WEAPON_ON_HS,
BONUS_DAMAGE[10],
KILL_MONEY,
HS_KILL_MONEY,
BONUS_HE_ON_HS,
BONUS_HE_ON_HS_MAX,
DOUBLE_JUMP,
VAMPIRE,
Float:VAMPIRE_HP_KILL,
Float:VAMPIRE_HP_HS,
Float:VAMPIRE_MAX_HP,
VIP_EXTRAS_ACCESS[10],
VIP_INFO_SCOREBOARD
}
new g_pCvars[eCvars]
new g_iJumps[MAX_CLIENTS + 1]
public plugin_init()
{
register_plugin("xVIP Extras", VERSION, "Huehue @ AMXX-BG.INFO")
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn", true)
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage", false)
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", true)
RegisterHookChain(RG_CBasePlayer_AddAccount, "CBasePlayer_AddAccount", false)
RegisterHookChain(RG_CBasePlayer_Jump, "CBasePlayer_Jump", true)
RegisterHookChain(RG_CBasePlayerWeapon_DefaultReload, "CBasePlayerWeapon_DefaultReload")
// Spawn features
bind_pcvar_float(create_cvar("xve_spawn_health", "100.0", .description = "With how much Health VIP will be spawned^n0 - To disable function"), g_pCvars[SPAWN_HP])
bind_pcvar_num(create_cvar("xve_spawn_armor", "100", .description = "With how much Armor VIP will be spawned^n0 - To disable function"), g_pCvars[SPAWN_AP])
bind_pcvar_num(create_cvar("xve_spawn_he_amount", "1", .description = "With how many He Grenade(s) VIP will be spawned^n0 - To disable function"), g_pCvars[SPAWN_HE])
bind_pcvar_num(create_cvar("xve_spawn_flash_amount", "1", .description = "With how many FlashBang(s) VIP will be spawned^n0 - To disable function"), g_pCvars[SPAWN_FLASH])
bind_pcvar_num(create_cvar("xve_spawn_smoke_amount", "1", .description = "With how many Smoke Grenade(s) VIP will be spawned^n0 - To disable function"), g_pCvars[SPAWN_SMOKE])
bind_pcvar_num(create_cvar("xve_spawn_deagle", "1", .description = "Whether VIP will be spawned with Deagle or not^n0 - To disable function"), g_pCvars[SPAWN_DEAGLE])
bind_pcvar_num(create_cvar("xve_spawn_defusekit", "0", .description = "Whether VIP (CT) will be spawned with Defuse Kit or not^n0 - To disable function"), g_pCvars[SPAWN_DEFUSEKIT])
// Gameplay features
bind_pcvar_num(create_cvar("xve_infinite_ammo", "0", .description = "Whether VIP will have infinite ammo or not^n0 - To disable function"), g_pCvars[INFINITE_AMMO])
bind_pcvar_num(create_cvar("xve_infinite_bpammo", "0", .description = "Whether VIP will have infinite bpammo or not^n0 - To disable function"), g_pCvars[INFINITE_BPAMMO])
bind_pcvar_num(create_cvar("xve_reload_weapon_on_headshot", "0", .description = "Whether VIP will have weapon reloaded on headshot kill or not^n0 - To disable function"), g_pCvars[RELOAD_WEAPON_ON_HS])
bind_pcvar_string(create_cvar("xve_bonus_damage", "0", .description = "With how much VIP Damage will be increased^n0 - To disable function^nExample: +10% | +50"), g_pCvars[BONUS_DAMAGE], charsmax(g_pCvars[BONUS_DAMAGE]))
bind_pcvar_num(create_cvar("xve_kill_money", "500", .description = "How much Money VIP will be gaining for normal kill^n0 - To disable function"), g_pCvars[KILL_MONEY])
bind_pcvar_num(create_cvar("xve_headshot_kill_money", "800", .description = "How much Money VIP will be gaining for headshot kill^n0 - To disable function"), g_pCvars[HS_KILL_MONEY])
bind_pcvar_num(create_cvar("xve_bonus_he_on_headshot", "0", .description = "Whether VIP will get HE Grenade(s) for headshot kill^n0 - To disable function"), g_pCvars[BONUS_HE_ON_HS])
bind_pcvar_num(create_cvar("xve_bonus_he_on_headshot_max_amount", "0", .description = "How many HE Grenade(s) VIP can hold from headshot kills"), g_pCvars[BONUS_HE_ON_HS_MAX])
bind_pcvar_num(create_cvar("xve_double_jump", "0", .description = "Whether VIP will have Double Jump or not^n0 - To disable function"), g_pCvars[DOUBLE_JUMP])
bind_pcvar_num(create_cvar("xve_vampire_hp", "0", .description = "Whether VIP will have Vampire or not^n0 - To disable function^nReceiving extra health on kills"), g_pCvars[DOUBLE_JUMP])
bind_pcvar_float(create_cvar("xve_vampire_hp_kill", "5.0", .description = "How much Health VIP will be gaining for normal kill"), g_pCvars[VAMPIRE_HP_KILL])
bind_pcvar_float(create_cvar("xve_vampire_hp_headshot_kill", "10.0", .description = "How much Health VIP will be gaining for headshot kill"), g_pCvars[VAMPIRE_HP_HS])
bind_pcvar_float(create_cvar("xve_vampire_hp_max_hp", "200.0", .description = "How much Health VIP can reach with Vampire"), g_pCvars[VAMPIRE_MAX_HP])
// VIP Access
bind_pcvar_string(create_cvar("xve_access_flag", "b", .description = "Which flag is required for player to access VIP Extras^nDefault Flag: 'b'"), g_pCvars[VIP_EXTRAS_ACCESS], charsmax(g_pCvars[VIP_EXTRAS_ACCESS]))
bind_pcvar_num(create_cvar("xve_vip_scoreboard_info", "1", .description = "Whether VIP will be printed for CT when player has access^n0 - To disable function"), g_pCvars[VIP_INFO_SCOREBOARD])
register_message(get_user_msgid("ScoreAttrib"), "OnScoreAttrib")
AutoExecConfig(true, "xVIP_Extras_HeatoN", "HuehuePlugins_Config")
}
public OnConfigsExecuted()
{
if (g_pCvars[VIP_EXTRAS_ACCESS] == EOS)
copy(g_pCvars[VIP_EXTRAS_ACCESS], charsmax(g_pCvars[VIP_EXTRAS_ACCESS]), "b")
}
public client_putinserver(id)
{
g_iJumps[id] = 0
}
public OnScoreAttrib(iMsgId, iMsgDest, iMsgEnt)
{
enum
{
arg_index = 1,
arg_flags = 2
}
new id = get_msg_arg_int(arg_index)
if(g_pCvars[VIP_INFO_SCOREBOARD] && has_user_access(id))
{
set_msg_arg_int(arg_flags, ARG_BYTE, SCORE_STATUS_VIP)
}
}
public CBasePlayer_Spawn(id)
{
if (is_user_alive(id) && has_user_access(id))
{
if (rg_get_user_bpammo(id, WEAPON_HEGRENADE) > 0 || rg_get_user_bpammo(id, WEAPON_FLASHBANG) > 0 || rg_get_user_bpammo(id, WEAPON_SMOKEGRENADE) > 0)
rg_remove_items_by_slot(id, GRENADE_SLOT)
if (g_pCvars[SPAWN_HP] > 0)
set_entvar(id, var_health, g_pCvars[SPAWN_HP])
if (g_pCvars[SPAWN_AP] > 0)
rg_set_user_armor(id, g_pCvars[SPAWN_AP], ARMOR_VESTHELM)
if (g_pCvars[SPAWN_DEFUSEKIT] && get_member(id, m_iTeam) == TEAM_CT)
rg_give_defusekit(id, true)
if (g_pCvars[SPAWN_HE] > 0)
{
rg_give_item(id, "weapon_hegrenade")
rg_set_user_bpammo(id, WEAPON_HEGRENADE, g_pCvars[SPAWN_HE])
}
if (g_pCvars[SPAWN_FLASH] > 0)
{
rg_give_item(id, "weapon_flashbang")
rg_set_user_bpammo(id, WEAPON_FLASHBANG, g_pCvars[SPAWN_FLASH])
}
if (g_pCvars[SPAWN_SMOKE] > 0)
{
rg_give_item(id, "weapon_smokegrenade")
rg_set_user_bpammo(id, WEAPON_SMOKEGRENADE, g_pCvars[SPAWN_SMOKE])
}
if (g_pCvars[SPAWN_DEAGLE])
{
rg_give_item(id, "weapon_deagle", GT_REPLACE)
rg_set_user_bpammo(id, WEAPON_DEAGLE, 35)
}
set_member(id, m_iWeaponInfiniteAmmo, g_pCvars[INFINITE_AMMO] ? true : false)
}
}
public CBasePlayer_TakeDamage(iVictim, Inflictor, iAttacker, Float:flDamage, iDamageBits)
{
if (!is_user_alive(iAttacker) || iVictim == iAttacker || !has_user_access(iAttacker) || equal(g_pCvars[BONUS_DAMAGE], "0"))
return HC_CONTINUE
SetHookChainArg(4, ATYPE_FLOAT, float(math_calculate(floatround(flDamage), g_pCvars[BONUS_DAMAGE])))
return HC_CONTINUE
}
public CBasePlayer_Killed(iVictim, iKiller, iShouldGib)
{
if (!is_user_alive(iKiller) || iVictim == iKiller || !has_user_access(iKiller))
return HC_CONTINUE
new Float:flHealthKiller, Float:flHealthAdd
get_entvar(iKiller, var_health, flHealthKiller)
if (get_member(iVictim, m_bHeadshotKilled))
{
flHealthAdd = g_pCvars[VAMPIRE_HP_HS]
if (g_pCvars[BONUS_HE_ON_HS] > 0)
{
rg_give_item(iKiller, "weapon_hegrenade", GT_APPEND)
rg_set_user_bpammo(iKiller, WEAPON_HEGRENADE, clamp(rg_get_user_bpammo(iKiller, WEAPON_HEGRENADE) + 1, rg_get_user_bpammo(iKiller, WEAPON_HEGRENADE), g_pCvars[BONUS_HE_ON_HS_MAX]))
}
if (g_pCvars[HS_KILL_MONEY] > 0)
rg_add_account(iKiller, g_pCvars[HS_KILL_MONEY], AS_ADD, true)
if (g_pCvars[RELOAD_WEAPON_ON_HS])
{
new pActiveItem = get_member(iKiller, m_pActiveItem)
if (is_nullent(pActiveItem) || rg_get_iteminfo(pActiveItem, ItemInfo_iMaxClip) == -1)
return HC_CONTINUE
rg_instant_reload_weapons(iKiller, pActiveItem)
}
}
else
{
flHealthAdd = g_pCvars[VAMPIRE_HP_KILL]
if (g_pCvars[KILL_MONEY] > 0)
rg_add_account(iKiller, g_pCvars[KILL_MONEY], AS_ADD, true)
}
if (g_pCvars[VAMPIRE])
set_entvar(iKiller, var_health, floatclamp(flHealthKiller + flHealthAdd, flHealthKiller, (g_pCvars[VAMPIRE_MAX_HP] > 0.0 ? g_pCvars[VAMPIRE_MAX_HP] : get_entvar(iKiller, var_max_health))))
return HC_CONTINUE
}
public CBasePlayer_AddAccount(id, iAmount, RewardType:R_Type, bool:bTrackChange)
{
if (has_user_access(id))
{
if (g_pCvars[HS_KILL_MONEY] > 0 && g_pCvars[KILL_MONEY] > 0)
{
if (R_Type == RT_ENEMY_KILLED)
return HC_SUPERCEDE
}
}
return HC_CONTINUE
}
public CBasePlayer_Jump(id)
{
if (is_user_alive(id) && has_user_access(id) && g_pCvars[DOUBLE_JUMP])
{
static iFlags
iFlags = get_entvar(id, var_flags)
if (iFlags & FL_WATERJUMP || get_entvar(id, var_waterlevel) >= 2 || !(get_member(id, m_afButtonPressed) & IN_JUMP))
return HC_CONTINUE
if (++g_iJumps[id] <= 1)
{
new Float:flVelocity[3]
get_entvar(id, var_velocity, flVelocity)
flVelocity[2] = random_float(265.0, 285.0)
set_entvar(id, var_velocity, flVelocity)
return HC_CONTINUE
}
if (iFlags & FL_ONGROUND)
{
g_iJumps[id] = 0
return HC_CONTINUE
}
}
return HC_CONTINUE
}
public CBasePlayerWeapon_DefaultReload(const this, iClipSize, iAnim, Float:fDelay)
{
new id = get_member(this, m_pPlayer)
if (g_pCvars[INFINITE_BPAMMO] && has_user_access(id))
{
new pActiveItem = get_member(id, m_pActiveItem)
new WeaponIdType:iWeaponID = get_member(pActiveItem, m_iId)
if (is_nullent(pActiveItem))
return HC_CONTINUE
if (rg_get_user_ammo(id, iWeaponID) >= iClipSize)
return HC_CONTINUE
set_task(fDelay, "Update_Player_BpAmmo", id)
}
return HC_CONTINUE
}
public Update_Player_BpAmmo(id)
{
if (g_pCvars[INFINITE_BPAMMO] && has_user_access(id))
{
new pActiveItem = get_member(id, m_pActiveItem)
new WeaponIdType:iWeaponID = get_member(pActiveItem, m_iId)
if (is_nullent(pActiveItem))
return
rg_set_user_bpammo(id, iWeaponID, rg_get_weapon_info(iWeaponID, WI_MAX_ROUNDS))
}
}
stock math_calculate(iNum, const szPercent[]) {
static szNewMath[16], bool:bPercent, cOperator, iMath, iCalculate
copy(szNewMath, charsmax(szNewMath), szPercent)
bPercent = szNewMath[strlen(szNewMath) - 1] == '%'
cOperator = szNewMath[0]
if (!isdigit(szNewMath[0]))
szNewMath[0] = ' '
if (bPercent)
replace(szNewMath, charsmax(szNewMath), "%", "")
trim(szNewMath)
iMath = str_to_num(szNewMath)
if (bPercent)
iCalculate = (iNum * iMath) / 100
switch(cOperator)
{
case '+': iNum += bPercent ? iCalculate : iMath
case '-': iNum -= bPercent ? iCalculate : iMath
case '/': iNum /= bPercent ? iCalculate : iMath
case '*': iNum *= bPercent ? iCalculate : iMath
default: iNum = bPercent ? iCalculate : iMath
}
return iNum
}
bool:has_user_access(id)
{
if (get_user_flags(id) & read_flags(g_pCvars[VIP_EXTRAS_ACCESS]))
return true
else
return false
}