我想在以下代码中添加一个计时器(Lua)
CreateThread(function()
while true do
Wait(0)
--if IsControlPressed(1, 47) then -- G
local CitoyenCible, distance = getNearPlayer()
if (distance ~= -1 and distance < 1.5001) then
if IsPedArmed(GetPlayerPed(-1), 7) then
SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey('WEAPON_UNARMED'), true)
end
if (DoesEntityExist(GetPlayerPed(-1)) and not IsEntityDead(GetPlayerPed(-1))) then
ChargementAnimation("melee@unarmed@streamed_variations")
TaskPlayAnim(GetPlayerPed(-1), "melee@unarmed@streamed_variations", "plyr_takedown_front_slap", 8.0, 1.0, 1500, 1, 0, 0, 0, 0)
TriggerServerEvent("RebornProject:SyncGiffle", GetPlayerServerId(CitoyenCible))
end
else
TriggerEvent("RebornProject:Notification", Notif1)
end
end
end
end)