ladder = {}
addEventHandler("onClientResourceStart", getResourceRootElement(), function()
for _FORV_3_, _FORV_4_ in ipairs(confg) do
if _FORV_4_.cord[3] + 1 * _FORV_4_.downLadder > math.ceil(_FORV_4_.downLadder / 1 * 0.8) then
_FORV_4_.downLadder = math.abs(1 * _FORV_4_.downLadder / 1)
end
setElementData(createColTube(_FORV_4_.cord[1], _FORV_4_.cord[2], _FORV_4_.cord[3], 0.8, _FORV_4_.downLadder), "ladder", true)
setElementData(createColTube(_FORV_4_.cord[1], _FORV_4_.cord[2], _FORV_4_.cord[3] + 1 * _FORV_4_.downLadder, 0.8, 1), "ladder_d", true)
setElementData(createColTube(_FORV_4_.cord[1], _FORV_4_.cord[2], _FORV_4_.cord[3], 0.8, _FORV_4_.downLadder), "ladder_rot", _FORV_4_.rot)
end
end)
function ladderSetups()
if _UPVALUE0_ and not _UPVALUE1_ and not _UPVALUE2_ then
if (getElementData(localPlayer, "blood") or 0) < 1 then
ladderqout()
return
end
if _UPVALUE3_ and getPedAnimation(localPlayer) ~= "ped" and getPedAnimation(localPlayer) ~= "fightshf" then
ladderqout()
return
end
setElementRotation(localPlayer, getElementRotation(localPlayer))
if getPedControlState("jump") and not _UPVALUE1_ then
ladderqout()
return
end
if getPedControlState("sprint") then
_UPVALUE5_ = 0.075
else
_UPVALUE5_ = nil
end
if getPedControlState("forwards") then
setElementPosition(localPlayer, _UPVALUE6_, _UPVALUE7_, getElementPosition(localPlayer) + (_UPVALUE5_ or 0.035), false)
_UPVALUE8_ = true
elseif getPedControlState("backwards") then
if 1 < getElementPosition(localPlayer) - getGroundPosition(getElementPosition(localPlayer)) then
setElementPosition(localPlayer, _UPVALUE6_, _UPVALUE7_, getElementPosition(localPlayer) - (_UPVALUE5_ or 0.035), false)
_UPVALUE8_ = false
else
ladderqout()
return
end
end
end
end
addEventHandler("onClientRender", getRootElement(), ladderSetups)
function shpahitLadder(_ARG_0_, _ARG_1_)
if _ARG_0_ == getLocalPlayer() and not _UPVALUE0_ and not _UPVALUE1_ and not _UPVALUE2_ and getElementData(source, "ladder") then
triggerServerEvent("setAnimationladder", _ARG_0_, false)
triggerServerEvent("setAnimationladder", _ARG_0_, true)
_UPVALUE3_ = -getElementData(source, "ladder_rot")
_UPVALUE4_, _UPVALUE5_ = getElementPosition(source) - math.sin(math.rad(_UPVALUE3_)) * 0.2, getElementPosition(source) - math.cos(math.rad(_UPVALUE3_)) * 0.1
setElementPosition(_ARG_0_, _UPVALUE4_, _UPVALUE5_, getElementPosition(_ARG_0_))
setElementFrozen(_ARG_0_, true)
setElementRotation(_ARG_0_, getElementRotation(_ARG_0_))
_UPVALUE6_, _UPVALUE0_ = getElementPosition(source)
_UPVALUE6_, _UPVALUE0_ = getElementPosition(source)
setTimer(function()
_UPVALUE0_ = true
end, 100, 1)
end
end
addEventHandler("onClientColShapeHit", getRootElement(), shpahitLadder)
function onClientColShapeLeave(_ARG_0_)
if _ARG_0_ == getLocalPlayer() and _UPVALUE0_ and _UPVALUE1_ and not _UPVALUE2_ and not _UPVALUE3_ and getElementData(source, "ladder_d") then
triggerServerEvent("setLadderOmos", _ARG_0_)
_UPVALUE4_, _UPVALUE5_ = 0, 0
_UPVALUE6_ = 0
_UPVALUE7_ = nil
_UPVALUE1_ = false
_UPVALUE0_ = false
_UPVALUE8_ = false
_UPVALUE2_ = true
setTimer(function()
_UPVALUE0_ = false
end, 1000, 1)
end
end
addEventHandler("onClientColShapeLeave", getRootElement(), onClientColShapeLeave)
function ladderqout()
_UPVALUE0_, _UPVALUE1_ = 0, 0
_UPVALUE2_ = 0
_UPVALUE3_ = nil
_UPVALUE4_ = false
_UPVALUE5_ = true
setElementFrozen(localPlayer, false)
setTimer(function()
_UPVALUE0_ = false
end, 1000, 1)
triggerServerEvent("setAnimationladder", localPlayer, false)
_UPVALUE6_ = false
_UPVALUE7_ = false
end
Alles anzeigen