L 06/28/2011 - 10:16:03: [AMXX] Run time error 4: index out of bounds L 06/28/2011 - 10:16:03: [AMXX] [0] QTMCodMod.sma::fw_traceline (line 7244) L 06/28/2011 - 10:16:03: [AMXX] Displaying debug trace (plugin "QTMCodMod.amxx")
Funkcja wygląda tak:
public fw_traceline(Float:vecStart[3],Float:vecEnd[3],ignoreM,id,trace,this)
{
if(!is_user_connected(id))
return FMRES_IGNORED;
new hit = get_tr2(trace, TR_pHit);
new hitzone = get_tr2(trace, TR_iHitgroup);
if(player_b_antyhead[hit] == 1 && hitzone == HIT_HEAD)
set_tr2(trace, TR_iHitgroup, 8);
if(!(pev(id,pev_button) & IN_ATTACK))
return FMRES_IGNORED;
new h_bulet=0
if(golden_bulet[id]>0)
{
golden_bulet[id]--
h_bulet=1
}
if(is_valid_ent(hit))
{
new name[64]
entity_get_string(hit,EV_SZ_classname,name,63)
if(equal(name,"dbmod_shild"))
{
new Float: ori[3]
entity_get_vector(hit,EV_VEC_origin,ori)
set_tr2(trace,TR_vecEndPos,vecEnd)
if(after_bullet[id]>0)
{
new Float: health=entity_get_float(hit,EV_FL_health)
entity_set_float(hit,EV_FL_health,health-3.0)
if(health-1.0<0.0) remove_entity(hit)
after_bullet[id]--
}
set_tr2(trace,TR_iHitgroup,8);
set_tr2(trace,TR_flFraction,1.0);
return FMRES_SUPERCEDE;
}
}
if(is_user_alive(hit))
{
if(h_bulet)
{
set_tr2(trace, TR_iHitgroup, HIT_HEAD) // Redirect shot to head
// Variable angles doesn't really have a use here.
static hit, Float:head_origin[3], Float:angles[3]
hit = get_tr2(trace, TR_pHit) // Whomever was shot
engfunc(EngFunc_GetBonePosition, hit, 8, head_origin, angles) // Find origin of head bone (8)
set_tr2(trace, TR_vecEndPos, head_origin) // Blood now comes out of the head!
}
return FMRES_IGNORED;
}
return FMRES_IGNORED;
}Wpis do plugin_init:
register_forward(FM_TraceLine,"fw_traceline");
Dzięki za pomoc.


Dodatki SourceMod



Temat jest zamknięty








