From c975380b600115bbe04d9df528b2e2dd94d0f7aa Mon Sep 17 00:00:00 2001 From: delucecc <31872986+delucecc@users.noreply.github.com> Date: Sat, 3 Jun 2023 19:31:53 -0700 Subject: [PATCH] init --- client/client.lua | 40 ++++++++++++++++++++++++++++++++++++++++ config.lua | 9 +++++++++ fxmanifest.lua | 21 +++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 client/client.lua create mode 100644 config.lua create mode 100644 fxmanifest.lua diff --git a/client/client.lua b/client/client.lua new file mode 100644 index 0000000..2b002be --- /dev/null +++ b/client/client.lua @@ -0,0 +1,40 @@ +local entity_ids = {} + +function SpawnProps() + for k, v in pairs(Config.PropLocations) do + RequestModel(v.model) + while not HasModelLoaded(v.model) do + Wait(0) + end + local prop = CreateObject(v.model, v.coords.x, v.coords.y, v.coords.z - 1, true, true, false) + entity_ids[#entity_ids + 1] = prop + SetEntityHeading(prop, v.coords.w) + FreezeEntityPosition(prop, true) + print("^3Prop Spawned:" .. v.coords) + end +end + +function DeleteProps() + for _, entity in pairs(entity_ids) do + if DoesEntityExist(entity) then + DeleteEntity(entity) + end + end +end + +RegisterCommand(Config.DeleteCommand, function() + DeleteProps() +end) + +RegisterCommand(Config.SpawnCommand, function() + SpawnProps() +end) + +AddEventHandler('onResourceStop', function(resourceName) + if (GetCurrentResourceName() ~= resourceName) then return end + for _, entity in pairs(entity_ids) do + if DoesEntityExist(entity) then + DeleteEntity(entity) + end + end +end) \ No newline at end of file diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..d82b8e8 --- /dev/null +++ b/config.lua @@ -0,0 +1,9 @@ +Config = {} + +Config.SpawnCommand = 'spawnprops' +Config.DeleteCommand = 'deleteprops' + +Config.PropLocations = { + [1] = { coords = vector4(-1652.76, -3143.40, 13.99, 76), model = `YOURPROPNAMEHERE` }, + [2] = { coords = vector4(-1658.76, -3143.40, 13.99, 76), model = `YOURPROPNAMEHERE` }, +} \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua new file mode 100644 index 0000000..e501509 --- /dev/null +++ b/fxmanifest.lua @@ -0,0 +1,21 @@ +Description 'ngd-propspawner | Nemesis Gaming Development' +author 'deluce#9077' +fx_version 'cerulean' +game 'gta5' + +shared_scripts { + "config.lua", + +} + +client_scripts { + 'client/*.lua', + } + + +lua54 'yes' + + + + +