@ osiem80 + friends...
Upon damage, player goes spastic for a couple seconds.
Modify for your own desires.
local plrdamage = {}
local shakeit = {}
local shaketime = {}
local freezethem = {}
local plrhealth = {}
local rolldir = {}
local yawcnt = {}
local plryaw = {}
function shake_camera_kg_init(e)
plrdamage[e] = 0
shakeit[e] = 0
shaketime[e] = 0
freezethem[e] = 0
plrhealth[e] = 0
rolldir[e] = 0
yawcnt[e] = 0
plryaw[e] = 0
end
function shake_camera_kg_main(e)
plrdamage[e] = plrhealth[e] - g_PlayerHealth
if plrdamage[e] > 0 then
shakeit[e] = 1
yawcnt[e] = 0
rolldir[e] = math.random(1,2)
if rolldir[e] == 1 then
plryaw[e] = plrdamage[e]/2
else
plryaw[e] = 0-plrdamage[e]/2
end
SetCameraOverride ( 2 )
end
plrhealth[e] = g_PlayerHealth
if shakeit[e] == 1 then
if yawcnt[e] < plryaw[e] then yawcnt[e] = yawcnt[e] + 5 end
if yawcnt[e] > plryaw[e] then yawcnt[e] = yawcnt[e] - 5 end
SetCameraAngle ( 0, yawcnt[e], g_PlayerAngY, yawcnt[e] )
if shaketime[e] < 8 then
freezethem[e] = freezethem[e] + 5
if freezethem[e] < 5 then
SetFreezePosition(g_PlayerPosX, g_PlayerPosY+freezethem[e], g_PlayerPosZ)
TransportToFreezePositionOnly()
end -- freezethem[e] < 5
if freezethem[e] > 35 then
freezethem[e] = -35
shaketime[e] = shaketime[e] + 1
end -- freezethem > 35
end -- shaketime < 3
end -- shakeit = 1
if shaketime[e] > 7 then
shaketime[e] = 1
shakeit[e] = 0
freezethem[e] = 0
yawcnt[e] = 0
SetCameraOverride ( 0 )
end -- shaketime > 3
if g_Scancode == 35 then HurtPlayer(e,2) end -- 'H' for hurt player //testing//
end -- main