|
本人魔兽服务器在测试过程中发现当自己死后的主视角会莫名其妙的转到天上(如图1),而这时候如果有队友复活自己或买重生是就会出现严重的BUG(如图2),导致自己会卡在出生点,所看到的也只是自己死后视角转到天上的画面。除非用守望者的大绝技能“瞬间在回到出生地”,或是等下局开始才能恢复行动和视线。经查,是由于deathbones.amxx(死后变骷髅)插件引起,小弟新手,这个源码不会修改,还请哪位大侠帮忙给修改下,把这个自己死后主视角转到天上的BUG给去掉或修复了,不胜感激!!!
源码如下:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#define PLUGIN "DeathBones"
#define VERSION "1.1.0"
#define AUTHOR "mogel"
#define BONE_ALPHA_TASK_BASIS 1000
new pcv_deathmatch // Deathmatch-Support
new pcv_bonestime // anzeigen der Bones
#define ALPHA EV_INT_iuser4
#define PLAYER EV_INT_iuser3
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("DeathMsg"), "Event_Death")
register_event("HLTV", "Event_FreezeTime", "a", "1=0", "2=0")
register_cvar("DeathBones", VERSION, FCVAR_SERVER | FCVAR_SPONLY | FCVAR_UNLOGGED)
pcv_deathmatch = register_cvar("db_deathmatch", "0") // per default kein DM-Support
pcv_bonestime = register_cvar("db_bonestime", "30.0") // 30 Sekunden
}
public plugin_precache() {
precache_model("models/skeleton.mdl")
}
public Event_FreezeTime() {
new players[32], count
get_players(players, count, "h")
for(new i = 0; i < count; i++)
{
new player = players[i]
// Render zur點k setzen
set_pev(player, pev_renderfx, kRenderFxNone)
set_pev(player, pev_rendercolor, 255,255,255)
set_pev(player, pev_rendermode, kRenderNormal)
set_pev(player, pev_renderamt, 0.0)
}
remove_entity_name("deathbones")
}
public Event_Death() {
new player = get_msg_arg_int(2)
new Float:bones[3]
new Float:angle[3]
entity_get_vector(player, EV_VEC_origin, bones)
entity_get_vector(player, EV_VEC_angles, angle)
bones[2] -= 32.0 // gleich nach unten setzen
// Bones erstellen
new entity = create_entity("info_target")
entity_set_string(entity, EV_SZ_classname, "deathbones")
entity_set_model(entity, "models/skeleton.mdl")
entity_set_origin(entity, bones)
entity_set_vector(entity, EV_VEC_angles, angle)
entity_set_int(entity, EV_INT_movetype, MOVETYPE_TOSS)
entity_set_int(entity, EV_INT_solid, SOLID_NOT)
// Bones erstmal unsichtbar
set_pev(entity, pev_renderfx, kRenderFxNone)
set_pev(entity, pev_rendercolor, 255,255,255)
set_pev(entity, pev_rendermode, kRenderTransAlpha)
set_pev(entity, pev_renderamt, 0.0)
// Spieler durch Bones wechseln
entity_set_int(entity, PLAYER, player) // den Bones dem Spieler zuweisen
entity_set_int(entity, ALPHA, 0) // aktuelles Alpha f黵 die Bones
set_task(1.0, "BonesAlphaIn", entity)
}
public BonesAlphaIn(bones) {
if (!is_valid_ent(bones)) return
new alpha = entity_get_int(bones, ALPHA) + 1
new player = entity_get_int(bones, PLAYER)
// Spieler ausblenden, aber nur wenn kein DM-Modus
if ((is_valid_ent(player)) && !get_pcvar_num(pcv_deathmatch))
{
set_pev(player, pev_renderfx, kRenderFxNone)
set_pev(player, pev_rendercolor, 255,255,255)
set_pev(player, pev_rendermode, kRenderTransAlpha)
set_pev(player, pev_renderamt, float(256 - alpha * 16))
}
if (is_valid_ent(bones))
{
set_pev(bones, pev_renderfx, kRenderFxNone)
set_pev(bones, pev_rendercolor, 255,255,255)
set_pev(bones, pev_rendermode, kRenderTransAlpha)
set_pev(bones, pev_renderamt, float(alpha * 16 - 1))
}
// neuen Alpha-Wert merken
entity_set_int(bones, ALPHA, alpha)
// jetzt entscheiden .. .weiter Alpha oder liegen lassen
if (alpha >= 16)
{
// wenn kein DM dann Spieler jetzt nach unten setzen
if (!get_pcvar_num(pcv_deathmatch))
{
// Bones werden am Rundenanfng automatisch gel鰏cht
PlayerMove(player)
} else
{
// im DM-Modus nach X Sekunden wieder ausblenden
set_task(get_pcvar_float(pcv_bonestime), "BonesAlphaOut", bones)
}
} else
{
set_task(0.1, "BonesAlphaIn", bones)
}
}
public BonesAlphaOut(bones) {
if (!is_valid_ent(bones)) return
new alpha = entity_get_int(bones, ALPHA) - 1
if (is_valid_ent(bones))
{
set_pev(bones, pev_renderfx, kRenderFxNone)
set_pev(bones, pev_rendercolor, 255,255,255)
set_pev(bones, pev_rendermode, kRenderTransAlpha)
set_pev(bones, pev_renderamt, float(alpha * 16 - 1))
}
// neuen Alpha-Wert merken
entity_set_int(bones, ALPHA, alpha)
// jetzt entscheiden .. .weiter Alpha oder killen
if (alpha)
{
set_task(0.1, "BonesAlphaOut", bones)
} else
{
remove_entity(bones)
}
}
public PlayerMove(player) {
new Float:pos[3]
entity_get_vector(player, EV_VEC_origin, pos)
pos[2] -= 2000.0
entity_set_vector(player, EV_VEC_origin, pos)
} |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|