timerstate = false
function down()
if timerstate == false then
local thePlayer = getLocalPlayer()
local theVehicle = getPedOccupiedVehicle(thePlayer)
if theVehicle and getVehicleController(theVehicle) then
timer = setTimer(startdown, 50, 0, theVehicle)
timerstate = true
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
end
else
end
end
function startdown(theVehicle)
if theVehicle and getVehicleController(theVehicle) then
triggerServerEvent("onSuspDown", getRootElement(), theVehicle)
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
killTimer(timer)
timerstate = false
end
end
function up()
if timerstate == false then
local thePlayer = getLocalPlayer()
local theVehicle = getPedOccupiedVehicle(thePlayer)
if theVehicle and getVehicleController(theVehicle) then
timer = setTimer(startup, 50, 0, theVehicle)
timerstate = true
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
end
else
end
end
function startup(theVehicle)
if theVehicle and getVehicleController(theVehicle) then
triggerServerEvent("onSuspUp", getRootElement(), theVehicle)
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
killTimer(timer)
timerstate = false
end
end
function front()
if timerstate == false then
local thePlayer = getLocalPlayer()
local theVehicle = getPedOccupiedVehicle(thePlayer)
if theVehicle and getVehicleController(theVehicle) then
timer = setTimer(startfront, 50, 0, theVehicle)
timerstate = true
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
end
else
end
end
function startfront(theVehicle)
if theVehicle and getVehicleController(theVehicle) then
triggerServerEvent("onSuspFront", getRootElement(), theVehicle)
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
killTimer(timer)
timerstate = false
end
end
function back()
if timerstate == false then
local thePlayer = getLocalPlayer()
local theVehicle = getPedOccupiedVehicle(thePlayer)
if theVehicle and getVehicleController(theVehicle) then
timer = setTimer(startback, 50, 0, theVehicle)
timerstate = true
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
end
else
end
end
function startback(theVehicle)
if theVehicle and getVehicleController(theVehicle) then
triggerServerEvent("onSuspBack", getRootElement(), theVehicle)
else
outputChatBox("Вы не за рулем!", 255, 0, 0)
killTimer(timer)
timerstate = false
end
end
function stop()
if timerstate == true then
killTimer(timer)
timerstate = false
else
end
end
function bind()
bindKey("-", "down", down)
bindKey("-", "up", stop)
bindKey("=", "down", up)
bindKey("=", "up", stop)
bindKey("9", "down", front)
bindKey("9", "up", stop)
bindKey("0", "down", back)
bindKey("0", "up", stop)
end
addEventHandler("onClientResourceStart", getRootElement(), bind)