Skip to content

Instantly share code, notes, and snippets.

@nona-takahara
Created June 19, 2021 00:47
Show Gist options
  • Save nona-takahara/b4266b930fcfce06ba4ea80be59f684b to your computer and use it in GitHub Desktop.
Save nona-takahara/b4266b930fcfce06ba4ea80be59f684b to your computer and use it in GitHub Desktop.
function onCustomCommand(full_message, user_peer_id, is_admin, is_auth, command, arg1, arg2, arg3, arg4, arg5)
if command == "?spawnLocation" and is_admin == true then
local addon_index = server.getAddonIndex()
server.spawnAddonLocation(matrix.translation(arg2,arg3,arg4), addon_index, (server.getLocationIndex(addon_index, arg1)))
end
if command == "?spawnAll" and is_admin == true then
local addon_index = server.getAddonIndex()
k={"oneill_airbase","oneill_north","oneill_delta","north_lake","north_harbour"}
for i=1,#k do
server.spawnAddonLocation(matrix.translation(arg1,arg2,arg3),addon_index,(server.getLocationIndex(addon_index,k[i])))
end
end
if command == "?despawn" and is_admin == true then
for id, object in pairs(g_savedata.mission_objects) do
if(object[type] == vehicle)
then
server.despawnVehicle(id, true)
else
server.despawnObject(id, true)
end
end
g_savedata.mission_objects={}
end
end
function onSpawnAddonComponent(id, name, type, addon_index)
if (addon_index == server.getAddonIndex())
then
if g_savedata.mission_objects==nil then
g_savedata.mission_objects={}
end
g_savedata.mission_objects[id] = {[name] = name, [type] = type}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment