Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function T_GrappleSync()
- -- This thread will syncronize ped speeds when they are grappling each other.
- -- If the ped's speed is changed while in grapple by something else, that change may be lost when the ped is out of the grapple and the original speed is restored.
- -- Usage: CreateThread("T_GrappleSync")
- -- Variables:
- local peds = {}
- -- Main loop:
- while true do
- -- Process peds:
- for i,ped in ipairs({PedFindInAreaXYZ(0,0,0,9999999)}) do
- if i > 1 then
- local s = peds[ped]
- local target = PedGetGrappleTargetPed(ped)
- if s then
- if target ~= s[1] then
- GameSetPedStat(ped,20,s[2])
- peds[ped] = nil
- elseif GameGetPedStat(ped,20) ~= GameGetPedStat(target,20) then
- GameSetPedStat(ped,20,GameGetPedStat(target,20))
- end
- elseif PedIsValid(target) and not PedIsDead(target) and GameGetPedStat(ped,20) ~= GameGetPedStat(target,20) then
- peds[ped] = {target,GameGetPedStat(ped,20)}
- GameSetPedStat(ped,20,GameGetPedStat(target,20))
- end
- end
- end
- -- Wait:
- Wait(0)
- -- Clean:
- for ped,s in pairs(peds) do
- if not PedIsValid(ped) then
- peds[ped] = nil
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment