This commit is contained in:
Nordi98 2025-06-10 17:37:12 +02:00
parent 6d90da2841
commit b71b47a9fb
169 changed files with 12687 additions and 2932 deletions

View file

@ -0,0 +1,278 @@
-- Global variables
Global = {
currentInteriorId = 0,
-- The current interior is set to True by 'interiorIdObserver'
Online = {
isInsideApartmentHi1 = false,
isInsideApartmentHi2 = false,
isInsideHouseHi1 = false,
isInsideHouseHi2 = false,
isInsideHouseHi3 = false,
isInsideHouseHi4 = false,
isInsideHouseHi5 = false,
isInsideHouseHi6 = false,
isInsideHouseHi7 = false,
isInsideHouseHi8 = false,
isInsideHouseLow1 = false,
isInsideHouseMid1 = false
},
Biker = {
isInsideClubhouse1 = false,
isInsideClubhouse2 = false
},
FinanceOffices = {
isInsideOffice1 = false,
isInsideOffice2 = false,
isInsideOffice3 = false,
isInsideOffice4 = false
},
HighLife = {
isInsideApartment1 = false,
isInsideApartment2 = false,
isInsideApartment3 = false,
isInsideApartment4 = false,
isInsideApartment5 = false,
isInsideApartment6 = false
},
Security = {
isInsideOffice1 = false,
isInsideOffice2 = false,
isInsideOffice3 = false,
isInsideOffice4 = false
},
-- Set all interiors variables to false
-- The loop inside 'interiorIdObserver' will set them to true
ResetInteriorVariables = function()
for _, parentKey in pairs{"Biker", "FinanceOffices", "HighLife", "Security"} do
local t = Global[parentKey]
for key in pairs(t) do
t[key] = false
end
end
end
}
exports('GVariables', function()
return Global
end)
exports('EnableIpl', function(ipl, activate)
return EnableIpl(ipl, activate)
end)
exports('GetPedheadshotTexture', function(ped)
return GetPedheadshotTexture(ped)
end)
-- Load or remove IPL(s)
function EnableIpl(ipl, activate)
if type(ipl) == "table" then
for key, value in pairs(ipl) do
EnableIpl(value, activate)
end
else
if activate then
if not IsIplActive(ipl) then
RequestIpl(ipl)
end
else
if IsIplActive(ipl) then
RemoveIpl(ipl)
end
end
end
end
-- Enable or disable the specified props in an interior
function SetIplPropState(interiorId, props, state, refresh)
if refresh == nil then
refresh = false
end
if type(interiorId) == "table" then
for key, value in pairs(interiorId) do
SetIplPropState(value, props, state, refresh)
end
else
if type(props) == "table" then
for key, value in pairs(props) do
SetIplPropState(interiorId, value, state, refresh)
end
elseif type(props) == "string" then
if state then
if not IsInteriorEntitySetActive(interiorId, props) then
ActivateInteriorEntitySet(interiorId, props)
end
else
if IsInteriorEntitySetActive(interiorId, props) then
DeactivateInteriorEntitySet(interiorId, props)
end
end
end
if refresh then
RefreshInterior(interiorId)
end
end
end
function CreateNamedRenderTargetForModel(name, model)
local handle = 0
if not IsNamedRendertargetRegistered(name) then
RegisterNamedRendertarget(name, false)
end
if not IsNamedRendertargetLinked(model) then
LinkNamedRendertarget(model)
end
if IsNamedRendertargetRegistered(name) then
handle = GetNamedRendertargetRenderId(name)
end
return handle
end
function DrawEmptyRect(name, model)
local step = 250
local timeout = 5 * 1000
local currentTime = 0
local renderId = CreateNamedRenderTargetForModel(name, model)
while not IsNamedRendertargetRegistered(name) do
Wait(step)
currentTime = currentTime + step
if currentTime >= timeout then
return false
end
end
if IsNamedRendertargetRegistered(name) then
SetTextRenderId(renderId)
SetScriptGfxDrawOrder(4)
DrawRect(0.5, 0.5, 1.0, 1.0, 0, 0, 0, 0)
SetTextRenderId(GetDefaultScriptRendertargetRenderId())
ReleaseNamedRendertarget(0, name)
end
return true
end
function SetupScaleform(movieId, scaleformFunction, parameters)
BeginScaleformMovieMethod(movieId, scaleformFunction)
ScaleformMovieMethodAddParamTextureNameString_2(name)
if type(parameters) == "table" then
for i = 0, Tablelength(parameters) - 1 do
local p = parameters["p" .. tostring(i)]
if p.type == "bool" then
ScaleformMovieMethodAddParamBool(p.value)
elseif p.type == "int" then
ScaleformMovieMethodAddParamInt(p.value)
elseif p.type == "float" then
ScaleformMovieMethodAddParamFloat(p.value)
elseif p.type == "string" then
ScaleformMovieMethodAddParamTextureNameString(p.value)
elseif p.type == "buttonName" then
ScaleformMovieMethodAddParamPlayerNameString(p.value)
end
end
end
EndScaleformMovieMethod()
SetScaleformMovieToUseLargeRt(movieId, true)
end
function LoadStreamedTextureDict(texturesDict)
local step = 1000
local timeout = 5 * 1000
local currentTime = 0
RequestStreamedTextureDict(texturesDict, false)
while not HasStreamedTextureDictLoaded(texturesDict) do
Wait(step)
currentTime = currentTime + step
if currentTime >= timeout then
return false
end
end
return true
end
function LoadScaleform(scaleform)
local step = 1000
local timeout = 5 * 1000
local currentTime = 0
local handle = RequestScaleformMovie(scaleform)
while not HasScaleformMovieLoaded(handle) do
Wait(step)
currentTime = currentTime + step
if currentTime >= timeout then
return -1
end
end
return handle
end
function GetPedheadshot(ped)
local step = 1000
local timeout = 5 * 1000
local currentTime = 0
local pedheadshot = RegisterPedheadshot(ped)
while not IsPedheadshotReady(pedheadshot) do
Wait(step)
currentTime = currentTime + step
if currentTime >= timeout then
return -1
end
end
return pedheadshot
end
function GetPedheadshotTexture(ped)
local textureDict = nil
local pedheadshot = GetPedheadshot(ped)
if pedheadshot ~= -1 then
textureDict = GetPedheadshotTxdString(pedheadshot)
local IsTextureDictLoaded = LoadStreamedTextureDict(textureDict)
if not IsTextureDictLoaded then
print("ERROR: GetPedheadshotTexture - Textures dictionnary \"" .. tostring(textureDict) .. "\" cannot be loaded.")
end
else
print("ERROR: GetPedheadshotTexture - PedHeadShot not ready.")
end
return textureDict
end
-- Return the number of elements of the table
function Tablelength(T)
local count = 0
for _ in pairs(T) do
count = count + 1
end
return count
end

View file

@ -0,0 +1,53 @@
local _scanDelay = 500
CreateThread(function()
while true do
Global.currentInteriorId = GetInteriorFromEntity(PlayerPedId())
if Global.currentInteriorId == 0 then
Global.ResetInteriorVariables()
else
-- Setting variables
-- GTA Online
Global.Online.isInsideApartmentHi1 = (Global.currentInteriorId == GTAOApartmentHi1.interiorId)
Global.Online.isInsideApartmentHi2 = (Global.currentInteriorId == GTAOApartmentHi2.interiorId)
Global.Online.isInsideHouseHi1 = (Global.currentInteriorId == GTAOHouseHi1.interiorId)
Global.Online.isInsideHouseHi2 = (Global.currentInteriorId == GTAOHouseHi2.interiorId)
Global.Online.isInsideHouseHi3 = (Global.currentInteriorId == GTAOHouseHi3.interiorId)
Global.Online.isInsideHouseHi4 = (Global.currentInteriorId == GTAOHouseHi4.interiorId)
Global.Online.isInsideHouseHi5 = (Global.currentInteriorId == GTAOHouseHi5.interiorId)
Global.Online.isInsideHouseHi6 = (Global.currentInteriorId == GTAOHouseHi6.interiorId)
Global.Online.isInsideHouseHi7 = (Global.currentInteriorId == GTAOHouseHi7.interiorId)
Global.Online.isInsideHouseHi8 = (Global.currentInteriorId == GTAOHouseHi8.interiorId)
Global.Online.isInsideHouseLow1 = (Global.currentInteriorId == GTAOHouseLow1.interiorId)
Global.Online.isInsideHouseMid1 = (Global.currentInteriorId == GTAOHouseMid1.interiorId)
-- DLC: High life
Global.HighLife.isInsideApartment1 = (Global.currentInteriorId == HLApartment1.interiorId)
Global.HighLife.isInsideApartment2 = (Global.currentInteriorId == HLApartment2.interiorId)
Global.HighLife.isInsideApartment3 = (Global.currentInteriorId == HLApartment3.interiorId)
Global.HighLife.isInsideApartment4 = (Global.currentInteriorId == HLApartment4.interiorId)
Global.HighLife.isInsideApartment5 = (Global.currentInteriorId == HLApartment5.interiorId)
Global.HighLife.isInsideApartment6 = (Global.currentInteriorId == HLApartment6.interiorId)
-- DLC: Bikers - Clubhouses
Global.Biker.isInsideClubhouse1 = (Global.currentInteriorId == BikerClubhouse1.interiorId)
Global.Biker.isInsideClubhouse2 = (Global.currentInteriorId == BikerClubhouse2.interiorId)
-- DLC: Finance & Felony - Offices
Global.FinanceOffices.isInsideOffice1 = (Global.currentInteriorId == FinanceOffice1.currentInteriorId)
Global.FinanceOffices.isInsideOffice2 = (Global.currentInteriorId == FinanceOffice2.currentInteriorId)
Global.FinanceOffices.isInsideOffice3 = (Global.currentInteriorId == FinanceOffice3.currentInteriorId)
Global.FinanceOffices.isInsideOffice4 = (Global.currentInteriorId == FinanceOffice4.currentInteriorId)
-- DLC: The Contract
Global.Security.isInsideOffice1 = (Global.currentInteriorId == MpSecurityOffice1.InteriorId)
Global.Security.isInsideOffice2 = (Global.currentInteriorId == MpSecurityOffice2.InteriorId)
Global.Security.isInsideOffice3 = (Global.currentInteriorId == MpSecurityOffice3.InteriorId)
Global.Security.isInsideOffice4 = (Global.currentInteriorId == MpSecurityOffice4.InteriorId)
end
Wait(_scanDelay)
end
end)

View file

@ -0,0 +1,35 @@
CreateThread(function()
while true do
local sleep = 500
if Global.Security.isInsideOffice1 or Global.Security.isInsideOffice2 or Global.Security.isInsideOffice3 or Global.Security.isInsideOffice4 then
sleep = 0
if Global.Security.isInsideOffice1 then
EnableExteriorCullModelThisFrame(`bh1_05_build1`)
EnableExteriorCullModelThisFrame(`bh1_05_em`)
end
if Global.Security.isInsideOffice2 then
EnableExteriorCullModelThisFrame(`hei_hw1_08_hotplaz01`)
EnableExteriorCullModelThisFrame(`hw1_08_hotplaz_rail`)
EnableExteriorCullModelThisFrame(`hw1_08_emissive_c`)
end
if Global.Security.isInsideOffice3 then
EnableExteriorCullModelThisFrame(`hei_kt1_05_01`)
EnableExteriorCullModelThisFrame(`kt1_05_glue_b`)
EnableExteriorCullModelThisFrame(`kt1_05_kt_emissive_kt1_05`)
end
if Global.Security.isInsideOffice4 then
EnableExteriorCullModelThisFrame(`hei_kt1_08_buildingtop_a`)
EnableExteriorCullModelThisFrame(`hei_kt1_08_kt1_emissive_ema`)
end
DisableOcclusionThisFrame()
end
Wait(sleep)
end
end)

View file

@ -0,0 +1,47 @@
-- Delay between each attempt to open/close the doors corresponding to their state
local _scanDelay = 500
CreateThread(function()
while true do
local office = 0
-- Search for the current office to open/close the safes doors
if Global.FinanceOffices.isInsideOffice1 then
office = FinanceOffice1
elseif Global.FinanceOffices.isInsideOffice2 then
office = FinanceOffice2
elseif Global.FinanceOffices.isInsideOffice3 then
office = FinanceOffice3
elseif Global.FinanceOffices.isInsideOffice4 then
office = FinanceOffice4
end
if office ~= 0 then
-- Office found, let's check the doors
-- Check left door
doorHandle = office.Safe.GetDoorHandle(office.currentSafeDoors.hashL)
if doorHandle ~= 0 then
if office.Safe.isLeftDoorOpen then
office.Safe.SetDoorState("left", true)
else
office.Safe.SetDoorState("left", false)
end
end
-- Check right door
doorHandle = office.Safe.GetDoorHandle(office.currentSafeDoors.hashR)
if doorHandle ~= 0 then
if office.Safe.isRightDoorOpen then
office.Safe.SetDoorState("right", true)
else
office.Safe.SetDoorState("right", false)
end
end
end
Wait(_scanDelay)
end
end)