example
example

教程 如何在禁用服务器内的兔子跳行为

复制代码,将其粘贴到您的任意client.lua 中,然后重新启动脚本以强制角色在两到三次跳跃后落地。

Lua:
Citizen.CreateThread(function()

    while true do

        Citizen.Wait(100)

        local ped = PlayerPedId()

        if IsPedOnFoot(ped) and not IsPedSwimming(ped) and (IsPedRunning(ped) or IsPedSprinting(ped)) and not IsPedClimbing(ped) and IsPedJumping(ped) and not IsPedRagdoll(ped) then

            local chance_result = math.random()

            if chance_result < 0.50 then

                Citizen.Wait(600)

                SetPedToRagdoll(ped, 5000, 1, 2)

            else

                Citizen.Wait(2000)

            end

        end

    end

end)
 
优化建议:
步行起跳绕过了if判断;
步行 or 跑 or 小跑 要改作或判断;
(IsPedOnFoot(ped) or IsPedRunning(ped) or IsPedSprinting(ped)) and IsPedJumping(ped) and not IsPedSwimming(ped) and not IsPedClimbing(ped) and not IsPedRagdoll(ped)
执行Ragdoll后可以休眠3000ms,倒地再起身行走大约3s;
 
后退
顶部