Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[local ablauf = false
- local gMe = getLocalPlayer()
- local ped
- local stat = {}
- local firetimer
- local timer = {}
- local jx, jy, jz
- stat["jumping"] = false
- local function on_damage_check()
- local x, y, z = getElementPosition(gMe)
- local x2, y2, z2 = getElementPosition(ped)
- if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 2) then
- setTimer(function()
- setPedControlState(ped, "fire", true)
- setPedControlState(ped, "aim_weapon", true)
- if(isTimer(firetimer)) then killTimer(firetimer) end
- firetimer = setTimer(function()
- setPedControlState(ped, "fire", false)
- setPedControlState(ped, "aim_weapon", false)
- end, 1000, 1)
- end, 500, 1)
- end
- end
- local function functionscheck()
- if(isElement(ped)) and (ablauf == true) then
- local x, y, z = getElementPosition(gMe)
- local x2, y2, z2 = getElementPosition(ped)
- if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 2) then
- stat["running"] = true
- if(getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) > 10) then
- if(stat["jumping"] ~= true) then
- setPedAnimation(ped, "ped" , "sprint_civi", -1, true, true, false)
- end
- else
- if(stat["jumping"] ~= true) then
- setPedAnimation(ped, "ped" , "JOG_maleA", -1, true, true, false)
- end
- end
- local x1, y1 = getElementPosition(ped)
- local x2, y2 = getElementPosition(gMe)
- local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
- rot = rot-90
- setPedRotation(ped, rot)
- if((z-z2) > 0.8) and (getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) < 4) then
- stat["jumping"] = true
- setPedAnimation(ped)
- setPedControlState(ped, "jump", true)
- outputChatBox("Er ist oben")
- if(isTimer(timer["jump"])) then killTimer(timer["jump"]) end
- timer["jump"] = setTimer(function()
- stat["jumping"] = false
- setPedControlState(ped, "jump", false)
- end, 700, 1)
- end
- else
- if (stat["running"] == true)then
- stat["running"] = false
- setPedAnimation(ped)
- end
- end
- end
- end
- setTimer(functionscheck, 200, -1)
- addCommandHandler("follower", function()
- if(ablauf == true) then return end
- ablauf = true
- local x, y, z = getElementPosition(gMe)
- ped = createPed(60, x, y+1, z)
- addEventHandler("onClientPedDamage", ped, on_damage_check)
- end)
- ]]
- addEvent("doPedJump", true)
- addEvent("doPedEnter", true)
- addEvent("doPedExitVeh", true)
- addEventHandler("doPedJump", getLocalPlayer(), function(p, boolean)
- setPedControlState(p, "jump", boolean)
- end)
- addEventHandler("doPedEnter", getLocalPlayer(), function(p, boolean)
- setPedControlState(p, "enter_passenger", boolean)
- end)
- addEventHandler("doPedExitVeh", getLocalPlayer(), function(p, boolean)
- setPedControlState(p, "enter_exit", boolean)
- end)
- -- DAMAGE ABFRAGE --
- local pedTarget = {}
- local pedTimer = {}
- local pedShooting = {}
- local function doPedAttackOtherPlayer(ped)
- if(isTimer(pedTimer[ped])) or (isPedInVehicle(ped)) then
- killTimer(pedTimer[ped])
- end
- if(isElement(ped)) then
- pedTimer[ped] = setTimer(function()
- if(isElement(ped)) then
- local target = pedTarget[ped]
- if(target) then
- local x, y, z = getElementPosition(ped)
- local x2, y2, z2 = getElementPosition(target)
- if(isLineOfSightClear(x, y, z, x2, y2, z2, true, false, false, false, false, false)) then
- if(pedShooting[ped]) and (pedShooting[ped] == true) then
- pedShooting[ped] = false
- setPedControlState(ped, "fire", false)
- setPedControlState(ped, "aim_weapon", false)
- else
- if(getElementHealth(target) > 1) then
- pedShooting[ped] = true
- local x1, y1 = getElementPosition(ped)
- local x2, y2 = getElementPosition(target)
- local rot = math.atan2(y2 - y1, x2 - x1) * 180 / math.pi
- rot = rot-90
- setPedRotation(ped, rot)
- setPedControlState(ped, "aim_weapon", true)
- setPedControlState(ped, "fire", true)
- setPedAimTarget(ped, x2, y2, z2)
- else
- pedShooting[ped] = false
- killTimer(pedTimer[ped])
- end
- end
- end
- else
- killTimer(pedTimer[ped])
- end
- else
- killTimer(pedTimer[ped])
- end
- end, 500, -1)
- else
- killTimer(pedTimer[ped])
- end
- end
- addEventHandler("onClientPedDamage", getRootElement(), function(attacker)
- if(getElementData(source, "bodyguard") == true) then
- pedTarget[source] = attacker
- doPedAttackOtherPlayer(source)
- end
- end)
Add Comment
Please, Sign In to add comment