哈哈,这段代码看起来是一个无限循环 ,这是我修复后的
Citizen.CreateThread(function()
local playerPed = GetPlayerPed(-1)
local damageModifier = 0.5 -- 定义伤害倍率
local lastUpdateTime = 0
while true do
local currentTime = GetGameTimer()
local timeSinceLastUpdate = (currentTime - lastUpdateTime) / 1000
if timeSinceLastUpdate >= 1 then
SetPlayerMeleeWeaponDamageModifier(playerPed, damageModifier)
lastUpdateTime = currentTime
end
Citizen.Wait(1000) -- 等待1000毫秒(1秒)
end
end)