server :
local pediolustur = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(700)
if os.date('%X') == '19:00:00' then -- string olarak yazman lazım buraya pedin spawnlanma zamanını giriceksin.
pediolustur = true
TriggerClientEvent('dope:spawnped', pediolustur)
end
end
end
Client :
local SpawnPed = false
RegisterNetEvent('dope:spawnped')
AddEventHandler('dope:spawnped', pediolustur)
SpawnPed = true
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if not DoesEntityExist(dope) and SpawnPed == true then
local PedModel = "blabla"
RequestModel(PedModel)
while not HasModelLoaded(PedModel) do
Citizen.Wait(10)
end
dope = CreatePed(1, PedModel, x,y,z,h, true, false)
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if SpawnPed == true then
Citizen.Wait(600000) -- Pedin silineceği süre
SpawnPed = false
DeleteEntity(dope)
end
end
end)