Он закрывает проходы на больших карьах при низком онлаине.
И второй плагин.
/Rs./Me./Hp.
Для REHLDS
Cпасибо всем заранее.
И второй плагин.
/Rs./Me./Hp.
Для REHLDS
Cпасибо всем заранее.
Вложения
-
7.7 MB Просмотры: 43
/*
Доступные команды: /rs, /me, /hp
*/
#include <amxmodx>
#include <reapi>
enum GetSayFunctions {SayRs, SayMe, SayHp}
new const g_szHit[][] = {"", "голову", "грудь", "живот", "левую руку", "правую руку", "левую ногу", "правую ногу"}
enum _:SayData {Float:Damage, LastHit, Float:HpKiller, Float:ApKiller, Float:Distance, KillerId, KillerName[MAX_NAME_LENGTH], WeaponName[MAX_NAME_LENGTH]}
new g_arrData[MAX_PLAYERS +1][SayData], CVAR_ME_TYPE, CVAR_MEHP_EVENT, CVAR_RESET_SCORE
public plugin_init()
{
register_clcmd("say", "Say_Catch")
register_clcmd("say_team", "Say_Catch")
bind_pcvar_num(create_cvar(
.name = "me_type",
.string = "1",
.flags = FCVAR_SERVER,
.description = "Access to the /me command.^n0 - For killed players, 1 - For all players."),
CVAR_ME_TYPE
)
bind_pcvar_num(create_cvar(
.name = "mehp_death_event",
.string = "3",
.flags = FCVAR_SERVER,
.description = "Prints /me, /hp after death.^n0 - Off, 1 - Only /me, 2 - Only /hp, 3 - /me and /hp."),
CVAR_MEHP_EVENT
)
bind_pcvar_num(create_cvar(
.name = "auto_reset_score",
.string = "1",
.flags = FCVAR_SERVER,
.description = "Autoreset score.^n1 - On, 0 - Off."),
CVAR_RESET_SCORE
)
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn", true)
RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage", true)
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayer_Killed", true)
AutoExecConfig(true, "rs_me_hp")
}
public Say_Catch(id)
{
new szMessage[MAX_RESOURCE_PATH_LENGTH]
read_args(szMessage, charsmax(szMessage))
remove_quotes(szMessage)
if (szMessage[0] != '/')
return PLUGIN_CONTINUE
else
{
if (strcmp(szMessage, "/rs") == 0)
return Say(id, SayRs)
if (strcmp(szMessage, "/me") == 0)
return Say(id, SayMe)
if (strcmp(szMessage, "/hp") == 0)
return Say(id, SayHp)
}
return PLUGIN_CONTINUE
}
public client_putinserver(id)
arrayset(g_arrData[id], 0, SayData)
public client_disconnected(id)
arrayset(g_arrData[id], 0, SayData)
public CBasePlayer_Spawn(id)
arrayset(g_arrData[id], 0, SayData)
public CBasePlayer_TakeDamage(const victim, inflictor, const attacker, Float:damage)
{
if (is_user_connected(attacker) && attacker != victim)
{
if (rg_is_player_can_takedamage(victim, attacker))
{
g_arrData[attacker][Damage] += damage
g_arrData[attacker][LastHit] = get_member(victim, m_LastHitGroup)
}
}
}
public CBasePlayer_Killed(const victim, const killer, iGib)
{
if (!is_user_connected(killer)|| killer == victim || get_member(victim, m_bKilledByBomb))
return HC_CONTINUE
g_arrData[victim][KillerId] = killer
g_arrData[victim][HpKiller] = get_entvar(killer, var_health)
g_arrData[victim][ApKiller] = get_entvar(killer, var_armorvalue)
g_arrData[victim][Distance] = rg_entity_range(killer, victim) * 0.0254
get_entvar(killer, var_netname, g_arrData[victim][KillerName], charsmax(g_arrData[][KillerName]))
static pevInflictor, ActiveItem
pevInflictor = get_entvar(victim, var_dmg_inflictor)
if (killer == pevInflictor)
{
ActiveItem = get_member(killer, m_pActiveItem)
if (is_nullent(ActiveItem)) return HC_CONTINUE
get_entvar(ActiveItem, var_classname, g_arrData[victim][WeaponName], charsmax(g_arrData[][WeaponName]))
replace(g_arrData[victim][WeaponName], charsmax(g_arrData[][WeaponName]), "weapon_", "")
replace(g_arrData[victim][WeaponName], charsmax(g_arrData[][WeaponName]), "mp5navy", "mp5")
}
switch(CVAR_MEHP_EVENT)
{
case 0: return HC_CONTINUE
case 1: Say(victim, SayMe)
case 2: Say(victim, SayHp)
case 3:
{
Say(victim, SayMe)
Say(victim, SayHp)
}
}
if (CVAR_RESET_SCORE)
{
if (Float:get_entvar(victim, var_frags) == 0.0 && get_member(victim, m_iDeaths) > 0)
{
rg_set_user_score(victim)
client_print_color(victim, print_team_default, "^4* ^1Ваш счёт ^3обнулён ^1автоматически!")
}
}
return HC_CONTINUE
}
Say(id, GetSayFunctions:type)
{
if (!is_user_connected(id))
return PLUGIN_HANDLED
switch(type)
{
case SayRs:
{
if (Float:get_entvar(id, var_frags) != 0.0 || get_member(id, m_iDeaths) != 0)
{
rg_set_user_score(id)
client_print_color(id, print_team_default, "^4* ^1Ваш счёт ^3успешно ^1обнулён!")
}
else client_print_color(id, print_team_default, "^4* ^1Ваш счёт и так ^3равен ^1нулю!")
}
case SayMe:
{
if (is_user_alive(id) && !CVAR_ME_TYPE)
client_print_color(id, print_team_default, "^4* ^1Команда доступна только ^3мёртвым ^1игрокам!")
else
{
if (!g_arrData[id][Damage]) client_print_color(id, print_team_default, "^4* ^1Вы ни в кого ^3не ^1попали!")
else if (g_arrData[id][LastHit] == 0) client_print_color(id, print_team_default, "^4* ^1Вы нанесли ^3%.0f ^4урона^1.", g_arrData[id][Damage])
else client_print_color(id, print_team_default, "^4* ^1Вы нанесли ^3%.0f ^4урона^1, Последнее попадание ^3в ^4%s^1.", g_arrData[id][Damage], g_szHit[g_arrData[id][LastHit]])
}
}
case SayHp:
{
if (!g_arrData[id][KillerId]) client_print_color(id, print_team_default, "^4* ^1Вас ^3никто ^1не убивал!")
else client_print_color(id, g_arrData[id][KillerId], "^4* ^1Вас убил ^3%s ^1из ^4%s ^1c ^3%.0f^4М^1, У него осталось ^3%.0f^4HP^1/^3%.0f^4AP", g_arrData[id][KillerName], g_arrData[id][WeaponName], g_arrData[id][Distance], g_arrData[id][HpKiller], g_arrData[id][ApKiller])
}
}
return PLUGIN_HANDLED
}
stock Float:rg_entity_range(ent1, ent2)
{
new Float:origin[2][3]
get_entvar(ent1, var_origin, origin[0])
get_entvar(ent2, var_origin, origin[1])
return get_distance_f(origin[0], origin[1])
}
stock rg_set_user_score(const client, const frags = 0, const deaths = 0)
{
const mScoreInfo = 85
set_member(client, m_iDeaths, deaths)
set_entvar(client, var_frags, float(frags))
emessage_begin(MSG_BROADCAST, mScoreInfo)
ewrite_byte(client)
ewrite_short(frags)
ewrite_short(deaths)
ewrite_short(0)
ewrite_short(0)
emessage_end()
}