local check = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls
if check then
SetPedToRagdoll(GetPlayerPed(-1), 1, 1, 0, true, true, false) --如果 x 被按下就将人物设置为布娃娃,一定时间后恢复(这个ragdoll的操作就会让人物不受控制立刻瘫软倒地)
check = false
else
SetPedToRagdoll(GetPlayerPed(-1), 9999999, 9999999, 0, true, true, false) --如果 x 被按下就将人物设置为布娃娃,一定时间后恢复(这个ragdoll的操作就会让人物不受控制立刻瘫软倒地)
end
end
end
end)
我这样试过了站长,他这样直接没反应了Lua:local check = false Citizen.CreateThread(function() while true do Citizen.Wait(0) if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls if check then SetPedToRagdoll(GetPlayerPed(-1), 1, 1, 0, true, true, false) --如果 x 被按下就将人物设置为布娃娃,一定时间后恢复(这个ragdoll的操作就会让人物不受控制立刻瘫软倒地) check = true else SetPedToRagdoll(GetPlayerPed(-1), 9999999, 9999999, 0, true, true, false) --如果 x 被按下就将人物设置为布娃娃,一定时间后恢复(这个ragdoll的操作就会让人物不受控制立刻瘫软倒地) end end end end)
写错了。。。用我这样试过了站长,他这样直接没反应了
ResetPedRagdollTimer
试试local check = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls
if check then
ResetPedRagdollTimer(GetPlayerPed(-1))
check = false
else
SetPedToRagdoll(GetPlayerPed(-1), 9999999, 9999999, 0, true, true, false) --如果 x 被按下就将人物设置为布娃娃,一定时间后恢复(这个ragdoll的操作就会让人物不受控制立刻瘫软倒地)
end
end
end
end)
还不行站长,他这个是不是有限制啊写错了。。。用ResetPedRagdollTimer
试试
Lua:local check = false Citizen.CreateThread(function() while true do Citizen.Wait(0) if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls if check then ResetPedRagdollTimer(GetPlayerPed(-1)) check = false else SetPedToRagdoll(GetPlayerPed(-1), 9999999, 9999999, 0, true, true, false) --如果 x 被按下就将人物设置为布娃娃,一定时间后恢复(这个ragdoll的操作就会让人物不受控制立刻瘫软倒地) end end end end)
还不行站长,他这个是不是有限制啊
local check = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls
if check then
--ResetPedRagdollTimer(GetPlayerPed(-1))
SetPedCanRagdoll(GetPlayerPed(-1), not check)
check = not check
print(0)
Citizen.Wait(1000)
else
SetPedCanRagdoll(GetPlayerPed(-1), not check)
SetPedToRagdoll(GetPlayerPed(-1), 1000*65, 1000*65, 0, 0, 0, 0)
check = not check
print(1)
Citizen.Wait(1000)
end
end
end
end)
还不行站长,他这个是不是有限制啊
local check = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls
if check then
check = not check
Citizen.Wait(1000)
print(0)
else
SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
check = not check
Citizen.Wait(1000)
print(1)
end
end
if check then
ResetPedRagdollTimer(GetPlayerPed(-1) --[[ Ped ]])
end
end
end)
ResetPedRagdollTimer
去延长时间。好的好的,谢谢站长,麻烦了Lua:local check = false Citizen.CreateThread(function() while true do Citizen.Wait(0) if IsControlPressed(1, 73 --[[ "x" 键 ]]) then --检测 x 键是否被按下, countrol ID列表: https://docs.fivem.net/docs/game-references/controls/#controls if check then check = not check Citizen.Wait(1000) print(0) else SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0) check = not check Citizen.Wait(1000) print(1) end end if check then ResetPedRagdollTimer(GetPlayerPed(-1) --[[ Ped ]]) end end end)
更完美的解决方案,使用ResetPedRagdollTimer
去延长时间。
回答一个问题得搭上几个小时。。。。以后就自己遇见问题多探索探索了,不然我得累死。