Can anyone please help?
This code is from weaponmod.
When shooting player blood splatter on wall behind attacker not victim.
Code:
create_blood(Float:sourceOrigin[3], target, amount, distance, color=70)
{
// Get the origin of the target
new Float:targetOrigin[3]
pev(target, pev_origin, targetOrigin)
// Show some blood :)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BLOODSPRITE)
write_coord(floatround(targetOrigin[0]))
write_coord(floatround(targetOrigin[1]))
write_coord(floatround(targetOrigin[2]))
write_short(g_bloodspray)
write_short(g_blood)
write_byte(color)
write_byte(amount)
message_end()
// Calculate the direction of the blood
new Float:traceEnd[3]
traceEnd[0] = (sourceOrigin[0]-targetOrigin[0])*distance
traceEnd[1] = (sourceOrigin[1]-targetOrigin[1])*distance
traceEnd[2] = (sourceOrigin[2]-targetOrigin[2])*distance
// Draw a trace line to get the place for blood on the wall
new res, Float:wallOrigin[3]
engfunc(EngFunc_TraceLine, sourceOrigin, traceEnd, 0, target, res)
get_tr2(res, TR_vecEndPos, wallOrigin)
// Put blood on the walls if they're near enough
if(wallOrigin[0] != traceEnd[0] || wallOrigin[1] != traceEnd[1] ||
wallOrigin[2] != traceEnd[2])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_WORLDDECAL)
write_coord(floatround(wallOrigin[0]))
write_coord(floatround(wallOrigin[1]))
write_coord(floatround(wallOrigin[2]))
write_byte(wpn_gi_get_smallblood_decal())
message_end()
}
return 1
}