Иконка ресурса

CS:GO Death Camera 1.0

Нет прав для скачивания
Сообщения
256
Реакции
12
Anyway its possible to freeze death camera till player respawns?
 
Сообщения
1,701
Реакции
1,512
Помог
26 раз(а)
Код:
    new ent = create_entity("info_target")
    if(!is_valid_ent(ent))
    {
        client_print(id, print_chat, "Error create entity")
        return
    }
Только что созданная ентити может быть невалидной?
Да, если уперся в лимит. Зная как вы пишите плагины, вероятность 16/32.
 
Сообщения
39
Реакции
14
Как уменьшить время "заморозки"/просмотра?
 
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
сори за поднятие, но, не хватает еще показывание как тот кто вас убивал, убил))
 
Сообщения
3,056
Реакции
1,739
Помог
80 раз(а)
Artemich, в правом верхнем углу экрана всегда пишется, кто тебя убил. зачем дублировать информацию?
 
Сообщения
552
Реакции
49
Предупреждения
2
Помог
4 раз(а)
@Алексеич,Нет, я непро то, я про то, что-бы от лица убившего показывало как он вас убил.
 
Сообщения
3,056
Реакции
1,739
Помог
80 раз(а)
Artemich, у Garey есть мета-модуль такой, но он нестабилен. Там очень сложная реализация, которая, как я понял врятли когда доделается.
 
Сообщения
3,056
Реакции
1,739
Помог
80 раз(а)
Artemich, её нет и не будет, пока гари не сделает стабильный релиз.
 
Сообщения
61
Реакции
-5
Как увеличить время "заморозки"/просмотра?
 
Сообщения
282
Реакции
34
Помог
3 раз(а)
Добавил показ урона и хитов, т.е. как в CS:GO.

Код:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <reapi>

#define PLUGIN  "CSGO DEATH CAM"
#define VERSION "1.0"
#define AUTHOR  "Sugisaki"

#define CLASS     "ent_camara"

#define CAMERA_MODEL     "models/arcticorangeT.mdl"
#define CAMERA_MINS Float: { -10.0, -10.0, 0.0 }
#define CAMERA_MAXS Float: { 10.0, 10.0, 25.0 }

new killer[33]
new las_obs[33]
new play[33]

new Float:g_freeze_origin[33][33][3]
new g_freeze_sequence[33][33]
new g_freeze_frame[33][33]
new g_freeze_framerate[33][33]
new Float:g_freeze_angles[33][33][3]
new g_freeze_gaitsequence[33][33]
new g_freeze_weaponmodel[33][33]

new bool:g_bfreeze[33]

new Float:g_DamageStats[33][33]
new g_TraceStats[33][33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /dcam", "pfn_cam")
    register_think(CLASS, "pfn_camera_think")
    register_event("DeathMsg", "pfn_death", "a")
    register_forward(FM_AddToFullPack, "AddToFullPack", 1)
    register_event("TextMsg", "pfn_unfreeze", "b", "2&#Spec_Mode")
    RegisterHam(Ham_Spawn, "player", "OnSpawnPlayer", 1)
    register_touch("player", CLASS, "OnTouchCamera")
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "CBasePlayer_TakeDamage", true)
    RegisterHookChain(RG_CBasePlayer_TraceAttack, "CBasePlayer_TraceAttack", false)
}

public CBasePlayer_TraceAttack(victim, attacker, Float:flDamage, Float:vecDir[3], tracehandle, bitsDamageType)
{
    g_TraceStats[attacker][victim]++
}

public CBasePlayer_TakeDamage(victim, inflictor, attacker, Float:damage)
{
    g_DamageStats[attacker][victim] += damage
}

public plugin_precache()
{
    precache_model(CAMERA_MODEL)
}
pfn_SpawnCamera(id, target)
{
    if(!is_user_connected(target))
        return

    freeze_map(id)
    new ent = create_entity("info_target")
    if(!is_valid_ent(ent))
    {
        client_print(id, print_chat, "Error create entity")
        return
    }
    new Float:origin[3], Float:angles[3], Float:o2[3]
    entity_get_vector(target, EV_VEC_origin, o2)
    entity_get_vector(id, EV_VEC_origin, origin)
    //entity_get_vector(id, EV_VEC_v_angle, angles)
    //angles[0] = angles[0] * -1.0
    entity_set_model(ent, CAMERA_MODEL)
    entity_set_int(ent, EV_INT_movetype, MOVETYPE_NOCLIP)
    entity_set_string(ent, EV_SZ_classname, CLASS)
    entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
    entity_set_vector(ent, EV_VEC_origin, origin)
    entity_set_vector(ent, EV_VEC_angles, angles)
    entity_set_edict(ent, EV_ENT_owner, id)
 
 
    //set aim
    entity_set_aim(ent, o2)
    // set speed
    set_speed(ent, calculate_speed(id, target), o2)
    //
    attach_view(id, ent);
    entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.001)
    set_task(1.5, "pfn_remove_ent", id)

    //PERF1337
    new target_name[MAX_PLAYERS]
    get_user_name(target, target_name, charsmax(target_name))
    set_dhudmessage(.red = 0, .green = 255, .blue = 0, .x = -1.0, .y = -1.0, .effects = 0,
    .fxtime = 1.5, .holdtime = 1.5, .fadeintime = 0.1, .fadeouttime = 0.2)
    show_dhudmessage(id, "%s^nDamage taken: %.0f in %d hits^nDamage given: %.0f in %d hits", target_name, g_DamageStats[target][id], g_TraceStats[target][id], g_DamageStats[id][target], g_TraceStats[id][target])
    client_print(id, print_console, "%s | Damage taken: %.0f in %d hits | Damage given: %.0f in %d hits", target_name, g_DamageStats[target][id], g_TraceStats[target][id], g_DamageStats[id][target], g_TraceStats[id][target])
    //
}
public pfn_remove_ent(id)
{
    remove_task(id)
    new ent = find_ent_by_owner(-1, CLASS, id)
    if(is_valid_ent(ent))
    {
        remove_entity(ent)
    }
    arrayset(g_DamageStats[id], 0, sizeof(g_DamageStats[]))
    arrayset(g_TraceStats[id], 0, sizeof(g_TraceStats[]))
}
public pfn_camera_think(e)
{
    if(!is_valid_ent(e))
    {
        return;
    }

    if(get_entity_distance(e, killer[entity_get_edict(e, EV_ENT_owner)]) < 100)
    {
        entity_set_vector(e, EV_VEC_velocity, Float:{0.0,0.0,0.0})
    }
    entity_set_float(e, EV_FL_nextthink, halflife_time() + 0.001)
}
public pfn_test(id)
{
    new players[32], count
    get_players(players, count, "ae", "TERRORIST")
    new t = players[random(count)];
    ExecuteHam(Ham_TakeDamage, id, t, t, 101.0, DMG_BULLET);
}
public pfn_cam(id)
{
    play[id] = !play[id]
    client_print(id, print_chat, "Death camera %sactivated", play[id] ? "":"de")
}
public pfn_death()
{
    new k = read_data(1)
    new v = read_data(2)
    if(!is_user_connected(k) || v == k)
    {
        return
    }
    if(!play[v]) return
    killer[v] = k
    set_task(0.1, "dead_post", v)
}
public dead_post(id)
{
    set_pev(id, pev_iuser1, OBS_NONE)
    las_obs[id] = pev(id, pev_iuser1);
    pfn_SpawnCamera(id, killer[id])
}

public AddToFullPack(es, e, ent, host, hostflags, player, pSet)
{
    if(!player)
    {
        return
    }
    if(g_bfreeze[host])
    {
        set_es(es, ES_Angles, g_freeze_angles[host][ent])
        set_es(es, ES_Origin, g_freeze_origin[host][ent])
        set_es(es, ES_Sequence, g_freeze_sequence[host][ent])
        set_es(es, ES_Frame, g_freeze_framerate[host][ent])
        set_es(es, ES_FrameRate, g_freeze_framerate[host][ent])
        set_es(es, ES_GaitSequence, g_freeze_gaitsequence[host][ent])
        set_es(es, ES_WeaponModel, g_freeze_weaponmodel[host][ent])
    }
}

freeze_map(id)
{
    static szWM[60]
    for(new i = 1; i <= get_maxplayers() ; i++)
    {
        if(!is_user_connected(i))
        {
            continue;
        }
        entity_get_vector(i, EV_VEC_origin, g_freeze_origin[id][i])
        g_freeze_sequence[id][i] = entity_get_int(i, EV_INT_sequence)
        g_freeze_frame[id][i] = entity_get_int(id, EV_FL_frame)
        g_freeze_framerate[id][i] = entity_get_int(id, EV_FL_framerate)
        entity_get_vector(i, EV_VEC_angles, g_freeze_angles[id][i])
        g_freeze_gaitsequence[id][i] = entity_get_int(i, EV_INT_gaitsequence)
        entity_get_string(i, EV_SZ_weaponmodel, szWM, charsmax(szWM))
        g_freeze_weaponmodel[id][i] = engfunc(EngFunc_ModelIndex, szWM);
    }
    g_bfreeze[id] = true
}
public pfn_unfreeze(id)
{
    g_bfreeze[id] = false
    attach_view(id, id)
}
public client_putinserver(id)
{
    g_bfreeze[id] = false
    play[id] = true
    arrayset(g_DamageStats[id], 0, sizeof(g_DamageStats[]))
    arrayset(g_TraceStats[id], 0, sizeof(g_TraceStats[]))
}
public OnSpawnPlayer(id)
{
    if(!is_user_alive(id))
    {
        return
    }
    pfn_unfreeze(id)
}
stock Float:calculate_speed(u1, u2)
{
    return (float(get_entity_distance(u1, u2)) / 0.3)

}
public OnTouchCamera(ted, ter)
{
    new id = pev(ter, pev_owner)
    if(ted == killer[id])
    {
        entity_set_vector(ter, EV_VEC_velocity, Float:{0.0,0.0,0.0})
    }
}










// CHR ENGINE
stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
    if(!pev_valid(ent))
        return 0;

    static Float:origin[3]
    origin[0] = origin2[0]
    origin[1] = origin2[1]
    origin[2] = origin2[2]

    static Float:ent_origin[3], Float:angles[3]

    if(bone)
        engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
    else
        pev(ent,pev_origin,ent_origin)

    origin[0] -= ent_origin[0]
    origin[1] -= ent_origin[1]
    origin[2] -= ent_origin[2]

    static Float:v_length
    v_length = vector_length(origin)

    static Float:aim_vector[3]
    aim_vector[0] = origin[0] / v_length
    aim_vector[1] = origin[1] / v_length
    aim_vector[2] = origin[2] / v_length

    static Float:new_angles[3]
    vector_to_angle(aim_vector,new_angles)

    new_angles[0] *= -1

    if(new_angles[1]>180.0) new_angles[1] -= 360
    if(new_angles[1]<-180.0) new_angles[1] += 360
    if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999

    set_pev(ent,pev_angles,new_angles)
    set_pev(ent,pev_fixangle,1)

    return 1;
}
set_speed(ent, Float:speed, Float:origin[3])
{
    static Float:origin1[3]
    pev(ent,pev_origin,origin1)

    static Float:new_velo[3]

    new_velo[0] = origin[0] - origin1[0]
    new_velo[1] = origin[1] - origin1[1]
    new_velo[2] = origin[2] - origin1[2]

    new Float:y
    y = new_velo[0]*new_velo[0] + new_velo[1]*new_velo[1] + new_velo[2]*new_velo[2]

    new Float:x
    if(y) x = floatsqroot(speed*speed / y)

    new_velo[0] *= x
    new_velo[1] *= x
    new_velo[2] *= x

    if(speed<0.0)
    {
        new_velo[0] *= -1
        new_velo[1] *= -1
        new_velo[2] *= -1
    }

    set_pev(ent,pev_velocity,new_velo)
}

Код:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <hamsandwich>

#define PLUGIN  "CSGO DEATH CAM"
#define VERSION "1.0"
#define AUTHOR  "Sugisaki"

#define CLASS     "ent_camara"

#define CAMERA_MODEL     "models/arcticorangeT.mdl"
#define CAMERA_MINS Float: { -10.0, -10.0, 0.0 }
#define CAMERA_MAXS Float: { 10.0, 10.0, 25.0 }

new killer[33]
new las_obs[33]
new play[33]

new Float:g_freeze_origin[33][33][3]
new g_freeze_sequence[33][33]
new g_freeze_frame[33][33]
new g_freeze_framerate[33][33]
new Float:g_freeze_angles[33][33][3]
new g_freeze_gaitsequence[33][33]
new g_freeze_weaponmodel[33][33]

new bool:g_bfreeze[33]

new Float:g_DamageStats[33][33]
new g_TraceStats[33][33]

public plugin_init()
{
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_clcmd("say /dcam", "pfn_cam")
    register_think(CLASS, "pfn_camera_think")
    register_event("DeathMsg", "pfn_death", "a")
    register_forward(FM_AddToFullPack, "AddToFullPack", 1)
    register_event("TextMsg", "pfn_unfreeze", "b", "2&#Spec_Mode")
    RegisterHam(Ham_Spawn, "player", "OnSpawnPlayer", 1)
    register_touch("player", CLASS, "OnTouchCamera")
    RegisterHam(Ham_TraceAttack, "player", "HamTraceAttack")
    RegisterHam(Ham_TakeDamage, "player", "HamTakeDamage")
}

public HamTraceAttack(victim, attacker, Float:damage, Float:dir[3], traceresult, dmgbits)
{
    g_TraceStats[attacker][victim]++
}

public HamTakeDamage(victim, inflictor, attacker, Float:damage)
{
    g_DamageStats[attacker][victim] += damage
}

public plugin_precache()
{
    precache_model(CAMERA_MODEL)
}
pfn_SpawnCamera(id, target)
{
    if(!is_user_connected(target))
        return

    freeze_map(id)
    new ent = create_entity("info_target")
    if(!is_valid_ent(ent))
    {
        client_print(id, print_chat, "Error create entity")
        return
    }
    new Float:origin[3], Float:angles[3], Float:o2[3]
    entity_get_vector(target, EV_VEC_origin, o2)
    entity_get_vector(id, EV_VEC_origin, origin)
    //entity_get_vector(id, EV_VEC_v_angle, angles)
    //angles[0] = angles[0] * -1.0
    entity_set_model(ent, CAMERA_MODEL)
    entity_set_int(ent, EV_INT_movetype, MOVETYPE_NOCLIP)
    entity_set_string(ent, EV_SZ_classname, CLASS)
    entity_set_int(ent, EV_INT_solid, SOLID_TRIGGER)
    entity_set_vector(ent, EV_VEC_origin, origin)
    entity_set_vector(ent, EV_VEC_angles, angles)
    entity_set_edict(ent, EV_ENT_owner, id)
 
 
    //set aim
    entity_set_aim(ent, o2)
    // set speed
    set_speed(ent, calculate_speed(id, target), o2)
    //
    attach_view(id, ent);
    entity_set_float(ent, EV_FL_nextthink, halflife_time() + 0.001)
    set_task(1.5, "pfn_remove_ent", id)

    //PERF1337
    new target_name[MAX_PLAYERS]
    get_user_name(target, target_name, charsmax(target_name))
    set_dhudmessage(.red = 0, .green = 255, .blue = 0, .x = -1.0, .y = -1.0, .effects = 0,
    .fxtime = 1.5, .holdtime = 1.5, .fadeintime = 0.1, .fadeouttime = 0.2)
    show_dhudmessage(id, "%s^nDamage taken: %.0f in %d hits^nDamage given: %.0f in %d hits", target_name, g_DamageStats[target][id], g_TraceStats[target][id], g_DamageStats[id][target], g_TraceStats[id][target])
    client_print(id, print_console, "%s | Damage taken: %.0f in %d hits | Damage given: %.0f in %d hits", target_name, g_DamageStats[target][id], g_TraceStats[target][id], g_DamageStats[id][target], g_TraceStats[id][target])
    //
}
public pfn_remove_ent(id)
{
    remove_task(id)
    new ent = find_ent_by_owner(-1, CLASS, id)
    if(is_valid_ent(ent))
    {
        remove_entity(ent)
    }
    arrayset(g_DamageStats[id], 0, sizeof(g_DamageStats[]))
    arrayset(g_TraceStats[id], 0, sizeof(g_TraceStats[]))
}
public pfn_camera_think(e)
{
    if(!is_valid_ent(e))
    {
        return;
    }

    if(get_entity_distance(e, killer[entity_get_edict(e, EV_ENT_owner)]) < 100)
    {
        entity_set_vector(e, EV_VEC_velocity, Float:{0.0,0.0,0.0})
    }
    entity_set_float(e, EV_FL_nextthink, halflife_time() + 0.001)
}
public pfn_test(id)
{
    new players[32], count
    get_players(players, count, "ae", "TERRORIST")
    new t = players[random(count)];
    ExecuteHam(Ham_TakeDamage, id, t, t, 101.0, DMG_BULLET);
}
public pfn_cam(id)
{
    play[id] = !play[id]
    client_print(id, print_chat, "Death camera %sactivated", play[id] ? "":"de")
}
public pfn_death()
{
    new k = read_data(1)
    new v = read_data(2)
    if(!is_user_connected(k) || v == k)
    {
        return
    }
    if(!play[v]) return
    killer[v] = k
    set_task(0.1, "dead_post", v)
}
public dead_post(id)
{
    set_pev(id, pev_iuser1, OBS_NONE)
    las_obs[id] = pev(id, pev_iuser1);
    pfn_SpawnCamera(id, killer[id])
}

public AddToFullPack(es, e, ent, host, hostflags, player, pSet)
{
    if(!player)
    {
        return
    }
    if(g_bfreeze[host])
    {
        set_es(es, ES_Angles, g_freeze_angles[host][ent])
        set_es(es, ES_Origin, g_freeze_origin[host][ent])
        set_es(es, ES_Sequence, g_freeze_sequence[host][ent])
        set_es(es, ES_Frame, g_freeze_framerate[host][ent])
        set_es(es, ES_FrameRate, g_freeze_framerate[host][ent])
        set_es(es, ES_GaitSequence, g_freeze_gaitsequence[host][ent])
        set_es(es, ES_WeaponModel, g_freeze_weaponmodel[host][ent])
    }
}

freeze_map(id)
{
    static szWM[60]
    for(new i = 1; i <= get_maxplayers() ; i++)
    {
        if(!is_user_connected(i))
        {
            continue;
        }
        entity_get_vector(i, EV_VEC_origin, g_freeze_origin[id][i])
        g_freeze_sequence[id][i] = entity_get_int(i, EV_INT_sequence)
        g_freeze_frame[id][i] = entity_get_int(id, EV_FL_frame)
        g_freeze_framerate[id][i] = entity_get_int(id, EV_FL_framerate)
        entity_get_vector(i, EV_VEC_angles, g_freeze_angles[id][i])
        g_freeze_gaitsequence[id][i] = entity_get_int(i, EV_INT_gaitsequence)
        entity_get_string(i, EV_SZ_weaponmodel, szWM, charsmax(szWM))
        g_freeze_weaponmodel[id][i] = engfunc(EngFunc_ModelIndex, szWM);
    }
    g_bfreeze[id] = true
}
public pfn_unfreeze(id)
{
    g_bfreeze[id] = false
    attach_view(id, id)
}
public client_putinserver(id)
{
    g_bfreeze[id] = false
    play[id] = true
    arrayset(g_DamageStats[id], 0, sizeof(g_DamageStats[]))
    arrayset(g_TraceStats[id], 0, sizeof(g_TraceStats[]))
}
public OnSpawnPlayer(id)
{
    if(!is_user_alive(id))
    {
        return
    }
    pfn_unfreeze(id)
}
stock Float:calculate_speed(u1, u2)
{
    return (float(get_entity_distance(u1, u2)) / 0.3)

}
public OnTouchCamera(ted, ter)
{
    new id = pev(ter, pev_owner)
    if(ted == killer[id])
    {
        entity_set_vector(ter, EV_VEC_velocity, Float:{0.0,0.0,0.0})
    }
}










// CHR ENGINE
stock entity_set_aim(ent,const Float:origin2[3],bone=0)
{
    if(!pev_valid(ent))
        return 0;

    static Float:origin[3]
    origin[0] = origin2[0]
    origin[1] = origin2[1]
    origin[2] = origin2[2]

    static Float:ent_origin[3], Float:angles[3]

    if(bone)
        engfunc(EngFunc_GetBonePosition,ent,bone,ent_origin,angles)
    else
        pev(ent,pev_origin,ent_origin)

    origin[0] -= ent_origin[0]
    origin[1] -= ent_origin[1]
    origin[2] -= ent_origin[2]

    static Float:v_length
    v_length = vector_length(origin)

    static Float:aim_vector[3]
    aim_vector[0] = origin[0] / v_length
    aim_vector[1] = origin[1] / v_length
    aim_vector[2] = origin[2] / v_length

    static Float:new_angles[3]
    vector_to_angle(aim_vector,new_angles)

    new_angles[0] *= -1

    if(new_angles[1]>180.0) new_angles[1] -= 360
    if(new_angles[1]<-180.0) new_angles[1] += 360
    if(new_angles[1]==180.0 || new_angles[1]==-180.0) new_angles[1]=-179.999999

    set_pev(ent,pev_angles,new_angles)
    set_pev(ent,pev_fixangle,1)

    return 1;
}
set_speed(ent, Float:speed, Float:origin[3])
{
    static Float:origin1[3]
    pev(ent,pev_origin,origin1)

    static Float:new_velo[3]

    new_velo[0] = origin[0] - origin1[0]
    new_velo[1] = origin[1] - origin1[1]
    new_velo[2] = origin[2] - origin1[2]

    new Float:y
    y = new_velo[0]*new_velo[0] + new_velo[1]*new_velo[1] + new_velo[2]*new_velo[2]

    new Float:x
    if(y) x = floatsqroot(speed*speed / y)

    new_velo[0] *= x
    new_velo[1] *= x
    new_velo[2] *= x

    if(speed<0.0)
    {
        new_velo[0] *= -1
        new_velo[1] *= -1
        new_velo[2] *= -1
    }

    set_pev(ent,pev_velocity,new_velo)
}

Sorry to bring this up, but this thing is awesome.
I've tested it (reapi version) and it was pretty good, but after 1st kill and 'zoom in', server got crashed with these errors:
Код:
#0  0xf5e3c8fb in Sys_Error(char const*, ...) () from /home/ogp_agent/OGP_User_Files/1/engine_i486.so
#1  0xf5d8b249 in Mod_Extradata () from /home/ogp_agent/OGP_User_Files/1/engine_i486.so
#2  0xf5db8ffd in GetModelPtr(edict_s*) () from /home/ogp_agent/OGP_User_Files/1/engine_i486.so
#3  0xec4a61e2 in StudioProcessGait(player_anim_params_s&) () from /home/ogp_agent/OGP_User_Files/1/cstrike/addons/hitbox_fix/hitbox_fix_mm_i386.so
#4  0xec4a4ee7 in ProcessAnimParams(int, int, player_anim_params_s&, player_anim_params_s&, entity_state_s*) () from /home/ogp_agent/OGP_User_Files/1/cstrike/addons/hitbox_fix/hitbox_fix_mm_i386.so
#5  0xec4a66de in AddToFullPackPost(entity_state_s*, int, edict_s*, edict_s*, int, int, unsigned char*) () from /home/ogp_agent/OGP_User_Files/1/cstrike/addons/hitbox_fix/hitbox_fix_mm_i386.so
Could you please check the code of plugin, since lot of things got updated since 2018? 🤞
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу