init
This commit is contained in:
commit
c975380b60
40
client/client.lua
Normal file
40
client/client.lua
Normal file
@ -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)
|
9
config.lua
Normal file
9
config.lua
Normal file
@ -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` },
|
||||
}
|
21
fxmanifest.lua
Normal file
21
fxmanifest.lua
Normal file
@ -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'
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user