Всем доброго дня, прошу подскажите пожалуйста что нужно добавить/изменить, что бы при полном здоровье (100hp) сообщения о добавлении hp не выводилось!?
Код:
#include <amxmodx>
#include <reapi>
#pragma semicolon 1
new const szPluginInfo[][] = {"Custom Vampire", "2.0.1", "ApXuTekToR"};
native cmsapi_check_service_password(iClient, szServiceName[]);
native uk_firstround_get();
native warmup_enable();
enum e_cvars {
c_vampire_Flag[16], c_vampire_Service[16], c_vampire_Kill,
c_vampire_Head, c_vampire_Knife, c_vampire_Max,
c_vampireInfo_Color[16], c_vampireInfo_Effects,
c_vampireInfo_Position[16], c_screenFade_Active,
c_screenFade_Color[16], c_vampire_Grenade, c_Support_Warmup[8]
}
new cvars[e_cvars], hudVampire;
enum e_rgbColors { rgb_red, rgb_green, rgb_blue }
enum e_Position { Float:position_x, Float:position_y }
new g_isAPI;
new ult_knife, warmup, uk[2], wp[2];
public plugin_natives()
set_native_filter("native_filter");
public native_filter(const name[], index, trap)
return trap ? PLUGIN_CONTINUE : PLUGIN_HANDLED;
public plugin_init() {
register_plugin(szPluginInfo[0], szPluginInfo[1], szPluginInfo[2]);
RegisterHookChain(RG_CBasePlayer_Killed, "vampire", true);
register_srvcmd("Vampire_lockmap", "Check_LockMap");
register_cvar("Vampire_Vampire_Flag", "s" );
register_cvar("Vampire_vampire_Service", "_vampire" );
register_cvar("Vampire_HP_Kill", "5" );
register_cvar("Vampire_HP_Head", "10" );
register_cvar("Vampire_HP_Knife", "15" );
register_cvar("Vampire_HP_Grenade", "15" );
register_cvar("Vampire_HP_Max", "100" );
register_cvar("VampireInfo_Color", "0 255 0" );
register_cvar("VampireInfo_Position", "-1.0 0.13" );
register_cvar("vampireInfo_Effects", "0" );
register_cvar("Vampire_ScreenFade_Active", "1" );
register_cvar("Vampire_ScreenFade_Color", "0 255 0" );
register_cvar("Vampire_Support_Warmup", "0 0" );
parse(cvars[c_Support_Warmup], uk, charsmax(uk), wp, charsmax(wp));
ult_knife = str_to_num(uk);
warmup = str_to_num(wp);
hudVampire = CreateHudSyncObj(3);
}
public plugin_cfg() {
if(is_plugin_loaded("GameCMS_API") != INVALID_PLUGIN_ID)
g_isAPI = 1;
else g_isAPI = 0;
new cfgFilePath[PLATFORM_MAX_PATH];
new const fileName[64] = "/SevCorp/Custom_Vampire.cfg";
get_localinfo("amxx_configsdir", cfgFilePath, charsmax(cfgFilePath));
add(cfgFilePath, charsmax(cfgFilePath), fileName);
if(file_exists(cfgFilePath)) {
server_cmd("exec %s", cfgFilePath);
server_exec();
initCvars();
} else {
server_print("[%s v%s] [Error] [Config file not found (%s)] [Plugin stopped]", szPluginInfo[0], szPluginInfo[1], cfgFilePath);
set_fail_state("[Config file not found (%s)]", cfgFilePath);
}
}
public vampire(victim, killer, gib) {
if(killer == victim || !is_user_connected(killer) || !is_user_connected(victim)) return;
if(ult_knife) if(uk_firstround_get()) return;
if(warmup) if(warmup_enable()) return;
if(is_user_access(killer)) {
static colors[e_rgbColors]; getColors(cvars[c_vampireInfo_Color], colors);
static position[e_Position]; getPosition(cvars[c_vampireInfo_Position], position);
set_hudmessage(colors[rgb_red], colors[rgb_green], colors[rgb_blue], position[position_x], position[position_y], cvars[c_vampireInfo_Effects], 1.0, 1.3, 0.0, 0.0);
if(get_member(victim, m_bKilledByGrenade)) {
_rg_add_user_health(killer, cvars[c_vampire_Knife], cvars[c_vampire_Max]);
ShowSyncHudMsg(killer, hudVampire, "+%dHP", cvars[c_vampire_Grenade]);
}
else if(get_user_weapon(killer) == CSW_KNIFE) {
_rg_add_user_health(killer, cvars[c_vampire_Knife], cvars[c_vampire_Max]);
ShowSyncHudMsg(killer, hudVampire, "+%dHP", cvars[c_vampire_Knife]);
}
else if(get_member(victim, m_bHeadshotKilled)) {
_rg_add_user_health(killer, cvars[c_vampire_Head], cvars[c_vampire_Max]);
ShowSyncHudMsg(killer, hudVampire, "+%dHP", cvars[c_vampire_Head]);
}
else{
_rg_add_user_health(killer, cvars[c_vampire_Kill], cvars[c_vampire_Max]);
ShowSyncHudMsg(killer, hudVampire, "+%dHP", cvars[c_vampire_Kill]);
}
if(cvars[c_screenFade_Active]) {
static colors[e_rgbColors]; getColors(cvars[c_screenFade_Color], colors);
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), {0, 0, 0}, killer);
write_short(1<<10);
write_short(1<<10);
write_short(0x0000);
write_byte(colors[rgb_red]);
write_byte(colors[rgb_green]);
write_byte(colors[rgb_blue]);
write_byte(50);
message_end();
}
}
}
bool:is_user_access(const ID) {
switch(g_isAPI) {
case 0: {
if(checkAccess(ID, cvars[c_vampire_Flag])) return true;
}
case 1: {
new Service = cmsapi_check_service_password(ID, cvars[c_vampire_Service]);
if(checkAccess(ID, cvars[c_vampire_Flag]) || Service)
return true;
}
}
return false;
}
Float:_rg_add_user_health(id, hp, _max = 9999) {
static Float:health; health = get_entvar(id, var_health, health);
health = floatmin(float(_max), health+hp);
set_entvar(id, var_health, health);
return health;
}
getColors(const str[], output[e_rgbColors]) {
static colors[3][11];
if(parse(str, colors[0], 10, colors[1], 10, colors[2], 10) != 3){
log_error(AMX_ERR_PARAMS, "Invalid colors string '%s'", str);
return;
}
output[rgb_red] = str_to_num(colors[0]);
output[rgb_green] = str_to_num(colors[1]);
output[rgb_blue] = str_to_num(colors[2]);
}
getPosition(const str[], output[e_Position]){
static position[2][11];
if(parse(str, position[0], 10, position[1], 10) != 2){
log_error(AMX_ERR_PARAMS, "Invalid colors string '%s'", str);
return;
}
output[position_x] = str_to_float(position[0]);
output[position_y] = str_to_float(position[1]);
}
initCvars() {
get_cvar_string("Vampire_vampire_Service", cvars[c_vampire_Service], charsmax(cvars[c_vampire_Service]));
get_cvar_string("Vampire_Vampire_Flag", cvars[c_vampire_Flag], charsmax(cvars[c_vampire_Flag]));
get_cvar_string("VampireInfo_Color", cvars[c_vampireInfo_Color], charsmax(cvars[c_vampireInfo_Color]));
get_cvar_string("VampireInfo_Position", cvars[c_vampireInfo_Position], charsmax(cvars[c_vampireInfo_Position]));
get_cvar_string("Vampire_ScreenFade_Color", cvars[c_screenFade_Color], charsmax(cvars[c_screenFade_Color]));
get_cvar_string("Vampire_Support_Warmup", cvars[c_Support_Warmup], charsmax(cvars[c_Support_Warmup]));
cvars[c_vampire_Kill] = get_cvar_num("Vampire_HP_Kill");
cvars[c_vampire_Head] = get_cvar_num("Vampire_HP_Head");
cvars[c_vampire_Knife] = get_cvar_num("Vampire_HP_Knife");
cvars[c_vampire_Max] = get_cvar_num("Vampire_HP_Max");
cvars[c_vampireInfo_Effects] = get_cvar_num("vampireInfo_Effects");
cvars[c_screenFade_Active] = get_cvar_num("Vampire_ScreenFade_Active");
cvars[c_vampire_Grenade] = get_cvar_num("Vampire_HP_Grenade");
}
/* ============= Блокировка карт =========================== */
public Check_LockMap() {
new getmap[32], map[32];
read_args(getmap, charsmax(getmap));
remove_quotes(getmap);
get_mapname(map, charsmax(map));
if(!strcmp(getmap, map, true)) {
pause("ad");
}
}
checkAccess(id, const flags[]) {
return (get_user_flags(id) & read_flags(flags));
}
Вложения
-
7 KB Просмотры: 2