PUBLIC FILES
Last updated
Last updated
-- Set weather at night
function SetNightWeather(weather)
SetOverrideWeather(weather)
end
-- Set weather when night finish
function ResetWeatherTrigger()
local randomIndex = math.random(1, #Integer.WeathersAtDay) -- Genera un indice casuale
local randomWeather = Integer.WeathersAtDay[randomIndex] -- Ottiene un tipo di tempo casuale
SetOverrideWeather(randomWeather)
endfunction RequestAnim(AnimDict,AnimType)
RequestAnimDict(AnimDict)
while not HasAnimDictLoaded(AnimDict) do
Wait(0)
end
end
function Animation(obj_name,AnimDict,AnimType,useObject)
local prop
local playerPed = PlayerPedId()
RequestAnim(AnimDict,AnimType)
TaskPlayAnim(playerPed, AnimDict, AnimType, 8.0, -8, -1, 49, 0, 0, 0, 0)
if useObject then
RequestModel(GetHashKey(obj_name))
local x,y,z = table.unpack(GetEntityCoords(playerPed))
prop = CreateObject(GetHashKey(obj_name), x, y, z + 0.2, true, true, true)
local boneIndex = GetPedBoneIndex(playerPed, 18905)
AttachEntityToEntity(prop, playerPed, boneIndex, 0.12, 0.028, 0.031, -70.0, -160.0, -0.0, true, true, false, true, 1, true)
end
Wait(3000)
ClearPedSecondaryTask(playerPed)
DeleteObject(prop)
StartScreenEffect("TinyRacerPinkOut", 3000, false)
end
function NearFireTrigger()
Notification("Passed 120 seconds near fire and it is hot")
end
function NearFireTrigger2()
Notification("Passed 320 seconds near fire, it is hot and i'm feeling good")
end
function TooMuchColdTrigger()
Notification("Too much cold... maybe i have to stay near a fire")
ApplyDamageToPed(PlayerPedId(), Integer.TooColdDamage, false)
end
function TooMuchHotTrigger()
Notification("Too much hot...")
ApplyDamageToPed(PlayerPedId(), Integer.TooHotDamage, false)
end
function RadioactivityTrigger()
endfunction CollectWoodTrigger()
Notification("Wood collected")
end
function CollectRockTrigger()
Notification("Stone collected")
endif Integer.Framework == "esx" then
ESX = exports["es_extended"]:getSharedObject()
--InitializeItems()
elseif Integer.Framework == "qb" then
QBCore = exports['qb-core']:GetCoreObject()
--InitializeItems()
elseif Integer.Framework == "custom" then
end
function GetPlayer(Id)
if Integer.Framework == "esx" then
return ESX.GetPlayerFromId(Id)
elseif Integer.Framework == "qb" then
return QBCore.Functions.GetPlayer(Id)
end
end
function GetIdentifier(Id)
if GetPlayer(Id) then
if Integer.Framework == "esx" then
return GetPlayer(Id).identifier
elseif Integer.Framework == "qb" then
return GetPlayer(Id).PlayerData.citizenid
end
end
end
function AddItem(player,item,quantity)
if Integer.Framework == "esx" then
player.addInventoryItem(item, quantity)
elseif Integer.Framework == "qb" then
player.Functions.AddItem(item, quantity)
elseif Integer.Framework == "custom" then
end
end
function RemoveItem(player,item,quantity)
if Integer.Framework == "esx" then
player.removeInventoryItem(item, quantity)
elseif Integer.Framework == "qb" then
player.Functions.RemoveItem(item, quantity)
elseif Integer.Framework == "custom" then
end
end
for i,k in pairs(Integer.CurativeItems) do
if Integer.Framework == "esx" then
ESX.RegisterUsableItem(i,function(source)
RemoveItem(GetPlayer(source),i,1)
exports[GetCurrentResourceName()]:StartMedicineEffect(source,k.RadioChargeSpeed,k.ScriptLoop,k.time,k.propName)
end)
elseif Integer.Framework == "qb" then
QBCore.Functions.CreateUseableItem(i,function(source)
RemoveItem(GetPlayer(source),i,1)
exports[GetCurrentResourceName()]:StartMedicineEffect(source,k.RadioChargeSpeed,k.ScriptLoop,k.time,k.propName)
end)
end
end
for i,k in pairs(Integer.NoInfectionItems) do
if Integer.Framework == "esx" then
ESX.RegisterUsableItem(i,function(source)
RemoveItem(GetPlayer(source),i,1)
exports[GetCurrentResourceName()]:StartMedicineEffectInfection(source,k.RadioChargeSpeed,k.ScriptLoop,k.time,k.propName)
end)
elseif Integer.Framework == "qb" then
QBCore.Functions.CreateUseableItem(i,function(source)
RemoveItem(GetPlayer(source),i,1)
exports[GetCurrentResourceName()]:StartMedicineEffectInfection(source,k.RadioChargeSpeed,k.ScriptLoop,k.time,k.propName)
end)
end
end