Hey Guys,
so i wanted to shake a hud if a player is sprinting/walking than the offset should be +20.
but that doesn't work.
Hope you can help me.
Regards,
KRZO.
local lplayer = getLocalPlayer()
local g_root = getRootElement()
local sWidth,sHeight = guiGetScreenSize()
local Width,Height = 300,150
local X = (sWidth/2) - (Width/2)
local Y = (sHeight/2) - (Height/2)
local offset = 0
local turn = true
function renderShake()
local state = getPedMoveState(lplayer)
if state.sprint or state.walk or state.powerwalk then
if turn then
offset = offset + 1
if offset > 20 then
turn = false
end
else
offset = offset - 1
if offset < -20 then
turn = true
end
end
else
if offset > 0 then
offset = offset - 1
elseif offset < 0 then
offset = offset + 1
end
turn = true
end
dxDrawRectangle(X+500,(Y+270)-offset,Width,Height,tocolor(44, 62, 80,225),false)
end
addEventHandler("onClientRender",g_root,renderShake)