День добрый, помогите найти плагин дамаг информер как на скриншоте
Вложения
-
221.4 KB Просмотры: 178
/**
История изменений:
0.1 (03.06.2022) by b0t.
- Первый релиз;
0.2 (03.09.2022) by b0t.
- Fix отображения спрайта при стрельбе по своим;
*/
new const VERSION[] = "0.1";
#include <amxmodx>
#include <fakemeta>
#include <reapi>
new const g_szSprite_256[] = "sprites/Damage_256.spr";
new const g_szSprite_512[] = "sprites/Damage_512.spr";
enum _:CVARS_DATA {
Float:CVAR__SPRITE_LIFE,
Float:CVAR__SPRITE_SCALE,
Float:CVAR__SPRITE_SPEED
};
new
gCvars[CVARS_DATA];
public plugin_precache() {
precache_model(g_szSprite_256);
precache_model(g_szSprite_512);
Func__CreateCvars();
}
public plugin_init() {
register_plugin("Show Damage",VERSION,"b0t.");
RegisterHookChain(RG_CBasePlayer_TakeDamage,"CBasePlayer_TakeDamage_Post", .post = true);
}
public CBasePlayer_TakeDamage_Post(const pVictim,const iInflictor,const pAttacker,const Float:fDamage) {
if(!is_user_connected(pVictim) || !is_user_connected(pAttacker))
return HC_CONTINUE;
if(!rg_is_player_can_takedamage(pVictim,pAttacker))
return HC_CONTINUE;
if(fDamage > 512.0)
return HC_CONTINUE;
if(fDamage <= 255.0)
UTIL__CreateSprite(pAttacker,pVictim,fDamage,g_szSprite_256);
else
UTIL__CreateSprite(pAttacker,pVictim,fDamage-256.0,g_szSprite_512);
return HC_CONTINUE;
}
public UTIL__CreateSprite(const pAttacker,const pVictim,const Float:fFrame,const szSprite[]) {
new iEnt = rg_create_entity("info_target");
if(is_nullent(iEnt))
return;
new Float:fOrigin[3];
get_entvar(pVictim,var_origin,fOrigin);
engfunc(EngFunc_SetModel,iEnt,szSprite);
engfunc(EngFunc_SetOrigin,iEnt,fOrigin);
engfunc(EngFunc_SetSize,iEnt,Float:{-1.0,-1.0,-1.0},Float:{1.0,1.0,1.0});
set_entvar(iEnt,var_solid,SOLID_TRIGGER);
set_entvar(iEnt,var_movetype,MOVETYPE_NOCLIP);
set_entvar(iEnt,var_owner,pAttacker);
set_entvar(iEnt,var_effects,EF_OWNER_VISIBILITY);
new Float:fVelocity[3];
fVelocity[2] = gCvars[CVAR__SPRITE_SPEED];
set_entvar(iEnt,var_velocity,fVelocity);
set_entvar(iEnt,var_renderfx,kRenderFxNone);
set_entvar(iEnt,var_rendercolor,Float:{0.0,0.0,0.0});
set_entvar(iEnt,var_rendermode,kRenderNormal/* kRenderTransAdd */);
set_entvar(iEnt,var_renderamt,255.0);
set_entvar(iEnt,var_scale,gCvars[CVAR__SPRITE_SCALE]);
set_entvar(iEnt,var_frame,fFrame);
set_entvar(iEnt,var_nextthink,get_gametime()+gCvars[CVAR__SPRITE_LIFE]);
SetThink(iEnt,"CBaseEntity_Think");
}
public CBaseEntity_Think(const iEnt) {
SetThink(iEnt,"");
if(is_nullent(iEnt))
return;
set_entvar(iEnt,var_flags,FL_KILLME);
}
public Func__CreateCvars() {
bind_pcvar_float(
create_cvar(
.name = "sd_sprite_life",
.string = "1.5",
.description = "Время жизни спрайта"
),
gCvars[CVAR__SPRITE_LIFE]
);
bind_pcvar_float(
create_cvar(
.name = "sd_sprite_scale",
.string = "0.5",
.description = "Размер спрайта"
),
gCvars[CVAR__SPRITE_SCALE]
);
bind_pcvar_float(
create_cvar(
.name = "sd_sprite_speed",
.string = "70.0",
.description = "Скорость полёта спрайта"
),
gCvars[CVAR__SPRITE_SPEED]
);
AutoExecConfig(.name = "ShowDamage");
}