1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-08-05 16:33:46 +02:00
parent cd945f7aff
commit fdb2ec1452
3046 changed files with 68309 additions and 12 deletions

Binary file not shown.

View file

@ -0,0 +1,96 @@
local function FindInterior(location)
local interior = GetInteriorAtCoords(location.x, location.y, location.z)
if interior == 0 then
return nil
end
return interior
end
local function HandleEntitySet(entitySetName, config)
local interior = FindInterior(config.location)
if not interior then
print("^3[EntitySet] Warning: Could not find interior for entity set '" .. entitySetName .. "' at location " .. tostring(config.location))
return
end
-- Store interior reference in config
config.interior = interior
-- Apply the entity set visibility based on config
if config.enabled then
ActivateInteriorEntitySet(interior, entitySetName)
print("^2[EntitySet] Enabled entity set: " .. entitySetName)
else
DeactivateInteriorEntitySet(interior, entitySetName)
print("^3[EntitySet] Disabled entity set: " .. entitySetName)
end
end
local function InitializeEntitySets()
-- Wait a bit to ensure all interiors are loaded
Citizen.Wait(2000)
-- Process all entity sets from config
for entitySetName, config in pairs(Config.EntitySets) do
HandleEntitySet(entitySetName, config)
end
end
-- Initialize when resource starts
Citizen.CreateThread(function()
InitializeEntitySets()
end)
-- Export function to toggle entity set at runtime (optional)
exports('ToggleEntitySet', function(entitySetName)
if not Config.EntitySets[entitySetName] then
print("^1[EntitySet] Error: Entity set '" .. entitySetName .. "' not found in config")
return false
end
local config = Config.EntitySets[entitySetName]
config.enabled = not config.enabled
HandleEntitySet(entitySetName, config)
return config.enabled
end)
-- Export function to set entity set state at runtime (optional)
exports('SetEntitySetState', function(entitySetName, enabled)
if not Config.EntitySets[entitySetName] then
print("^1[EntitySet] Error: Entity set '" .. entitySetName .. "' not found in config")
return false
end
local config = Config.EntitySets[entitySetName]
config.enabled = enabled
HandleEntitySet(entitySetName, config)
return config.enabled
end)
-- Command to toggle poker entity set
RegisterCommand('poker', function(source, args, rawCommand)
local config = Config.EntitySets['poker']
if not config then
print("^1[EntitySet] Error: Poker entity set not found in config")
return
end
-- Toggle the state
config.enabled = not config.enabled
-- Apply the changes
HandleEntitySet('poker', config)
-- Provide feedback
if config.enabled then
print("^2[EntitySet] Poker entity set has been ^2ENABLED^7")
else
print("^3[EntitySet] Poker entity set has been ^3DISABLED^7")
end
end, false)

View file

@ -0,0 +1,10 @@
Config = {}
-- Entity Set Configuration
Config.EntitySets = {
poker = {
enabled = true, -- Set to true to enable the poker entity set, false to disable
location = vector3(1577.52856, 3746.17773, 37.00349),
interior = nil -- Will be populated when interior is found
}
}

View file

@ -0,0 +1,27 @@
fx_version 'bodacious'
game 'gta5'
this_is_a_map 'yes'
lua54 'yes'
-- map by---:
author 'Prompt Studio'
description 'Sandy Shores Motel'
version '1.0.2'
client_scripts {
'config.lua',
'client_entitysets.lua',
'proximity_loader.lua'
}
server_scripts {
'sv_loader.lua'
}
escrow_ignore {
'stream/unlocked/**',
'proximity_loader.lua',
'config.lua',
'client_entitysets.lua'
}
dependency '/assetpacks'

View file

@ -0,0 +1,92 @@
-- IPL locations with their coordinates (extracted from XML files)
local iplLocations = {
-- Ground floor rooms (1-15)
{ name = "prompt_sandy_motel_room_1", x = 1615.8811, y = 3793.392, z = 35.5211754 },
{ name = "prompt_sandy_motel_room_2", x = 1611.48621, y = 3790.025, z = 35.5211754 },
{ name = "prompt_sandy_motel_room_3", x = 1607.138, y = 3786.635, z = 35.5211754 },
{ name = "prompt_sandy_motel_room_4", x = 1602.75232, y = 3783.26978, z = 35.5211754 },
{ name = "prompt_sandy_motel_room_5", x = 1584.32666, y = 3769.15454, z = 35.52501 },
{ name = "prompt_sandy_motel_room_6", x = 1579.42151, y = 3765.361, z = 35.52501 },
{ name = "prompt_sandy_motel_room_7", x = 1584.857, y = 3738.89575, z = 35.50938 },
{ name = "prompt_sandy_motel_room_8", x = 1589.37817, y = 3742.36548, z = 35.50938 },
{ name = "prompt_sandy_motel_room_9", x = 1593.98535, y = 3745.90063, z = 35.50938 },
{ name = "prompt_sandy_motel_room_10", x = 1598.95508, y = 3749.714, z = 35.50938 },
{ name = "prompt_sandy_motel_room_11", x = 1603.93469, y = 3753.53516, z = 35.50938 },
{ name = "prompt_sandy_motel_room_12", x = 1608.90576, y = 3757.34961, z = 35.50938 },
{ name = "prompt_sandy_motel_room_13", x = 1613.88062, y = 3761.167, z = 35.50938 },
{ name = "prompt_sandy_motel_room_14", x = 1618.85693, y = 3764.98535, z = 35.50938 },
{ name = "prompt_sandy_motel_room_15", x = 1623.81409, y = 3768.789, z = 35.50938 },
-- Upper floor rooms (16-32)
{ name = "prompt_sandy_motel_room_16", x = 1623.80627, y = 3768.78271, z = 39.117115 },
{ name = "prompt_sandy_motel_room_17", x = 1618.852, y = 3764.9812, z = 39.117115 },
{ name = "prompt_sandy_motel_room_18", x = 1613.88806, y = 3761.172, z = 39.117115 },
{ name = "prompt_sandy_motel_room_19", x = 1608.92346, y = 3757.36279, z = 39.117115 },
{ name = "prompt_sandy_motel_room_20", x = 1603.94312, y = 3753.54126, z = 39.117115 },
{ name = "prompt_sandy_motel_room_21", x = 1598.96094, y = 3749.71826, z = 39.117115 },
{ name = "prompt_sandy_motel_room_22", x = 1593.97, y = 3745.88867, z = 39.117115 },
{ name = "prompt_sandy_motel_room_23", x = 1589.0061, y = 3742.07983, z = 39.117115 },
{ name = "prompt_sandy_motel_room_24", x = 1584.02722, y = 3738.25928, z = 39.119194 },
{ name = "prompt_sandy_motel_room_25", x = 1571.75745, y = 3759.512, z = 39.1182556 },
{ name = "prompt_sandy_motel_room_26", x = 1576.73694, y = 3763.32861, z = 39.1182556 },
{ name = "prompt_sandy_motel_room_27", x = 1581.64746, y = 3767.10767, z = 39.1182556 },
{ name = "prompt_sandy_motel_room_28", x = 1587.66785, y = 3765.40454, z = 39.46466 },
{ name = "prompt_sandy_motel_room_29", x = 1602.66052, y = 3783.23853, z = 39.1182556 },
{ name = "prompt_sandy_motel_room_30", x = 1607.118, y = 3786.663, z = 39.1182556 },
{ name = "prompt_sandy_motel_room_31", x = 1611.51331, y = 3790.04443, z = 39.1182556 },
{ name = "prompt_sandy_motel_room_32", x = 1615.8811, y = 3793.392, z = 39.1182556 }
}
-- Configuration
local PROXIMITY_DISTANCE = 40.0 -- Distance in units to load/unload IPLs
local CHECK_INTERVAL = 1000 -- Check every 1 second (1000ms)
-- Keep track of loaded IPLs to avoid redundant calls
local loadedIPLs = {}
-- Function to calculate distance between two points
local function GetDistance(x1, y1, z1, x2, y2, z2)
return math.sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)
end
-- Function to load an IPL
local function LoadIPL(iplName)
if not loadedIPLs[iplName] then
RequestIpl(iplName)
loadedIPLs[iplName] = true
--print("^2[MOTEL PROXIMITY LOADER]^7 Loaded IPL: " .. iplName)
end
end
-- Function to unload an IPL
local function UnloadIPL(iplName)
if loadedIPLs[iplName] then
RemoveIpl(iplName)
loadedIPLs[iplName] = nil
--print("^1[MOTEL PROXIMITY LOADER]^7 Unloaded IPL: " .. iplName)
end
end
-- Main proximity check function
local function CheckProximity()
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)
for _, ipl in ipairs(iplLocations) do
local distance = GetDistance(playerCoords.x, playerCoords.y, playerCoords.z, ipl.x, ipl.y, ipl.z)
if distance <= PROXIMITY_DISTANCE then
LoadIPL(ipl.name)
else
UnloadIPL(ipl.name)
end
end
end
-- Start the proximity checker
CreateThread(function()
while true do
CheckProximity()
Wait(CHECK_INTERVAL)
end
end)

Some files were not shown because too many files have changed in this diff Show more