Raised This Month: $ Target: $400
 0% 

Need Help with Blood direction!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CantShoot
Junior Member
Join Date: Jan 2007
Location: Delaware
Old 07-24-2010 , 08:18   Need Help with Blood direction!
Reply With Quote #1

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
}
CantShoot is offline
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:07.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode