forked from Simnation/Main
37 lines
1.2 KiB
Lua
37 lines
1.2 KiB
Lua
-- Replace the existing onResourceStart event handler with this:
|
|
AddEventHandler('onResourceStart', function(resourceName)
|
|
if (GetCurrentResourceName() == resourceName) then
|
|
-- Use next() instead of # to check if the table has any entries
|
|
if next(Config.peds) ~= nil then
|
|
print("Resource started, spawning peds")
|
|
SpawnPeds()
|
|
else
|
|
print("Resource started, but Config.peds is empty")
|
|
end
|
|
end
|
|
end)
|
|
|
|
-- Also update the framework loading event handler:
|
|
if Config.FrameworkLoadinEvent ~= '' then
|
|
RegisterNetEvent(Config.FrameworkLoadinEvent, function()
|
|
print("Framework loading event triggered")
|
|
if next(Config.peds) ~= nil then
|
|
print("Spawning peds after framework loaded")
|
|
SpawnPeds()
|
|
else
|
|
print("Framework loaded, but Config.peds is empty")
|
|
end
|
|
end)
|
|
end
|
|
|
|
-- Add a debug command to help troubleshoot
|
|
RegisterCommand('debugpeds', function()
|
|
print("Debug peds command triggered")
|
|
local count = 0
|
|
for k, v in pairs(Config.peds) do
|
|
count = count + 1
|
|
print("Found ped: " .. k)
|
|
end
|
|
print("Total peds in config: " .. count)
|
|
SpawnPeds()
|
|
end, false)
|