local debugOverlay = ffi.cast("void***", se.create_interface("engine.dll", "VDebugOverlay004"))
local addLineOverlay = ffi.cast("void(__thiscall*)(void*, const struct vec3_t&, const struct vec3_t&, int, int, int, bool, float)", debugOverlay[0][5]);
local function drawLineOverlay( startPosition, endPosition, color )
shotStartPosition = ffi.new('struct vec3_t')
shotStartPosition.x = startPosition.x; shotStartPosition.y = startPosition.y; shotStartPosition.z = startPosition.z
shotEndPosition = ffi.new('struct vec3_t')
shotEndPosition.x = endPosition.x; shotEndPosition.y = endPosition.y; shotEndPosition.z = endPosition.z
addLineOverlay(debugOverlay, shotStartPosition, shotEndPosition, color.r, color.g, color.b, true, 2)
end
client.register_callback('fire_game_event', function(event)
if event:get_name() == 'round_start' then
oldtag = ''
freezeTimeBuy = true
end
if event:get_name() == 'bullet_impact' then
local localPlayerIndex = engine.get_local_player()
if shotTracer:get_value(0) then
local playerIndex = engine.get_player_for_user_id(event:get_int('userid', -1))
local bulletEndPosition = vec3_t.new(event:get_float('x', 0), event:get_float('y', 0), event:get_float('z', 0))
if (localPlayerIndex == playerIndex) then
drawLineOverlay( API.getEyePosition(), bulletEndPosition, shotTracerColor:get_value() )
end
end
if shotEffect:get_value() then
if shotEffectTime:get_value() > 1.75 then
shotEffectTime:set_value(1.75)
end
if shotEffectTime:get_value() < 0.1 then
shotEffectTime:set_value(0.1)
end
local beamInfo = ffi.new('struct TeslaBeamInfo_t')
beamInfo.position = { event:get_float('x', -1), event:get_float('y', -1), event:get_float('z', -1) }
beamInfo.angle = { 0, 0, 0 }
beamInfo.entityIndex = localPlayerIndex
beamInfo.spriteName = 'sprites/physbeam.vmt'
beamInfo.beamWidth = 2
beamInfo.beams = 2
beamInfo.color = { shotEffectColor:get_value().r / 255.0, shotEffectColor:get_value().g / 255.0, shotEffectColor:get_value().b / 255.0 }
beamInfo.visibleTime = shotEffectTime:get_value()
beamInfo.radius = 20
API.drawTeslaBeam(beamInfo)
end
end
end)