Editable Files

server/editable.lua

tgiCore = tgiCoreExports:getCore()

RegisterServerEvent('tgiann-drone:connectionLost')
AddEventHandler('tgiann-drone:connectionLost', function(index, coord)
    local src = source
    if not activeDrones[src] then return end
    local oldValue = GlobalState.tgidrone
    local key = os.time()
    oldValue[key] = {
        index = index,
        coord = coord
    }
    GlobalState:set('tgidrone', oldValue, true)
end)

RegisterServerEvent('tgiann-drone:removeActiveDrone')
AddEventHandler('tgiann-drone:removeActiveDrone', function(giveIndex)
    local src = source
    activeDrones[src] = nil
    if giveIndex then
        local configData = config.drones[giveIndex]
        local xPlayer = tgiCore.getPlayer(src)
        tgiCore.addItem(xPlayer, configData.itemname, 1)
    end
end)

client/editable.lua

function open()
    TriggerEvent("tgiann-hud:ui", false)
end

function stopAnim()
	StopAnimTask(PlayerPedId(), "amb@code_human_in_bus_passenger_idles@female@tablet@idle_a", "idle_a" ,8.0, -8.0, -1, 49, 0, false, false, false)
    if DoesEntityExist(tab) then tgiCore.deleteObject(tab) end
end

function attachObject()
    local model = `prop_cs_tablet`
    DroneRequestModel(model)
    tab = CreateObject(model, 0.0, 0.0, 0.0, true, false, true)
	AttachEntityToEntity(tab, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), -0.05, 0.0, 0.0, 0.0, 0.0, 0.0, true, true, false, true, 1, true)
	SetModelAsNoLongerNeeded(model)
end

function startAnim()
    RequestAnimDict("amb@code_human_in_bus_passenger_idles@female@tablet@idle_a")
    while not HasAnimDictLoaded("amb@code_human_in_bus_passenger_idles@female@tablet@idle_a") do Wait(0) end
    attachObject()
    TaskPlayAnim(PlayerPedId(), "amb@code_human_in_bus_passenger_idles@female@tablet@idle_a", "idle_a" ,8.0, -8.0, -1, 49, 0, false, false, false)
end

language files

config.langs.en = {
    direction = "Direction",
    camera = "Camera",
    height = "Height",
    zoom = "Zoom in/out",
    nightvision = "Night vision",
    infared = "Infared",
    home = "Return Home",
    homecancel = "Cancel",
    disconnect = "Disconnect",
    droneBack = "Drone is back",
    droneExplode = "Drone is destroyed",
    disconnected = "Drone disconnected",
    timeUse = "You can use it after %s seconds",
    takeDrone = "[E] Take Drone",
    noSlot = "Not enough space in your inventory",
    uCantUse = "You cannot use this drone!",
    needOnDuty = "You need to be on duty to use the drone!"
}

Last updated