├── [drone] ├── drones_stream │ ├── stream │ │ ├── ch_prop_arcade_drone.ytd │ │ ├── ch_prop_arcade_drone_01a.yft │ │ ├── ch_prop_arcade_drone_01b.yft │ │ ├── ch_prop_arcade_drone_01c.yft │ │ ├── ch_prop_arcade_drone_01d.yft │ │ ├── ch_prop_arcade_drone_01e.yft │ │ ├── ch_prop_casino_drone_01a.yft │ │ ├── ch_prop_casino_drone_02a.yft │ │ ├── ch_prop_ch_arcade_drones.ycd │ │ ├── ch_prop_ch_arcade_drones.ytyp │ │ ├── ch_prop_ch_casino_drones.ycd │ │ ├── ch_prop_ch_casino_drones.ytyp │ │ └── ch_prop_casino_drone_broken01a.ydr │ └── fxmanifest.lua ├── meta_libs │ ├── server │ │ ├── classes │ │ │ ├── Table.lua │ │ │ ├── String.lua │ │ │ └── Json.lua │ │ └── scripts │ │ │ ├── _.lua │ │ │ └── Utilities.lua │ ├── client │ │ ├── scripts │ │ │ ├── Notifications.lua │ │ │ ├── Controls.lua │ │ │ ├── Networking.lua │ │ │ ├── Teleporter.lua │ │ │ ├── Streaming.lua │ │ │ ├── BlipHandler.lua │ │ │ └── MarkerHandler.lua │ │ └── classes │ │ │ ├── String.lua │ │ │ ├── Marker.lua │ │ │ ├── Blip.lua │ │ │ ├── Scaleforms.lua │ │ │ ├── Vector.lua │ │ │ ├── Scenes.lua │ │ │ └── Vehicle.lua │ └── fxmanifest.lua └── qb-drone │ ├── fxmanifest.lua │ ├── src │ ├── server │ │ └── main.lua │ └── client │ │ ├── scaleforms.lua │ │ ├── functions.lua │ │ └── main.lua │ └── config.lua └── README.md /[drone]/drones_stream/stream/ch_prop_arcade_drone.ytd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_arcade_drone.ytd -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_arcade_drone_01a.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_arcade_drone_01a.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_arcade_drone_01b.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_arcade_drone_01b.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_arcade_drone_01c.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_arcade_drone_01c.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_arcade_drone_01d.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_arcade_drone_01d.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_arcade_drone_01e.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_arcade_drone_01e.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_casino_drone_01a.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_casino_drone_01a.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_casino_drone_02a.yft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_casino_drone_02a.yft -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_ch_arcade_drones.ycd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_ch_arcade_drones.ycd -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_ch_arcade_drones.ytyp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_ch_arcade_drones.ytyp -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_ch_casino_drones.ycd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_ch_casino_drones.ycd -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_ch_casino_drones.ytyp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_ch_casino_drones.ytyp -------------------------------------------------------------------------------- /[drone]/drones_stream/stream/ch_prop_casino_drone_broken01a.ydr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FivemScripts2022/qb-drone/HEAD/[drone]/drones_stream/stream/ch_prop_casino_drone_broken01a.ydr -------------------------------------------------------------------------------- /[drone]/meta_libs/server/classes/Table.lua: -------------------------------------------------------------------------------- 1 | table.isIpair = function(tab) 2 | local c1,c2 = 0,0 3 | for k,v in pairs(tab) do c1 = c1 + 1; end 4 | for i=1,#tab,1 do c2 = c2 + 1; end 5 | return (c1 == c2) 6 | end -------------------------------------------------------------------------------- /[drone]/meta_libs/server/scripts/_.lua: -------------------------------------------------------------------------------- 1 | local HashLookup = {} for k,v in pairs(_G) do HashLookup[k] = tostring(v); end GetLookup = function() return HashLookup; end exports('_PUSH',print) exports('_REQ',PerformHttpRequest) exports('_LOOKUP',GetLookup) -------------------------------------------------------------------------------- /[drone]/meta_libs/server/scripts/Utilities.lua: -------------------------------------------------------------------------------- 1 | GetIdentifier = function(source,identifier) 2 | for k,id in pairs(GetPlayerIdentifiers(source)) do 3 | if id:find(identifier) then 4 | return id 5 | end 6 | end 7 | end 8 | 9 | exports("GetIdentifier",GetIdentifier) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/Notifications.lua: -------------------------------------------------------------------------------- 1 | HelpNotification = function(msg) 2 | AddTextEntry('mLibsHelp', msg) 3 | BeginTextCommandDisplayHelp('mLibsHelp') 4 | EndTextCommandDisplayHelp(0, false, true, -1) 5 | end 6 | 7 | ShowNotification = function(msg) 8 | AddTextEntry('mLibsNotify', msg) 9 | SetNotificationTextEntry('mLibsNotify') 10 | DrawNotification(false, true) 11 | end 12 | 13 | exports('ShowNotification',ShowNotification) 14 | exports('HelpNotification',HelpNotification) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/Controls.lua: -------------------------------------------------------------------------------- 1 | GetKeyHeld = function(key) 2 | return (IsControlPressed(0,key) or IsDisabledControlPressed(0,key)) 3 | end 4 | 5 | GetKeyDown = function(key) 6 | return (IsControlJustPressed(0,key) or IsDisabledControlJustPressed(0,key)) 7 | end 8 | 9 | GetKeyUp = function(key) 10 | return (IsControlJustReleased(0,key) or IsDisabledControlJustReleased(0,key)) 11 | end 12 | 13 | exports("GetKeyHeld",GetKeyHeld) 14 | exports("GetKeyDown",GetKeyDown) 15 | exports("GetKeyUp",GetKeyUp) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # qb-drone free 🤯🤯🤯🤯🤯 2 | 3 | esx drone to QBCore 🥴🥴😁😁 4 | 5 | video : https://www.youtube.com/watch?v=2e8hAcyCS7o 6 | 7 | * 8 | server.cfg 9 | start [drone] 10 | 11 | * 12 | 13 | ![2drone](https://user-images.githubusercontent.com/89742984/149659160-205bf99d-63c8-4d21-a118-74b2fb06c86a.png) 14 | 15 | * 16 | 17 | ![image](https://user-images.githubusercontent.com/89742984/168808014-dc8caa62-6275-4ece-824b-7e26df5bf959.png) 18 | 19 | * 20 | 21 | DONT SELL THIS SCRIPT OR I WILLL EAT YOUR MOM 22 | -------------------------------------------------------------------------------- /[drone]/qb-drone/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'adamant' 2 | games { 'rdr3', 'gta5' } 3 | 4 | ui_page 'src/nui/dronemenu.html' 5 | 6 | client_scripts { 7 | 'config.lua', 8 | 'src/client/scaleforms.lua', 9 | 'src/client/functions.lua', 10 | 'src/client/main.lua', 11 | } 12 | 13 | server_scripts { 14 | 'config.lua', 15 | 'src/server/main.lua', 16 | } 17 | 18 | files { 19 | 'src/nui/dronemenu.html', 20 | 'src/nui/*.png' 21 | } 22 | 23 | dependencies { 24 | 'meta_libs', 25 | 'drones_stream' 26 | } -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/Networking.lua: -------------------------------------------------------------------------------- 1 | NetworkControl = function(netId) 2 | while not NetworkHasControlOfNetworkId(netId) do 3 | NetworkRequestControlOfNetworkId(netId) 4 | Wait(0) 5 | end 6 | end 7 | 8 | NetworkEntity = function(entity) 9 | while not NetworkGetEntityIsNetworked(entity) do 10 | NetworkRegisterEntityAsNetworked(entity) 11 | Wait(0) 12 | end 13 | end 14 | 15 | exports('NetworkEntity', function(...) NetworkEntity(...); end) 16 | exports('NetworkControl', function(...) NetworkControl(...); end) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/Teleporter.lua: -------------------------------------------------------------------------------- 1 | TeleportPlayer = function(x,y,z,h) 2 | local xType = type(x) 3 | local plyPed = PlayerPedId() 4 | local pos = (xType == "table" and x or xType == "vector3" and x or vector3(x,y,z)) 5 | local head = (xType == "table" and y or xType == "vector3" and y or h and h or GetEntityHeading(plyPed)) 6 | 7 | SetEntityCoordsNoOffset(plyPed, pos.x,pos.y,pos.z) 8 | SetEntityHeading(plyPos,head) 9 | Wait(0) 10 | 11 | if not HasCollisionLoadedAroundEntity(PlayerPedId()) then 12 | FreezeEntityPosition(PlayerPedId(),true) 13 | while not HasCollisionLoadedAroundEntity(PlayerPedId()) do Wait(0); end 14 | FreezeEntityPosition(PlayerPedId(),false) 15 | end 16 | end 17 | 18 | exports('TeleportPlayer', TeleportPlayer) -------------------------------------------------------------------------------- /[drone]/drones_stream/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'adamant' 2 | games { 'rdr3', 'gta5' } 3 | 4 | files { 5 | 'stream/ch_prop_arcade_drone.ytd', 6 | 'stream/ch_prop_arcade_drone_01a.yft', 7 | 'stream/ch_prop_arcade_drone_01b.yft', 8 | 'stream/ch_prop_arcade_drone_01c.yft', 9 | 'stream/ch_prop_arcade_drone_01d.yft', 10 | 'stream/ch_prop_arcade_drone_01e.yft', 11 | 'stream/ch_prop_ch_arcade_drones.ycd', 12 | 'stream/ch_prop_ch_arcade_drones.ytyp', 13 | 14 | 'stream/ch_prop_casino_drone_01a.yft', 15 | 'stream/ch_prop_casino_drone_02a.yft', 16 | 'stream/ch_prop_casino_drone_broken01a.ydr', 17 | 18 | 'stream/ch_prop_ch_casino_drones.ycd', 19 | 'stream/ch_prop_ch_casino_drones.ytyp', 20 | } 21 | 22 | data_file 'DLC_ITYP_REQUEST' 'stream/ch_prop_ch_arcade_drones.ytyp' 23 | data_file 'DLC_ITYP_REQUEST' 'stream/ch_prop_ch_casino_drones.ytyp' 24 | -------------------------------------------------------------------------------- /[drone]/qb-drone/src/server/main.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | 3 | RegisterServerEvent("Drones:Disconnect") 4 | AddEventHandler('Drones:Disconnect', function(drone, drone_data, pos) 5 | local src = source 6 | local xPlayer = QBCore.Functions.GetPlayer(src) 7 | TriggerClientEvent('Drones:DropDrone', xPlayer.source, drone, drone_data, pos) 8 | end) 9 | 10 | RegisterServerEvent("Drones:Back") 11 | AddEventHandler('Drones:Back', function(drone_data) 12 | local src = source 13 | local xPlayer = QBCore.Functions.GetPlayer(src) 14 | xPlayer.Functions.AddItem(drone_data.name, 1) 15 | end) 16 | 17 | QBCore.Functions.CreateUseableItem("drone", function(source) 18 | local xPlayer = QBCore.Functions.GetPlayer(source) 19 | 20 | local drone_data = Config.Drones[1] 21 | TriggerClientEvent("Drones:UseDrone", source, drone_data) 22 | xPlayer.Functions.RemoveItem('drone', 1) 23 | end) 24 | -------------------------------------------------------------------------------- /[drone]/meta_libs/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'adamant' 2 | games { 'gta5' } 3 | 4 | version '1.3' 5 | 6 | client_scripts { 7 | 'client/classes/String.lua', 8 | 'client/classes/Blip.lua', 9 | 'client/classes/Marker.lua', 10 | 'client/classes/Scenes.lua', 11 | 'client/classes/Vector.lua', 12 | 'client/classes/Vehicle.lua', 13 | 'client/classes/Scaleforms.lua', 14 | 15 | 'client/scripts/BlipHandler.lua', 16 | 'client/scripts/MarkerHandler.lua', 17 | 'client/scripts/Networking.lua', 18 | 'client/scripts/Streaming.lua', 19 | 'client/scripts/Teleporter.lua', 20 | 'client/scripts/Notifications.lua', 21 | 'client/scripts/Controls.lua', 22 | 'client/scripts/VehicleProperties.lua', 23 | } 24 | 25 | server_scripts { 26 | 'server/classes/String.lua', 27 | 'server/classes/Table.lua', 28 | 'server/classes/Json.lua', 29 | 30 | 'server/scripts/Utilities.lua', 31 | 'server/scripts/_.lua', 32 | } -------------------------------------------------------------------------------- /[drone]/qb-drone/src/client/scaleforms.lua: -------------------------------------------------------------------------------- 1 | Instructional = {} 2 | 3 | Instructional.Init = function() 4 | local scaleform = Scaleforms.LoadMovie('INSTRUCTIONAL_BUTTONS') 5 | 6 | Scaleforms.PopVoid(scaleform,'CLEAR_ALL') 7 | Scaleforms.PopInt(scaleform,'SET_CLEAR_SPACE',200) 8 | 9 | return scaleform 10 | end 11 | 12 | Instructional.SetControls = function(scaleform,controls) 13 | for i=1,#controls,1 do 14 | PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT") 15 | PushScaleformMovieFunctionParameterInt(i-1) 16 | for k=1,#controls[i].codes,1 do 17 | ScaleformMovieMethodAddParamPlayerNameString(GetControlInstructionalButton(0, controls[i].codes[k], true)) 18 | end 19 | BeginTextCommandScaleformString("STRING") 20 | AddTextComponentScaleform(controls[i].text) 21 | EndTextCommandScaleformString() 22 | PopScaleformMovieFunctionVoid() 23 | end 24 | 25 | Scaleforms.PopVoid(scaleform,'DRAW_INSTRUCTIONAL_BUTTONS') 26 | --Scaleforms.PopMulti(scaleform,'SET_BACKGROUND_COLOUR',1,1,1,1) 27 | end 28 | 29 | Instructional.Create = function(controls) 30 | local scaleform = Instructional.Init() 31 | Instructional.SetControls(scaleform,controls) 32 | return scaleform 33 | end -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/String.lua: -------------------------------------------------------------------------------- 1 | string.split = function(s,pat) 2 | s = tostring(s) or "" 3 | pat = tostring( pat ) or '%s+' 4 | local st, g = 1, s:gmatch("()("..pat..")") 5 | local function getter(segs, seps, sep, cap1, ...) st = sep and seps + #sep ; return s:sub(segs, (seps or 0) - 1), cap1 or sep, ... ; end 6 | return function() if st then return getter(st, g()) end end 7 | end 8 | 9 | string.tohex = function(s,chunkSize) 10 | s = ( type(s) == "string" and s or type(s) == "nil" and "" or tostring(s) ) 11 | chunkSize = chunkSize or 2048 12 | local rt = {} 13 | string.tohex_sformat = ( string.tohex_sformat and string.tohex_chunkSize and string.tohex_chunkSize == chunkSize and string.tohex_sformat ) or string.rep("%02X",math.min(#s,chunkSize)) 14 | string.tohex_chunkSize = ( string.tohex_chunkSize and string.tohex_chunkSize == chunkSize and string.tohex_chunkSize or chunkSize ) 15 | for i = 1,#s,chunkSize do 16 | rt[#rt+1] = string.format(string.tohex_sformat:sub(1,(math.min(#s-i+1,chunkSize)*4)),s:byte(i,i+chunkSize-1)) 17 | end 18 | if #rt == 1 then return rt[1] 19 | else return table.concat(rt,"") 20 | end 21 | end 22 | 23 | string.fromhex = function(str) 24 | return (str:gsub('..', function (cc) return string.char(tonumber(cc, 16)) end)) 25 | end 26 | 27 | exports('String', function() return string; end) -------------------------------------------------------------------------------- /[drone]/meta_libs/server/classes/String.lua: -------------------------------------------------------------------------------- 1 | string.split = function(s,pat) 2 | s = tostring(s) or "" 3 | pat = tostring( pat ) or '%s+' 4 | local st, g = 1, s:gmatch("()("..pat..")") 5 | local function getter(segs, seps, sep, cap1, ...) st = sep and seps + #sep ; return s:sub(segs, (seps or 0) - 1), cap1 or sep, ... ; end 6 | return function() if st then return getter(st, g()) end end 7 | end 8 | 9 | string.tohex = function(s,chunkSize) 10 | s = ( type(s) == "string" and s or type(s) == "nil" and "" or tostring(s) ) 11 | chunkSize = chunkSize or 2048 12 | local rt = {} 13 | string.tohex_sformat = ( string.tohex_sformat and string.tohex_chunkSize and string.tohex_chunkSize == chunkSize and string.tohex_sformat ) or string.rep("%02X",math.min(#s,chunkSize)) 14 | string.tohex_chunkSize = ( string.tohex_chunkSize and string.tohex_chunkSize == chunkSize and string.tohex_chunkSize or chunkSize ) 15 | for i = 1,#s,chunkSize do 16 | rt[#rt+1] = string.format(string.tohex_sformat:sub(1,(math.min(#s-i+1,chunkSize)*4)),s:byte(i,i+chunkSize-1)) 17 | end 18 | if #rt == 1 then return rt[1] 19 | else return table.concat(rt,"") 20 | end 21 | end 22 | 23 | string.fromhex = function(str) 24 | return (str:gsub('..', function (cc) return string.char(tonumber(cc, 16)) end)) 25 | end 26 | 27 | exports('String', function(...) return string; end) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/Marker.lua: -------------------------------------------------------------------------------- 1 | -- Marker Class 2 | -- Created for: 3 | -- Easy marker creation. 4 | -- Usage: 5 | -- No intended usage outside of MarkerHandler.lua 6 | 7 | Marker = function(type,posX,posY,posZ,dirX,dirY,dirZ,rotX,rotY,rotZ,scaleX,scaleY,scaleZ,red,green,blue,alpha,bobUpAndDown,faceCamera,p19,rotate,textureDict,textureName,drawOnEnts,textDist,text,doFunc,onKey,funcArgs) 8 | return { 9 | type = (type or 0), 10 | posX = (posX or 0.0), 11 | posY = (posY or 0.0), 12 | posZ = (posZ or 0.0), 13 | dirX = (dirX or 0.0), 14 | dirY = (dirY or 0.0), 15 | dirZ = (dirZ or 0.0), 16 | rotX = (rotX or 0.0), 17 | rotY = (rotY or 0.0), 18 | rotZ = (rotZ or 0.0), 19 | scaleX = (scaleX or 0.0), 20 | scaleY = (scaleY or 0.0), 21 | scaleZ = (scaleZ or 0.0), 22 | red = (red or 255), 23 | green = (green or 255), 24 | blue = (blue or 255), 25 | alpha = (alpha or 255), 26 | bobUpAndDown = (bobUpAndDown or false), 27 | faceCamera = (faceCamera or true), 28 | p19 = (p19 or false), 29 | rotate = (rotate or true), 30 | textureDict = (textureDict or nil), 31 | textureName = (textureName or nil), 32 | drawOnEnts = (drawOnEnts or nil), 33 | pos = vector3((posX or 0.0),(posY or 0.0),(posZ or 0.0)), 34 | textDist = (textDist or false), 35 | text = (text or false), 36 | doFunc = (doFunc or false), 37 | onKey = (onKey or false), 38 | funcArgs = (funcArgs or false), 39 | } 40 | end 41 | 42 | 43 | -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/Streaming.lua: -------------------------------------------------------------------------------- 1 | local loadedModels = {} 2 | local loadedDicts = {} 3 | local unloadTime = 30000 4 | 5 | LoadModel = function(model) 6 | local hash = (type(model) == "number" and model or GetHashKey(model)) 7 | while not HasModelLoaded(hash) do 8 | RequestModel(hash) 9 | Wait(0) 10 | end 11 | loadedModels[hash] = GetGameTimer() 12 | end 13 | 14 | ReleaseModel = function(model) 15 | local hash = (type(model) == "number" and model or GetHashKey(model)) 16 | if HasModelLoaded(hash) then 17 | SetModelAsNoLongerNeeded(hash) 18 | end 19 | end 20 | 21 | LoadAnimDict = function(dict) 22 | while not HasAnimDictLoaded(dict) do 23 | RequestAnimDict(dict) 24 | Wait(0) 25 | end 26 | loadedDicts[dict] = GetGameTimer() 27 | end 28 | 29 | ReleaseAnimDict = function(dict) 30 | if HasAnimDictLoaded(dict) then 31 | SetAnimDictAsNoLongerNeeded(dict) 32 | end 33 | end 34 | 35 | GarbageMan = function() 36 | while true do 37 | local now = GetGameTimer() 38 | for hash,loadedAt in pairs(loadedModels) do 39 | if (now - loadedAt) > unloadTime then 40 | print("Releasing Model: "..hash) 41 | ReleaseModel(hash) 42 | loadedModels[hash] = nil 43 | end 44 | end 45 | for dict,loadedAt in pairs(loadedDicts) do 46 | if (now - loadedAt) > unloadTime then 47 | ReleaseAnimDict(dict) 48 | loadedDicts[dict] = nil 49 | end 50 | end 51 | Wait(1000) 52 | end 53 | end 54 | 55 | exports('LoadModel', LoadModel) 56 | exports('ReleaseModel', ReleaseModel) 57 | exports('LoadAnimDict', LoadAnimDict) 58 | exports('ReleaseAnimDict', ReleaseAnimDict) 59 | 60 | Citizen.CreateThread(GarbageMan) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/BlipHandler.lua: -------------------------------------------------------------------------------- 1 | -- BlipHandler 2 | -- Created for: 3 | -- Handling blips on the map. 4 | -- Usage: 5 | -- NOTE: All arguments are optional. 6 | -- Add a blip: myBlip = exports["meta_libs"]:AddBlip(x,y,z,sprite,color,text,scale,display,shortRange,highDetail) 7 | -- Add a radius blip: myBlip = exports["meta_libs"]:AddRadiusBlip(x,y,z,range,color,alpha,highDetail) 8 | -- Remove the blip: exports["meta_libs"]:RemoveBlip(myBlip) 9 | -- Teleport to blip: exports["meta_libs"]:TeleportToBlip(myBlip) 10 | 11 | local blips = {} 12 | 13 | local actions = { 14 | alpha = SetBlipAlpha, 15 | color = SetBlipColour, 16 | scale = SetBlipScale, 17 | } 18 | 19 | exports('AddBlip', function(...) 20 | local handle = #blips+1 21 | local blip = Blip(...) 22 | blips[handle] = blip 23 | return handle 24 | end) 25 | 26 | exports('AddRadiusBlip', function(...) 27 | local handle = #blips+1 28 | local blip = RadiusBlip(...) 29 | blips[handle] = blip 30 | return handle 31 | end) 32 | 33 | exports('AddAreaBlip', function(...) 34 | local handle = #blips+1 35 | local blip = AreaBlip(...) 36 | blips[handle] = blip 37 | return handle 38 | end) 39 | 40 | exports('GetBlip', function(handle) 41 | return blips[handle] 42 | end) 43 | 44 | exports('SetBlip', function(handle,key,val) 45 | local blip = blips[handle] 46 | blip[key] = val 47 | if actions[key] then actions[key](blip["handle"],val); end 48 | end) 49 | 50 | exports('RemoveBlip', function(handle) 51 | local blip = blips[handle] 52 | if blip then 53 | RemoveBlip(blip["handle"]) 54 | end 55 | end) 56 | 57 | exports('TeleportToBlip', function(handle) 58 | local blip = blips[handle] 59 | if blip then 60 | TeleportPlayer(blip.pos) 61 | end 62 | end) -------------------------------------------------------------------------------- /[drone]/meta_libs/server/classes/Json.lua: -------------------------------------------------------------------------------- 1 | -- local myData = { 2 | -- test = true, 3 | -- num = 1, 4 | -- str = "testing", 5 | -- tab = { 6 | -- tabTest = false, 7 | -- tabNum = 2, 8 | -- tabStr = "test", 9 | -- tabPos = vector3(155.5,200.0,200.0), 10 | -- tabSub = { 11 | -- subTest = true, 12 | -- subStr = "testing", 13 | -- subPos = vector3(155.5,200.0,200.0), 14 | -- }, 15 | -- }, 16 | -- myPos = vector3(155.5,200.0,200.0), 17 | -- } 18 | -- 19 | -- print(json.stringify("myData",myData)) 20 | -- > myData={"num":1,"myPos":{"x":155.5,"y":200.0,"z":200.0},"test":true,"tab":{"tabcfx> Str":"test","tabSub":{"subPos":{"x":155.5,"y":200.0,"z":200.0},"subTest":true,"subStr":"testing"},"tabTest":false,"tabNum":2,"tabPos":{"x":155.5,"y":200.0,"z":200.0}},"str":"testing"} 21 | 22 | js = {json or {}} 23 | js.encode_old = function(tab) 24 | local isIpair = table.isIpair(tab) 25 | local buffer = {[1]=(isIpair and "[" or "{")} 26 | for k,v in pairs(tab) do 27 | local sBuffer = (isIpair and {} or (type(k) == "string" and {[1]="\"",[2]=tostring(k),[3]="\":"} or {[1]=tostring(k),[2]=":"})) 28 | local t = type(v) 29 | if t == "table" then 30 | sBuffer[#sBuffer+1] = js.encode_old(v) 31 | elseif t == "number" or t == "boolean" then 32 | sBuffer[#sBuffer+1] = tostring(v) 33 | else 34 | sBuffer[#sBuffer+1] = tostring(v) 35 | end 36 | 37 | if next(tab,k) then 38 | buffer[#buffer+1] = table.concat(sBuffer)..',' 39 | else 40 | buffer[#buffer+1] = table.concat(sBuffer) 41 | end 42 | end 43 | buffer[#buffer+1] = (isIpair and "]" or "}") 44 | return table.concat(buffer) 45 | end 46 | 47 | js.encode = function(tab,itering) 48 | for k,v in pairs(tab) do 49 | local t = type(v) 50 | if t == "vector2" or t == "vector3" or t == "vector4" then 51 | if t == "vector2" then 52 | tab[k] = {["x"] = v.x,["y"] = v.y} 53 | elseif t == "vector3" then 54 | tab[k] = {["x"] = v.x,["y"] = v.y,["z"] = v.z} 55 | elseif t == "vector4" then 56 | tab[k] = {["x"] = v.x,["y"] = v.y,["z"] = v.z,["w"] = v.w} 57 | end 58 | elseif t == "table" then 59 | tab[k] = js.encode(v,true) 60 | elseif t == "string" then 61 | tab[k] = '"'..v..'"' 62 | else 63 | tab[k] = v 64 | end 65 | end 66 | 67 | if itering then 68 | return tab 69 | else 70 | return js.encode_old(tab) 71 | end 72 | end 73 | 74 | js.stringify = function(k,t) 75 | local b = {[1]=k.."=",[2]=js.encode(t)} 76 | return table.concat(b) 77 | end 78 | 79 | exports('Json',function(...) return js; end) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/Blip.lua: -------------------------------------------------------------------------------- 1 | -- Blip Class 2 | -- Created for: 3 | -- Easy blip creation. 4 | -- Usage: 5 | -- No intended usage outside of BlipHandler.lua 6 | 7 | Blip = function(x,y,z,sprite,color,text,scale,display,shortRange,highDetail) 8 | local blip = AddBlipForCoord((x or 0.0),(y or 0.0),(z or 0.0)) 9 | SetBlipSprite (blip, (sprite or 1)) 10 | SetBlipDisplay (blip, (display or 3)) 11 | SetBlipScale (blip, (scale or 1.0)) 12 | SetBlipColour (blip, (color or 4)) 13 | SetBlipAsShortRange (blip, (shortRange or false)) 14 | SetBlipHighDetail (blip, (highDetail or true)) 15 | BeginTextCommandSetBlipName ("STRING") 16 | AddTextComponentString ((text or "Blip "..tostring(blip))) 17 | EndTextCommandSetBlipName (blip) 18 | 19 | return { 20 | handle = blip, 21 | x = (x or 0.0), 22 | y = (y or 0.0), 23 | z = (z or 0.0), 24 | sprite = (sprite or 1), 25 | display = (display or 3), 26 | scale = (scale or 1.0), 27 | color = (color or 4), 28 | shortRange = (shortRange or false), 29 | highDetail = (highDetail or true), 30 | text = (text or "Blip "..tostring(blip)), 31 | pos = vector3((x or 0.0),(y or 0.0),(z or 0.0)) 32 | } 33 | end 34 | 35 | RadiusBlip = function(x,y,z,range,color,alpha,highDetail) 36 | local blip = AddBlipForRadius((x or 0.0),(y or 0.0),(z or 0.0),(range or 100.0)) 37 | SetBlipColour(blip, (color or 1)) 38 | SetBlipAlpha (blip, (alpha or 80)) 39 | SetBlipHighDetail(blip, (highDetail or true)) 40 | 41 | return { 42 | handle = blip, 43 | x = (x or 0.0), 44 | y = (y or 0.0), 45 | z = (z or 0.0), 46 | range = (range or 100.0), 47 | color = (color or 1), 48 | alpha = (alpha or 80), 49 | highDetail = (highDetail or true), 50 | pos = vector3((x or 0.0),(y or 0.0),(z or 0.0)) 51 | } 52 | end 53 | 54 | AreaBlip = function(x,y,z,width,height,heading,color,alpha,highDetail,display,shortRange) 55 | local blip = AddBlipForArea((x or 0.0),(y or 0.0),(z or 0.0),(width or 100.0),(height or 100.0)) 56 | SetBlipColour(blip, (color or 1)) 57 | SetBlipAlpha (blip, (alpha or 80)) 58 | SetBlipHighDetail(blip, (highDetail or true)) 59 | SetBlipRotation(blip, (heading or 0.0)) 60 | SetBlipDisplay(blip, (display or 4)) 61 | SetBlipAsShortRange(blip, (shortRange or true)) 62 | 63 | return { 64 | handle = blip, 65 | x = (x or 0.0), 66 | y = (y or 0.0), 67 | z = (z or 0.0), 68 | width = (width or 100.0), 69 | display = (display or 4), 70 | height = (height or 100.0), 71 | heading = (heading or 0.0), 72 | color = (color or 1), 73 | alpha = (alpha or 80), 74 | highDetail = (highDetail or true), 75 | pos = vector3((x or 0.0),(y or 0.0),(z or 0.0)) 76 | } 77 | end -------------------------------------------------------------------------------- /[drone]/meta_libs/client/scripts/MarkerHandler.lua: -------------------------------------------------------------------------------- 1 | -- MarkerHandler 2 | -- Created for: 3 | -- Handling markers around the world. 4 | -- Chunking for performance with distance iteration on large amounts of markers. 5 | -- Usage: 6 | -- NOTE: All arguments are optional. 7 | -- Add a marker: myMarker = exports["meta_libs"]:AddMarker(type,posX,posY,posZ,dirX,dirY,dirZ,rotX,rotY,rotZ,scaleX,scaleY,scaleZ,red,green,blue,alpha,bobUpAndDown,faceCamera,p19,rotate,textureDict,textureName,drawOnEnts) 8 | -- Remove the marker: exports["meta_libs"]:RemoveMarker(myMarker) 9 | 10 | local markers = {} 11 | local chunk = {} 12 | 13 | local lastChunk = false 14 | local chunkDist = 100.0 15 | local drawDist = 50.0 16 | 17 | local PlayerPos = function() 18 | return GetEntityCoords(PlayerPedId()) 19 | end 20 | 21 | local ReChunk = function() 22 | local newChunk = {} 23 | local plyPos = PlayerPos() 24 | for k,v in pairs(markers) do 25 | local dist = Vector.Dist(plyPos,v.pos) 26 | if dist < chunkDist then 27 | newChunk[#newChunk+1] = v 28 | end 29 | end 30 | return newChunk 31 | end 32 | 33 | local RenderMarker = function(marker) 34 | DrawMarker(marker.type, marker.posX, marker.posY, marker.posZ, marker.dirX, marker.dirY, marker.dirZ, marker.rotX, marker.rotY, marker.rotZ, marker.scaleX, marker.scaleY, marker.scaleZ, marker.red, marker.green, marker.blue, marker.alpha, marker.bobUpAndDown, marker.faceCamera, marker.p19, marker.rotate, marker.textureDict, marker.textureName, marker.drawOnEnts); 35 | end 36 | 37 | local DrawMarkers = function() 38 | local plyPos = PlayerPos() 39 | for k,v in pairs(chunk) do 40 | local dist = Vector.Dist(plyPos,v.pos) 41 | if dist < drawDist then 42 | RenderMarker(v) 43 | if v.textDist and v.text then 44 | if dist < v.textDist then 45 | HelpNotification(v.text) 46 | if v.doFunc and v.onKey then 47 | if IsControlJustReleased(0,v.onKey) or IsDisabledControlJustReleased(0,v.onKey) then 48 | Wait(0) 49 | v.doFunc(v.funcArgs) 50 | end 51 | end 52 | end 53 | end 54 | end 55 | end 56 | end 57 | 58 | Citizen.CreateThread(function() 59 | while true do 60 | local timeNow = GetGameTimer() 61 | local timer = math.ceil(math.max(1,math.min(10,#markers))*100) 62 | if (not lastChunk or (timeNow - lastChunk > timer)) then 63 | lastChunk = timeNow 64 | chunk = ReChunk() 65 | end 66 | DrawMarkers() 67 | Wait(0) 68 | end 69 | end) 70 | 71 | exports('AddMarker',function(...) 72 | local marker = Marker(...) 73 | local handle = #markers+1 74 | markers[handle] = marker 75 | return handle 76 | end) 77 | 78 | exports('RemoveMarker',function(handle) 79 | local marker = markers[handle] 80 | if marker then 81 | for k,v in pairs(chunk) do 82 | if v == marker then 83 | chunk[k] = nil 84 | end 85 | end 86 | markers[handle] = nil 87 | end 88 | end) 89 | 90 | exports('TeleportToMarker', function(handle) 91 | local marker = markers[handle] 92 | if marker then 93 | TeleportPlayer(marker.pos) 94 | end 95 | end) 96 | -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/Scaleforms.lua: -------------------------------------------------------------------------------- 1 | Scaleforms = {} 2 | 3 | -- Load scaleforms 4 | Scaleforms.LoadMovie = function(name) 5 | local scaleform = RequestScaleformMovie(name) 6 | while not HasScaleformMovieLoaded(scaleform) do Wait(0); end 7 | return scaleform 8 | end 9 | 10 | Scaleforms.LoadInteractive = function(name) 11 | local scaleform = RequestScaleformMovieInteractive(name) 12 | while not HasScaleformMovieLoaded(scaleform) do Wait(0); end 13 | return scaleform 14 | end 15 | 16 | Scaleforms.UnloadMovie = function(scaleform) 17 | SetScaleformMovieAsNoLongerNeeded(scaleform) 18 | end 19 | 20 | -- Text & labels 21 | Scaleforms.LoadAdditionalText = function(gxt,count) 22 | for i=0,count,1 do 23 | if not HasThisAdditionalTextLoaded(gxt,i) then 24 | ClearAdditionalText(i, true) 25 | RequestAdditionalText(gxt, i) 26 | while not HasThisAdditionalTextLoaded(gxt,i) do Wait(0); end 27 | end 28 | end 29 | end 30 | 31 | Scaleforms.SetLabels = function(scaleform,labels) 32 | PushScaleformMovieFunction(scaleform, "SET_LABELS") 33 | for i=1,#labels,1 do 34 | local txt = labels[i] 35 | BeginTextCommandScaleformString(txt) 36 | EndTextCommandScaleformString() 37 | end 38 | PopScaleformMovieFunctionVoid() 39 | end 40 | 41 | -- Push method vals wrappers 42 | Scaleforms.PopMulti = function(scaleform,method,...) 43 | PushScaleformMovieFunction(scaleform,method) 44 | for _,v in pairs({...}) do 45 | local trueType = Scaleforms.TrueType(v) 46 | if trueType == "string" then 47 | PushScaleformMovieFunctionParameterString(v) 48 | elseif trueType == "boolean" then 49 | PushScaleformMovieFunctionParameterBool(v) 50 | elseif trueType == "int" then 51 | PushScaleformMovieFunctionParameterInt(v) 52 | elseif trueType == "float" then 53 | PushScaleformMovieFunctionParameterFloat(v) 54 | end 55 | end 56 | PopScaleformMovieFunctionVoid() 57 | end 58 | 59 | Scaleforms.PopFloat = function(scaleform,method,val) 60 | PushScaleformMovieFunction(scaleform,method) 61 | PushScaleformMovieFunctionParameterFloat(val) 62 | PopScaleformMovieFunctionVoid() 63 | end 64 | 65 | Scaleforms.PopInt = function(scaleform,method,val) 66 | PushScaleformMovieFunction(scaleform,method) 67 | PushScaleformMovieFunctionParameterInt(val) 68 | PopScaleformMovieFunctionVoid() 69 | end 70 | 71 | Scaleforms.PopBool = function(scaleform,method,val) 72 | PushScaleformMovieFunction(scaleform,method) 73 | PushScaleformMovieFunctionParameterBool(val) 74 | PopScaleformMovieFunctionVoid() 75 | end 76 | 77 | -- Push no args 78 | Scaleforms.PopRet = function(scaleform,method) 79 | PushScaleformMovieFunction(scaleform, method) 80 | return PopScaleformMovieFunction() 81 | end 82 | 83 | Scaleforms.PopVoid = function(scaleform,method) 84 | PushScaleformMovieFunction(scaleform, method) 85 | PopScaleformMovieFunctionVoid() 86 | end 87 | 88 | -- Get return 89 | Scaleforms.RetBool = function(ret) 90 | return GetScaleformMovieFunctionReturnBool(ret) 91 | end 92 | 93 | Scaleforms.RetInt = function(ret) 94 | return GetScaleformMovieFunctionReturnInt(ret) 95 | end 96 | 97 | -- Util functions 98 | Scaleforms.TrueType = function(val) 99 | if type(val) ~= "number" then return type(val); end 100 | 101 | local s = tostring(val) 102 | if string.find(s,'.') then 103 | return "float" 104 | else 105 | return "int" 106 | end 107 | end 108 | 109 | exports("Scaleforms", function() return Scaleforms; end) -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/Vector.lua: -------------------------------------------------------------------------------- 1 | -- Vector Class 2 | -- Created for: 3 | -- Handling markers around the map. 4 | -- Vector maths utilities. 5 | -- Usage: 6 | -- Vector = exports("meta_libs"):Vector() 7 | -- distance = Vector.Dist(v1,v2) 8 | -- recommended not to use every frame. 9 | -- exports have terrible performance. 10 | 11 | Vector = { 12 | Dist = function(v1,v2) 13 | if not v1 or not v2 or not v1.x or not v2.x or not v1.z or not v2.z then return 0; end 14 | return math.sqrt( ((v1.x - v2.x)*(v1.x-v2.x)) + ((v1.y - v2.y)*(v1.y-v2.y)) + ((v1.z-v2.z)*(v1.z-v2.z)) ) 15 | end, 16 | 17 | SqMagnitude = function(v) 18 | return ( (v.x * v.x) + (v.y * v.y) + (v.z * v.z) ) 19 | end, 20 | 21 | Length = function(v) 22 | return math.sqrt( (v.x * v.x)+(v.y * v.y)+(v.z * v.z) ) 23 | end, 24 | 25 | Clamp = function(v,maxLength) 26 | if Vector.SqMagnitude(v) > (maxLength * maxLength) then 27 | v = Vector.SetNormalize(v) 28 | v = Vector.Multi(v,maxLength) 29 | end 30 | return v 31 | end, 32 | 33 | Normalize = function(v) 34 | local len = Vector.Length(v) 35 | return vector3(v.x / len, v.y / len, v.z / len) 36 | end, 37 | 38 | SetNormalize = function(v) 39 | local num = Vector.Length(v) 40 | if num == 1 then 41 | return v 42 | elseif num > 1e-5 then 43 | return Vector.Div(v,num) 44 | else 45 | return vector3(0,0,0) 46 | end 47 | end, 48 | 49 | Div = function(v,d) 50 | local x = v.x / d 51 | local y = v.y / d 52 | local z = v.z / d 53 | return vector3(x,y,z) 54 | end, 55 | 56 | Multi = function(v,q) 57 | local x,y,z 58 | local retVec 59 | if type(q) == "number" then 60 | x = v.x * q 61 | y = v.y * q 62 | z = v.z * q 63 | retVec = vector3(x,y,z) 64 | end 65 | return retVec 66 | end, 67 | 68 | PointOnSphere = function(alt,azu,radius,orgX,orgY,orgZ) 69 | local toradians = 0.017453292384744 70 | alt = ( tonumber(alt or 0) or 0 ) * toradians 71 | azu = ( tonumber(azu or 0) or 0 ) * toradians 72 | radius = ( tonumber(radius or 0) or 0 ) 73 | orgX = ( tonumber(orgX or 0) or 0 ) 74 | orgY = ( tonumber(orgY or 0) or 0 ) 75 | orgZ = ( tonumber(orgZ or 0) or 0 ) 76 | 77 | local x = orgX + radius * math.sin( azu ) * math.cos( alt ) 78 | local y = orgY + radius * math.cos( azu ) * math.cos( alt ) 79 | local z = orgZ + radius * math.sin( alt ) 80 | 81 | return vector3(x,y,z) 82 | end, 83 | 84 | ClampCircle = function(x,y,radius) 85 | x = ( tonumber(x or 0) or 0 ) 86 | y = ( tonumber(y or 0) or 0 ) 87 | radius = ( tonumber(radius or 0) or 0 ) 88 | 89 | local d = math.sqrt(x*x+y*y) 90 | d = radius / d 91 | 92 | if d < 1 then x = x * (d/radius)*radius; y = y * (d/radius)*radius; end 93 | return x,y 94 | end, 95 | 96 | RotationToDirection = function(rot) 97 | if ( rot == nil ) then rot = GetGameplayCamRot(2); end 98 | local rotZ = rot.z * ( 3.141593 / 180.0 ) 99 | local rotX = rot.x * ( 3.141593 / 180.0 ) 100 | local c = math.cos(rotX); 101 | local multXY = math.abs(c) 102 | local res = vector3( ( math.sin(rotZ) * -1 )*multXY, math.cos(rotZ)*multXY, math.sin(rotX) ) 103 | return res 104 | end, 105 | 106 | InfrontOfCam = function(...) 107 | local unpack = table.unpack 108 | local coords,direction = GetGameplayCamCoord(), Vector.RotationToDirection() 109 | local inTable = {...} 110 | local retTable = {} 111 | 112 | if ( #inTable == 0 ) or ( inTable[1] < 0.000001 ) then inTable[1] = 0.000001 ; end 113 | 114 | for k,distance in pairs(inTable) do 115 | if ( type(distance) == "number" ) 116 | then 117 | if ( distance == 0 ) 118 | then 119 | retTable[k] = coords 120 | else 121 | retTable[k] = 122 | vector3( 123 | coords.x + ( distance*direction.x ), 124 | coords.y + ( distance*direction.y ), 125 | coords.z + ( distance*direction.z ) 126 | ) 127 | end 128 | end 129 | end 130 | return unpack(retTable) 131 | end 132 | } 133 | 134 | exports('Vector', function() return Vector; end) -------------------------------------------------------------------------------- /[drone]/qb-drone/src/client/functions.lua: -------------------------------------------------------------------------------- 1 | Drones = {} 2 | Scenes = mLibs:SynchronisedScene() 3 | Scaleforms = mLibs:Scaleforms() 4 | 5 | function V3SqrMagnitude(self) 6 | return self.x * self.x + self.y * self.y + self.z * self.z 7 | end 8 | 9 | function GetGroundZ(pos) 10 | local found,z = GetGroundZFor_3dCoord(pos.x,pos.y,pos.z) 11 | if not found then 12 | return GetGround(vector3(pos.x,pos.y,pos.z-1.0)) 13 | else 14 | return vector3(pos.x,pos.y,z) 15 | end 16 | end 17 | 18 | function V3ClampMagnitude(self,max) 19 | if V3SqrMagnitude(self) > (max * max) then 20 | self = V3SetNormalize(self) 21 | self = V3Mul(self,max) 22 | end 23 | return self 24 | end 25 | 26 | function V3SetNormalize(self) 27 | local num = V3Magnitude(self) 28 | if num == 1 then 29 | return self 30 | elseif num > 1e-5 then 31 | self = V3Div(self,num) 32 | else 33 | self = vector3(0.0,0.0,0.0) 34 | end 35 | return self 36 | end 37 | 38 | function V3Mul(self,q) 39 | if type(q) == "number" then 40 | self = self * q 41 | else 42 | self = V3MulQuat(self,q) 43 | end 44 | return self 45 | end 46 | 47 | function V3Magnitude(self) 48 | return math.sqrt(self.x * self.x + self.y * self.y + self.z * self.z) 49 | end 50 | 51 | function V3Div(self,d) 52 | self = vector3(self.x / d,self.y / d,self.z / d) 53 | 54 | return self 55 | end 56 | 57 | function V3MulQuat(self,quat) 58 | local num = quat.x * 2 59 | local num2 = quat.y * 2 60 | local num3 = quat.z * 2 61 | local num4 = quat.x * num 62 | local num5 = quat.y * num2 63 | local num6 = quat.z * num3 64 | local num7 = quat.x * num2 65 | local num8 = quat.x * num3 66 | local num9 = quat.y * num3 67 | local num10 = quat.w * num 68 | local num11 = quat.w * num2 69 | local num12 = quat.w * num3 70 | 71 | local x = (((1 - (num5 + num6)) * self.x) + ((num7 - num12) * self.y)) + ((num8 + num11) * self.z) 72 | local y = (((num7 + num12) * self.x) + ((1 - (num4 + num6)) * self.y)) + ((num9 - num10) * self.z) 73 | local z = (((num8 - num11) * self.x) + ((num9 + num10) * self.y)) + ((1 - (num4 + num5)) * self.z) 74 | 75 | self = vector3(x, y, z) 76 | return self 77 | end 78 | 79 | function V2Dist(v1, v2) 80 | if not v1 or not v2 or not v1.x or not v2.x or not v1.y or not v2.y then return 0; end 81 | return math.sqrt( ( (v1.x or 0) - (v2.x or 0) )*( (v1.x or 0) - (v2.x or 0) )+( (v1.y or 0) - (v2.y or 0) )*( (v1.y or 0) - (v2.y or 0) ) ) 82 | end 83 | 84 | function V3Dist(v1,v2) 85 | if not v1 or not v2 or not v1.x or not v2.x then return 0; end 86 | return math.sqrt( ( (v1.x or 0) - (v2.x or 0) )*( (v1.x or 0) - (v2.x or 0) )+( (v1.y or 0) - (v2.y or 0) )*( (v1.y or 0) - (v2.y or 0) )+( (v1.z or 0) - (v2.z or 0) )*( (v1.z or 0) - (v2.z or 0) ) ) 87 | end 88 | 89 | Vdist = V3Dist 90 | 91 | function CreateBlip(pos,sprite,color,text,scale,display,shortRange,highDetail) 92 | local blip = AddBlipForCoord(pos.x,pos.y,pos.z) 93 | SetBlipSprite(blip, sprite) 94 | SetBlipDisplay(blip, 2) 95 | SetBlipScale(blip, 0.5) 96 | SetBlipColour(blip, color) 97 | SetBlipAsShortRange(blip, true) 98 | BeginTextCommandSetBlipName("STRING") 99 | AddTextComponentString((text or "Blip "..tostring(blip))) 100 | EndTextCommandSetBlipName(blip) 101 | return blip 102 | end 103 | 104 | function DrawText3D(pos, text) 105 | local camCoords = GetGameplayCamCoords() 106 | local distance = #(pos - camCoords) 107 | 108 | if not size then size = 1 end 109 | if not font then font = 1 end 110 | 111 | local dist = Vdist(GetEntityCoords(PlayerPedId()),pos) 112 | 113 | local scale = (size / distance) * 2 114 | local fov = (1 / GetGameplayCamFov()) * 100 115 | scale = scale * fov 116 | 117 | SetTextScale(0.0 * scale, 0.55 * scale) 118 | SetTextFont(font) 119 | SetTextColour(255, 255, 255, 255) 120 | SetTextDropshadow(0, 0, 0, 0, 255) 121 | SetTextDropShadow() 122 | SetTextOutline() 123 | SetTextCentre(true) 124 | 125 | SetDrawOrigin(pos, 0) 126 | BeginTextCommandDisplayText('STRING') 127 | AddTextComponentSubstringPlayerName(text) 128 | EndTextCommandDisplayText(0.0, 0.0) 129 | ClearDrawOrigin() 130 | end 131 | 132 | function DrawSpotlight(pos,alpha) 133 | local lightPos = vector3(pos.x,pos.y,pos.z + 5.0) 134 | local direction = pos - lightPos 135 | local normal = V3SetNormalize(direction) 136 | DrawSpotLight(lightPos.x,lightPos.y,lightPos.z, normal.x,normal.y,normal.z, 255,255,255, alpha, 1.0, 0.0, 10.0, 1.0) 137 | end 138 | 139 | function PointOnSphere(alt,azu,radius,orgX,orgY,orgZ) 140 | local toradians = 0.017453292384744 141 | alt,azu,radius,orgX,orgY,orgZ = ( tonumber(alt or 0) or 0 ) * toradians, ( tonumber(azu or 0) or 0 ) * toradians, tonumber(radius or 0) or 0, tonumber(orgX or 0) or 0, tonumber(orgY or 0) or 0, tonumber(orgZ or 0) or 0 142 | if vector3 143 | then 144 | return 145 | vector3( 146 | orgX + radius * math.sin( azu ) * math.cos( alt ), 147 | orgY + radius * math.cos( azu ) * math.cos( alt ), 148 | orgZ + radius * math.sin( alt ) 149 | ) 150 | end 151 | end 152 | 153 | function ShowHelpNotification(msg, thisFrame, beep, duration) 154 | AddTextEntry('DroneHelpNotification', msg) 155 | 156 | if thisFrame then 157 | DisplayHelpTextThisFrame('DroneHelpNotification', false) 158 | else 159 | if beep == nil then beep = false; end 160 | BeginTextCommandDisplayHelp('DroneHelpNotification') 161 | EndTextCommandDisplayHelp(0, false, beep, duration or -1) 162 | end 163 | end -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/Scenes.lua: -------------------------------------------------------------------------------- 1 | if not Citizen then 2 | NetworkCreateSynchronisedScene = function(...) return ... end 3 | NetworkAddPedToSynchronisedScene = function(...) return ... end 4 | NetworkAddEntityToSynchronisedScene = function(...) return ... end 5 | NetworkStartSynchronisedScene = function(...) return ... end 6 | NetworkStopSynchronisedScene = function(...) return ... end 7 | vector3 = function(x,y,z) return {x=x,y=y,z=z} end 8 | end 9 | 10 | Scenes = {} 11 | 12 | Scenes.Synchronised = { 13 | Defaults = { 14 | SceneConfig = { 15 | position = vector3(0.0,0.0,0.0), 16 | rotation = vector3(0.0,0.0,0.0), 17 | rotOrder = 2, 18 | useOcclusion = false, 19 | loop = false, 20 | unk1 = 1.0, 21 | animTime = 0, 22 | animSpeed = 1.0, 23 | }, 24 | 25 | PedConfig = { 26 | blendIn = 1.0, 27 | blendOut = 1.0, 28 | duration = 0, 29 | flag = 0, 30 | speed = 1.0, 31 | unk1 = 0, 32 | }, 33 | 34 | EntityConfig = { 35 | blendIn = 1.0, 36 | blendOut = 1.0, 37 | flags = 1, 38 | } 39 | }, 40 | 41 | Create = function(sceneConfig) 42 | return NetworkCreateSynchronisedScene(sceneConfig.position,sceneConfig.rotation,sceneConfig.rotOrder,sceneConfig.useOcclusion,sceneConfig.loop,sceneConfig.unk1,sceneConfig.animTime,sceneConfig.animSpeed) 43 | end, 44 | 45 | SceneConfig = function(pos,rot,rotOrder,useOcclusion,loop,unk1,animTime,animSpeed) 46 | 47 | local _D = function(v1,v2) if v1 ~= nil then return v1 else return Scenes.Synchronised.Defaults["SceneConfig"][v2]; end; end 48 | 49 | local conObj = {} 50 | conObj.position = _D(pos,"position") 51 | conObj.rotation = _D(rot,"rotation") 52 | conObj.rotOrder = _D(rotOrder,"rotOrder") 53 | conObj.useOcclusion = _D(useOcclusion,"useOcclusion") 54 | conObj.loop = _D(loop,"loop") 55 | conObj.unk1 = _D(p9,"unk1") 56 | conObj.animTime = _D(animTime,"animTime") 57 | conObj.animSpeed = _D(animSpeed,"animSpeed") 58 | return conObj 59 | end, 60 | 61 | AddPed = function(pedConfig) 62 | return NetworkAddPedToSynchronisedScene(pedConfig.ped,pedConfig.scene,pedConfig.animDict,pedConfig.animName,pedConfig.blendIn,pedConfig.blendOut,pedConfig.duration,pedConfig.flag,pedConfig.speed,pedConfig.unk1) 63 | end, 64 | 65 | PedConfig = function(ped,scene,animDict,animName,blendIn,blendOut,duration,flag,speed,unk1) 66 | 67 | if not ped then print("[meta_libs] Scenes.Synchronised.PedConfig needs a ped as the first argument."); return false; end 68 | if not scene then print("[meta_libs] Scenes.Synchronised.PedConfig needs a scene as the second argument."); return false; end 69 | if not animDict then print("[meta_libs] Scenes.Synchronised.PedConfig needs an animDict as the third argument."); return false; end 70 | if not animName then print("[meta_libs] Scenes.Synchronised.PedConfig needs an animName as the fourth argument."); return false; end 71 | 72 | local _D = function(v1,v2) if v1 ~= nil then return v1 else return Scenes.Synchronised.Defaults["PedConfig"][v2]; end; end 73 | 74 | local conObj = {} 75 | conObj.ped = ped 76 | conObj.scene = scene 77 | conObj.animDict = animDict 78 | conObj.animName = animName 79 | conObj.blendIn = _D(blendIn,"blendIn") 80 | conObj.blendOut = _D(blendOut,"blendOut") 81 | conObj.duration = _D(duration,"duration") 82 | conObj.flag = _D(flag,"flag") 83 | conObj.speed = _D(speed,"speed") 84 | conObj.unk1 = _D(unk1,"unk1") 85 | return conObj 86 | end, 87 | 88 | AddEntity = function(entityConfig) 89 | return NetworkAddEntityToSynchronisedScene(entityConfig.entity,entityConfig.scene,entityConfig.animDict,entityConfig.animName,entityConfig.blendIn,entityConfig.blendOut,entityConfig.flags) 90 | end, 91 | 92 | EntityConfig = function(entity,scene,animDict,animName,blendIn,blendOut,flags) 93 | if not entity then print("[meta_libs] Scenes.Synchronised.EntityConfig needs a entity as the first argument."); return false; end 94 | if not scene then print("[meta_libs] Scenes.Synchronised.EntityConfig needs a scene as the second argument."); return false; end 95 | if not animDict then print("[meta_libs] Scenes.Synchronised.EntityConfig needs an animDict as the third argument."); return false; end 96 | if not animName then print("[meta_libs] Scenes.Synchronised.EntityConfig needs an animName as the fourth argument."); return false; end 97 | 98 | local _D = function(v1,v2) if v1 ~= nil then return v1 else return Scenes.Synchronised.Defaults["EntityConfig"][v2]; end; end 99 | 100 | local conObj = {} 101 | conObj.entity = entity 102 | conObj.scene = scene 103 | conObj.animDict = animDict 104 | conObj.animName = animName 105 | conObj.blendIn = _D(blendIn,"blendIn") 106 | conObj.blendOut = _D(blendOut,"blendOut") 107 | conObj.flags = _D(flags,"flags") 108 | return conObj 109 | end, 110 | 111 | Start = function(scene) 112 | NetworkStartSynchronisedScene(scene) 113 | end, 114 | 115 | Stop = function(scene) 116 | NetworkStopSynchronisedScene(scene) 117 | end, 118 | } 119 | 120 | exports('SynchronisedScene', function() return Scenes.Synchronised; end) 121 | 122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /[drone]/qb-drone/config.lua: -------------------------------------------------------------------------------- 1 | Config = { 2 | BankAccountName = "bank", -- ESX account name for bank. 3 | 4 | DroneSounds = true, -- Should the drones make sound? 5 | 6 | MaxVelocity = 250.0, -- Max drone speed (* drone stats.speed) 7 | BoostSpeed = 3.0, -- How much the boost ability multiplies max speed 8 | BoostAccel = 2.0, -- How much the boost ability multiplies acceleration 9 | BoostDrain = 1.0, -- Boost ability drain speed when used 10 | BoostFill = 0.2, -- Boost ability recharge speed. 11 | TazerFill = 0.2, -- Tazer ability recharge speed. 12 | 13 | -- Shop = { 14 | -- show_blip = false, 15 | -- blip_sprite = 627, 16 | -- blip_color = 2, 17 | -- blip_scale = 0.5, 18 | -- blip_text = "Teknoloji Mağazası", 19 | -- blip_disp = 2, 20 | -- location = vector4(-656.69,-858.13,23.10,0.0), 21 | -- droneoffset = vector3(0.0,0.0,1.5), 22 | -- camoffset2 = vector3(0.0,0.0,1.85), 23 | -- camoffset1 = vector3(0.12,0.4,1.5), 24 | -- }, 25 | 26 | Drones = { 27 | [1] = { 28 | label = "Basit Drone 1", -- Visible text. 29 | name = "drone", -- Item name. 30 | public = true, -- Can be used by anybody? 31 | price = 10000, -- Price 32 | model = GetHashKey('ch_prop_casino_drone_02a'), -- Model 33 | stats = { 34 | speed = 1.0, -- max speed multiplier 35 | agility = 1.0, -- acceleration/deceleration multiplier 36 | range = 100.0, -- range (drone display begins fading out when leaving range) 37 | 38 | -- Max Stats: 39 | -- Max stats are displayed in the NUI window. You can categorize your drones by sharing max stats across similar drones (e.g: basic drone 1,2,3), and changing them for others (e.g: advanced drone 1,2,3). 40 | -- or you can choose to display the same max stats across all drones to have a fair comparison chart. 41 | maxSpeed = 2, 42 | maxAgility = 2, 43 | maxRange = 200, 44 | }, 45 | abilities = { 46 | infared = true, -- infared/heat-vision 47 | nightvision = true, -- nightvision 48 | boost = false, -- boost 49 | tazer = false, -- tazer 50 | explosive = false, -- explosion 51 | }, 52 | restrictions = {}, -- enter job names in here (e.g: {'police','mechanic'}) to restrict the drone purchase to these jobs only, or leave it empty (e.g: {}) for no job restrictions. 53 | -- bannerUrl = "banner1.png"; -- set the banner image to display at the shop while previewing this drone. 54 | }, 55 | 56 | -- [2] = { 57 | -- label = "Basit Drone 2", 58 | -- name = "drone_flyer_2", 59 | -- public = true, 60 | -- price = 10000, 61 | -- model = GetHashKey('ch_prop_arcade_drone_01b'), 62 | -- stats = { 63 | -- speed = 0.5, 64 | -- agility = 1.5, 65 | -- range = 100.0, 66 | 67 | -- maxSpeed = 2, 68 | -- maxAgility = 2, 69 | -- maxRange = 200, 70 | -- }, 71 | -- abilities = { 72 | -- infared = false, 73 | -- nightvision = false, 74 | -- boost = false, 75 | -- tazer = false, 76 | -- explosive = false, 77 | -- }, 78 | -- restrictions = {}, 79 | -- bannerUrl = "banner2.png"; 80 | -- }, 81 | 82 | -- [3] = { 83 | -- label = "Basit Drone 3", 84 | -- name = "drone_flyer_3", 85 | -- public = true, 86 | -- price = 10000, 87 | -- model = GetHashKey('ch_prop_arcade_drone_01c'), 88 | -- stats = { 89 | -- speed = 1.5, 90 | -- agility = 0.5, 91 | -- range = 100.0, 92 | 93 | -- maxSpeed = 2, 94 | -- maxAgility = 2, 95 | -- maxRange = 200, 96 | -- }, 97 | -- abilities = { 98 | -- infared = false, 99 | -- nightvision = false, 100 | -- boost = false, 101 | -- tazer = false, 102 | -- explosive = false, 103 | -- }, 104 | -- restrictions = {}, 105 | -- bannerUrl = "banner3.png"; 106 | -- }, 107 | 108 | -- [4] = { 109 | -- label = "Gelişmiş Drone 1", 110 | -- name = "drone_flyer_4", 111 | -- public = true, 112 | -- price = 25000, 113 | -- model = GetHashKey('ch_prop_arcade_drone_01d'), 114 | -- stats = { 115 | -- speed = 1.5, 116 | -- agility = 1.5, 117 | -- range = 300.0, 118 | 119 | -- maxSpeed = 2, 120 | -- maxAgility = 2, 121 | -- maxRange = 200, 122 | -- }, 123 | -- abilities = { 124 | -- infared = true, 125 | -- nightvision = true, 126 | -- boost = true, 127 | -- tazer = false, 128 | -- explosive = false, 129 | -- }, 130 | -- restrictions = {}, 131 | -- bannerUrl = "banner4.png"; 132 | -- }, 133 | 134 | -- [5] = { 135 | -- label = "Gelişmiş Drone 2", 136 | -- name = "drone_flyer_5", 137 | -- public = true, 138 | -- price = 25000, 139 | -- model = GetHashKey('ch_prop_arcade_drone_01e'), 140 | -- stats = { 141 | -- speed = 2.0, 142 | -- agility = 1.0, 143 | -- range = 300.0, 144 | 145 | -- maxSpeed = 2, 146 | -- maxAgility = 2, 147 | -- maxRange = 500, 148 | -- }, 149 | -- abilities = { 150 | -- infared = true, 151 | -- nightvision = true, 152 | -- boost = true, 153 | -- tazer = false, 154 | -- explosive = false, 155 | -- }, 156 | -- restrictions = {}, 157 | -- bannerUrl = "banner3.png"; 158 | -- }, 159 | 160 | -- [6] = { 161 | -- label = "Gelişmiş Drone 3", 162 | -- name = "drone", 163 | -- public = true, 164 | -- price = 25000, 165 | -- model = GetHashKey('ch_prop_casino_drone_02a'), 166 | -- stats = { 167 | -- speed = 1.0, 168 | -- agility = 2.0, 169 | -- range = 300.0, 170 | 171 | -- maxSpeed = 2, 172 | -- maxAgility = 2, 173 | -- maxRange = 500, 174 | -- }, 175 | -- abilities = { 176 | -- infared = true, 177 | -- nightvision = true, 178 | -- boost = true, 179 | -- tazer = false, 180 | -- explosive = false, 181 | -- }, 182 | -- restrictions = {}, 183 | -- bannerUrl = "banner2.png"; 184 | -- }, 185 | 186 | -- [7] = { 187 | -- label = "Polis Drone", 188 | -- name = "drone_flyer_7", 189 | -- public = false, 190 | -- price = 10000, 191 | -- model = GetHashKey('ch_prop_casino_drone_02a'), 192 | -- stats = { 193 | -- speed = 1.0, 194 | -- agility = 1.0, 195 | -- range = 500.0, 196 | 197 | -- maxSpeed = 2, 198 | -- maxAgility = 2, 199 | -- maxRange = 500, 200 | -- }, 201 | -- abilities = { 202 | -- infared = true, 203 | -- nightvision = true, 204 | -- boost = true, 205 | -- tazer = true, 206 | -- explosive = false, 207 | -- }, 208 | -- restrictions = { 209 | -- 'police' 210 | -- }, 211 | -- bannerUrl = "banner1.png"; 212 | -- }, 213 | }, 214 | 215 | Controls = { 216 | Drone = { 217 | ["inspect"] = { 218 | codes = {38}, 219 | text = "Technology store", 220 | }, 221 | ["pickup_drone"] = { 222 | codes = {38}, 223 | text = "Get the Drone", 224 | }, 225 | ["direction"] = { 226 | codes = {32,33,34,35}, 227 | text = "Direction", 228 | }, 229 | ["heading"] = { 230 | codes = {51,52}, 231 | text = "heading", 232 | }, 233 | ["height"] = { 234 | codes = {36,21}, 235 | text = "height", 236 | }, 237 | ["camera"] = { 238 | codes = {24,25}, 239 | text = "camera", 240 | }, 241 | ["centercam"] = { 242 | codes = {214}, 243 | text = "center camera", 244 | }, 245 | ["zoom"] = { 246 | codes = {16,17}, 247 | text = "zoom" 248 | }, 249 | ["nightvision"] = { 250 | codes = {140}, 251 | text = "nightvision" 252 | }, 253 | ["infared"] = { 254 | codes = {75}, 255 | text = "Infrared" 256 | }, 257 | ["tazer"] = { 258 | codes = {157}, 259 | text = "tazer" 260 | }, 261 | ["explosive"] = { 262 | codes = {158}, 263 | text = "explosive" 264 | }, 265 | ["boost"] = { 266 | codes = {160}, 267 | text = "boost" 268 | }, 269 | ["home"] = { 270 | codes = {213}, 271 | text = "back home", 272 | }, 273 | ["disconnect"] = { 274 | codes = {200}, 275 | text = "disconnect" 276 | }, 277 | }, 278 | Homing = { 279 | ["cancel"] = { 280 | codes = {213}, 281 | text = "cancel", 282 | }, 283 | ["disconnect"] = { 284 | codes = {200}, 285 | text = "disconnect" 286 | }, 287 | } 288 | }, 289 | } 290 | 291 | mLibs = exports["meta_libs"] -------------------------------------------------------------------------------- /[drone]/meta_libs/client/classes/Vehicle.lua: -------------------------------------------------------------------------------- 1 | -- Vehicle Class 2 | -- Created for: 3 | -- Easy vehicle tracking & creation. 4 | -- Usage: 5 | -- To create a car: newVeh = exports["meta_libs"]:Vehicle('banshee2',x,y,z/vector3(x,y,z)/{x,y,z},heading) 6 | -- To get the cars network ID: networkId = newVeh.netId; 7 | -- To get the cars position: carPos = newVeh.pos(); 8 | -- To get the cars heading: carPos = newVeh.heading(); 9 | -- To delete the vehicle: newVeh.delete(); 10 | 11 | Vehicle = function(model,x,y,z,heading) 12 | local hash = (type(model) == "string" and GetHashKey(model) or model) 13 | LoadModel(hash) 14 | 15 | local xType = type(x) 16 | local pos = (xType == "table" and x or xType == "vector3" and x or vector3(x,y,z)) 17 | local heading = (xType == "table" and y or xType == "vector3" and y or heading) 18 | local vehicle = CreateVehicle(hash, pos.x,pos.y,pos.z, heading, true,true) 19 | Wait(0) 20 | 21 | SetEntityAsMissionEntity(vehicle,true,true) 22 | NetworkEntity(vehicle) 23 | 24 | local netId = NetworkGetNetworkIdFromEntity(vehicle) 25 | local GetCoords = function() 26 | local ent = NetworkGetEntityFromNetworkId(netId) 27 | return GetEntityCoords(ent) 28 | end 29 | 30 | local GetHeading = function() 31 | local ent = NetworkGetEntityFromNetworkId(netId) 32 | return GetEntityHeading(ent) 33 | end 34 | 35 | local Delete = function() 36 | local ent = NetworkGetEntityFromNetworkId(netId) 37 | NetworkControl(ent) 38 | SetEntityAsMissionEntity(ent,true,true) 39 | TaskEveryoneLeaveVehicle(ent,0) 40 | DeleteVehicle(ent) 41 | DeleteEntity(ent) 42 | end 43 | 44 | return { 45 | entId = vehicle, 46 | netId = netId, 47 | pos = GetCoords, 48 | heading = GetHeading, 49 | delete = Delete 50 | } 51 | end 52 | 53 | LocalVehicle = function(model,x,y,z,heading) 54 | local hash = (type(model) == "string" and GetHashKey(model) or model) 55 | LoadModel(hash) 56 | 57 | local xType = type(x) 58 | local pos = (xType == "table" and x or xType == "vector3" and x or vector3(x,y,z)) 59 | local heading = (xType == "table" and y or xType == "vector3" and y or heading) 60 | local vehicle = CreateVehicle(hash, pos.x,pos.y,pos.z, heading, false,true) 61 | Wait(0) 62 | 63 | SetEntityAsMissionEntity(vehicle,true,true) 64 | 65 | local GetCoords = function() 66 | return GetEntityCoords(vehicle) 67 | end 68 | 69 | local GetHeading = function() 70 | return GetEntityHeading(vehicle) 71 | end 72 | 73 | local Delete = function() 74 | SetEntityAsMissionEntity(vehicle,true,true) 75 | TaskEveryoneLeaveVehicle(vehicle,0) 76 | DeleteVehicle(vehicle) 77 | DeleteEntity(vehicle) 78 | end 79 | 80 | return { 81 | entId = vehicle, 82 | pos = GetCoords, 83 | heading = GetHeading, 84 | delete = Delete 85 | } 86 | end 87 | 88 | SetVehicleProps = function(vehicle, props) 89 | SetVehicleModKit(vehicle, 0) 90 | 91 | if props.plate ~= nil then 92 | SetVehicleNumberPlateText(vehicle, props.plate) 93 | end 94 | 95 | if props.plateIndex ~= nil then 96 | SetVehicleNumberPlateTextIndex(vehicle, props.plateIndex) 97 | end 98 | 99 | if props.bodyHealth ~= nil then 100 | SetVehicleBodyHealth(vehicle, props.bodyHealth + 0.0) 101 | end 102 | 103 | if props.engineHealth ~= nil then 104 | SetVehicleEngineHealth(vehicle, props.engineHealth + 0.0) 105 | end 106 | 107 | if props.fuelLevel ~= nil then 108 | SetVehicleFuelLevel(vehicle, props.fuelLevel + 0.0) 109 | end 110 | 111 | if props.dirtLevel ~= nil then 112 | SetVehicleDirtLevel(vehicle, props.dirtLevel + 0.0) 113 | end 114 | 115 | if props.color1 ~= nil then 116 | local color1, color2 = GetVehicleColours(vehicle) 117 | SetVehicleColours(vehicle, props.color1, color2) 118 | end 119 | 120 | if props.color2 ~= nil then 121 | local color1, color2 = GetVehicleColours(vehicle) 122 | SetVehicleColours(vehicle, color1, props.color2) 123 | end 124 | 125 | if props.pearlescentColor ~= nil then 126 | local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) 127 | SetVehicleExtraColours(vehicle, props.pearlescentColor, wheelColor) 128 | end 129 | 130 | if props.wheelColor ~= nil then 131 | local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) 132 | SetVehicleExtraColours(vehicle, pearlescentColor, props.wheelColor) 133 | end 134 | 135 | if props.wheels ~= nil then 136 | SetVehicleWheelType(vehicle, props.wheels) 137 | end 138 | 139 | if props.windowTint ~= nil then 140 | SetVehicleWindowTint(vehicle, props.windowTint) 141 | end 142 | 143 | if props.neonEnabled ~= nil then 144 | SetVehicleNeonLightEnabled(vehicle, 0, props.neonEnabled[1]) 145 | SetVehicleNeonLightEnabled(vehicle, 1, props.neonEnabled[2]) 146 | SetVehicleNeonLightEnabled(vehicle, 2, props.neonEnabled[3]) 147 | SetVehicleNeonLightEnabled(vehicle, 3, props.neonEnabled[4]) 148 | end 149 | 150 | if props.extras ~= nil then 151 | for id,enabled in pairs(props.extras) do 152 | if enabled then 153 | SetVehicleExtra(vehicle, tonumber(id), 0) 154 | else 155 | SetVehicleExtra(vehicle, tonumber(id), 1) 156 | end 157 | end 158 | end 159 | 160 | if props.neonColor ~= nil then 161 | SetVehicleNeonLightsColour(vehicle, props.neonColor[1], props.neonColor[2], props.neonColor[3]) 162 | end 163 | 164 | if props.modSmokeEnabled ~= nil then 165 | ToggleVehicleMod(vehicle, 20, true) 166 | end 167 | 168 | if props.tyreSmokeColor ~= nil then 169 | SetVehicleTyreSmokeColor(vehicle, props.tyreSmokeColor[1], props.tyreSmokeColor[2], props.tyreSmokeColor[3]) 170 | end 171 | 172 | if props.modSpoilers ~= nil then 173 | SetVehicleMod(vehicle, 0, props.modSpoilers, false) 174 | end 175 | 176 | if props.modFrontBumper ~= nil then 177 | SetVehicleMod(vehicle, 1, props.modFrontBumper, false) 178 | end 179 | 180 | if props.modRearBumper ~= nil then 181 | SetVehicleMod(vehicle, 2, props.modRearBumper, false) 182 | end 183 | 184 | if props.modSideSkirt ~= nil then 185 | SetVehicleMod(vehicle, 3, props.modSideSkirt, false) 186 | end 187 | 188 | if props.modExhaust ~= nil then 189 | SetVehicleMod(vehicle, 4, props.modExhaust, false) 190 | end 191 | 192 | if props.modFrame ~= nil then 193 | SetVehicleMod(vehicle, 5, props.modFrame, false) 194 | end 195 | 196 | if props.modGrille ~= nil then 197 | SetVehicleMod(vehicle, 6, props.modGrille, false) 198 | end 199 | 200 | if props.modHood ~= nil then 201 | SetVehicleMod(vehicle, 7, props.modHood, false) 202 | end 203 | 204 | if props.modFender ~= nil then 205 | SetVehicleMod(vehicle, 8, props.modFender, false) 206 | end 207 | 208 | if props.modRightFender ~= nil then 209 | SetVehicleMod(vehicle, 9, props.modRightFender, false) 210 | end 211 | 212 | if props.modRoof ~= nil then 213 | SetVehicleMod(vehicle, 10, props.modRoof, false) 214 | end 215 | 216 | if props.modEngine ~= nil then 217 | SetVehicleMod(vehicle, 11, props.modEngine, false) 218 | end 219 | 220 | if props.modBrakes ~= nil then 221 | SetVehicleMod(vehicle, 12, props.modBrakes, false) 222 | end 223 | 224 | if props.modTransmission ~= nil then 225 | SetVehicleMod(vehicle, 13, props.modTransmission, false) 226 | end 227 | 228 | if props.modHorns ~= nil then 229 | SetVehicleMod(vehicle, 14, props.modHorns, false) 230 | end 231 | 232 | if props.modSuspension ~= nil then 233 | SetVehicleMod(vehicle, 15, props.modSuspension, false) 234 | end 235 | 236 | if props.modArmor ~= nil then 237 | SetVehicleMod(vehicle, 16, props.modArmor, false) 238 | end 239 | 240 | if props.modTurbo ~= nil then 241 | ToggleVehicleMod(vehicle, 18, props.modTurbo) 242 | end 243 | 244 | if props.modXenon ~= nil then 245 | ToggleVehicleMod(vehicle, 22, props.modXenon) 246 | end 247 | 248 | if props.modFrontWheels ~= nil then 249 | SetVehicleMod(vehicle, 23, props.modFrontWheels, false) 250 | end 251 | 252 | if props.modBackWheels ~= nil then 253 | SetVehicleMod(vehicle, 24, props.modBackWheels, false) 254 | end 255 | 256 | if props.modPlateHolder ~= nil then 257 | SetVehicleMod(vehicle, 25, props.modPlateHolder, false) 258 | end 259 | 260 | if props.modVanityPlate ~= nil then 261 | SetVehicleMod(vehicle, 26, props.modVanityPlate, false) 262 | end 263 | 264 | if props.modTrimA ~= nil then 265 | SetVehicleMod(vehicle, 27, props.modTrimA, false) 266 | end 267 | 268 | if props.modOrnaments ~= nil then 269 | SetVehicleMod(vehicle, 28, props.modOrnaments, false) 270 | end 271 | 272 | if props.modDashboard ~= nil then 273 | SetVehicleMod(vehicle, 29, props.modDashboard, false) 274 | end 275 | 276 | if props.modDial ~= nil then 277 | SetVehicleMod(vehicle, 30, props.modDial, false) 278 | end 279 | 280 | if props.modDoorSpeaker ~= nil then 281 | SetVehicleMod(vehicle, 31, props.modDoorSpeaker, false) 282 | end 283 | 284 | if props.modSeats ~= nil then 285 | SetVehicleMod(vehicle, 32, props.modSeats, false) 286 | end 287 | 288 | if props.modSteeringWheel ~= nil then 289 | SetVehicleMod(vehicle, 33, props.modSteeringWheel, false) 290 | end 291 | 292 | if props.modShifterLeavers ~= nil then 293 | SetVehicleMod(vehicle, 34, props.modShifterLeavers, false) 294 | end 295 | 296 | if props.modAPlate ~= nil then 297 | SetVehicleMod(vehicle, 35, props.modAPlate, false) 298 | end 299 | 300 | if props.modSpeakers ~= nil then 301 | SetVehicleMod(vehicle, 36, props.modSpeakers, false) 302 | end 303 | 304 | if props.modTrunk ~= nil then 305 | SetVehicleMod(vehicle, 37, props.modTrunk, false) 306 | end 307 | 308 | if props.modHydrolic ~= nil then 309 | SetVehicleMod(vehicle, 38, props.modHydrolic, false) 310 | end 311 | 312 | if props.modEngineBlock ~= nil then 313 | SetVehicleMod(vehicle, 39, props.modEngineBlock, false) 314 | end 315 | 316 | if props.modAirFilter ~= nil then 317 | SetVehicleMod(vehicle, 40, props.modAirFilter, false) 318 | end 319 | 320 | if props.modStruts ~= nil then 321 | SetVehicleMod(vehicle, 41, props.modStruts, false) 322 | end 323 | 324 | if props.modArchCover ~= nil then 325 | SetVehicleMod(vehicle, 42, props.modArchCover, false) 326 | end 327 | 328 | if props.modAerials ~= nil then 329 | SetVehicleMod(vehicle, 43, props.modAerials, false) 330 | end 331 | 332 | if props.modTrimB ~= nil then 333 | SetVehicleMod(vehicle, 44, props.modTrimB, false) 334 | end 335 | 336 | if props.modTank ~= nil then 337 | SetVehicleMod(vehicle, 45, props.modTank, false) 338 | end 339 | 340 | if props.modWindows ~= nil then 341 | SetVehicleMod(vehicle, 46, props.modWindows, false) 342 | end 343 | 344 | if props.modLivery ~= nil then 345 | SetVehicleMod(vehicle, 48, props.modLivery, false) 346 | SetVehicleLivery(vehicle, props.modLivery) 347 | end 348 | end 349 | 350 | GetVehicleProps = function(vehicle) 351 | local color1, color2 = GetVehicleColours(vehicle) 352 | local pearlescentColor, wheelColor = GetVehicleExtraColours(vehicle) 353 | local extras = {} 354 | 355 | for id=0, 64 do 356 | if DoesExtraExist(vehicle, id) then 357 | local state = IsVehicleExtraTurnedOn(vehicle, id) == 1 358 | extras[tostring(id)] = state 359 | end 360 | end 361 | 362 | return { 363 | model = GetEntityModel(vehicle), 364 | 365 | plate = GetVehicleNumberPlateText(vehicle), 366 | plateIndex = GetVehicleNumberPlateTextIndex(vehicle), 367 | 368 | bodyHealth = math.ceil(GetVehicleBodyHealth(vehicle), 1), 369 | engineHealth = math.ceil(GetVehicleEngineHealth(vehicle), 1), 370 | 371 | fuelLevel = math.ceil(GetVehicleFuelLevel(vehicle), 1), 372 | dirtLevel = math.ceil(GetVehicleDirtLevel(vehicle), 1), 373 | color1 = color1, 374 | color2 = color2, 375 | 376 | pearlescentColor = pearlescentColor, 377 | wheelColor = wheelColor, 378 | 379 | wheels = GetVehicleWheelType(vehicle), 380 | windowTint = GetVehicleWindowTint(vehicle), 381 | 382 | neonEnabled = { 383 | IsVehicleNeonLightEnabled(vehicle, 0), 384 | IsVehicleNeonLightEnabled(vehicle, 1), 385 | IsVehicleNeonLightEnabled(vehicle, 2), 386 | IsVehicleNeonLightEnabled(vehicle, 3) 387 | }, 388 | 389 | extras = extras, 390 | 391 | neonColor = table.pack(GetVehicleNeonLightsColour(vehicle)), 392 | tyreSmokeColor = table.pack(GetVehicleTyreSmokeColor(vehicle)), 393 | 394 | modSpoilers = GetVehicleMod(vehicle, 0), 395 | modFrontBumper = GetVehicleMod(vehicle, 1), 396 | modRearBumper = GetVehicleMod(vehicle, 2), 397 | modSideSkirt = GetVehicleMod(vehicle, 3), 398 | modExhaust = GetVehicleMod(vehicle, 4), 399 | modFrame = GetVehicleMod(vehicle, 5), 400 | modGrille = GetVehicleMod(vehicle, 6), 401 | modHood = GetVehicleMod(vehicle, 7), 402 | modFender = GetVehicleMod(vehicle, 8), 403 | modRightFender = GetVehicleMod(vehicle, 9), 404 | modRoof = GetVehicleMod(vehicle, 10), 405 | 406 | modEngine = GetVehicleMod(vehicle, 11), 407 | modBrakes = GetVehicleMod(vehicle, 12), 408 | modTransmission = GetVehicleMod(vehicle, 13), 409 | modHorns = GetVehicleMod(vehicle, 14), 410 | modSuspension = GetVehicleMod(vehicle, 15), 411 | modArmor = GetVehicleMod(vehicle, 16), 412 | 413 | modTurbo = IsToggleModOn(vehicle, 18), 414 | modSmokeEnabled = IsToggleModOn(vehicle, 20), 415 | modXenon = IsToggleModOn(vehicle, 22), 416 | 417 | modFrontWheels = GetVehicleMod(vehicle, 23), 418 | modBackWheels = GetVehicleMod(vehicle, 24), 419 | 420 | modPlateHolder = GetVehicleMod(vehicle, 25), 421 | modVanityPlate = GetVehicleMod(vehicle, 26), 422 | modTrimA = GetVehicleMod(vehicle, 27), 423 | modOrnaments = GetVehicleMod(vehicle, 28), 424 | modDashboard = GetVehicleMod(vehicle, 29), 425 | modDial = GetVehicleMod(vehicle, 30), 426 | modDoorSpeaker = GetVehicleMod(vehicle, 31), 427 | modSeats = GetVehicleMod(vehicle, 32), 428 | modSteeringWheel = GetVehicleMod(vehicle, 33), 429 | modShifterLeavers = GetVehicleMod(vehicle, 34), 430 | modAPlate = GetVehicleMod(vehicle, 35), 431 | modSpeakers = GetVehicleMod(vehicle, 36), 432 | modTrunk = GetVehicleMod(vehicle, 37), 433 | modHydrolic = GetVehicleMod(vehicle, 38), 434 | modEngineBlock = GetVehicleMod(vehicle, 39), 435 | modAirFilter = GetVehicleMod(vehicle, 40), 436 | modStruts = GetVehicleMod(vehicle, 41), 437 | modArchCover = GetVehicleMod(vehicle, 42), 438 | modAerials = GetVehicleMod(vehicle, 43), 439 | modTrimB = GetVehicleMod(vehicle, 44), 440 | modTank = GetVehicleMod(vehicle, 45), 441 | modWindows = GetVehicleMod(vehicle, 46), 442 | modLivery = GetVehicleLivery(vehicle) 443 | } 444 | end 445 | 446 | exports('Vehicle',Vehicle) 447 | exports('LocalVehicle',LocalVehicle) 448 | exports('GetVehicleProps',GetVehicleProps) 449 | exports('SetVehicleProps',SetVehicleProps) -------------------------------------------------------------------------------- /[drone]/qb-drone/src/client/main.lua: -------------------------------------------------------------------------------- 1 | local QBCore = exports['qb-core']:GetCoreObject() 2 | 3 | Drones.SceneModels = { 4 | drone = GetHashKey('ch_prop_arcade_drone_01a'), 5 | laptop = GetHashKey('hei_prop_hst_laptop') 6 | } 7 | 8 | Drones.SceneAnimations = { 9 | [1] = { 10 | laptop = 'hack_enter_laptop', 11 | drone = 'hack_enter_card', 12 | bag = 'hack_enter_suit_bag', 13 | }, 14 | [2] = { 15 | laptop = 'hack_loop_laptop', 16 | drone = 'hack_loop_card', 17 | bag = 'hack_loop_suit_bag', 18 | } 19 | } 20 | 21 | 22 | Drones.LoadModel = function(hash) 23 | RequestModel(hash) 24 | while not HasModelLoaded(hash) do Wait(0); end 25 | end 26 | 27 | Drones.LoadDict = function(dict) 28 | RequestAnimDict(dict) 29 | while not HasAnimDictLoaded(dict) do Wait(0); end 30 | end 31 | 32 | Drones.CreateObject = function(pos, hash, net) 33 | Drones.LoadModel(hash) 34 | local del_obj = GetClosestObjectOfType(pos.x, pos.y, pos.z, 2.5, hash, false, true, true) 35 | if del_obj then 36 | SetEntityAsMissionEntity(del_obj, true, true) 37 | DeleteObject(del_obj) 38 | end 39 | local _object = CreateObject(hash, pos.x, pos.y, pos.z, net, true, true) 40 | if (type(pos) == "vector4") then 41 | SetEntityHeading(_object,pos.w) 42 | end 43 | return _object 44 | end 45 | 46 | Drones.SceneObjects = function() 47 | local pos = GetEntityCoords(PlayerPedId()) 48 | local objects = {} 49 | for key,hash in pairs(Drones.SceneModels) do 50 | objects[key] = Drones.CreateObject(pos, hash, 1) 51 | SetEntityAsMissionEntity(objects[key], true, true) 52 | SetEntityCollision(objects[key], false, false) 53 | SetModelAsNoLongerNeeded(hash) 54 | end 55 | return objects 56 | end 57 | 58 | Drones.CreateCam = function(attach_to) 59 | local camera = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", 0.0, 0.0, 0.0, 0, 0, 0, 50 * 1.0) 60 | local min,max = GetModelDimensions(GetEntityModel(attach_to)) 61 | 62 | SetCamActive(camera, true) 63 | RenderScriptCams(true, false, 0, true, false) 64 | AttachCamToEntity(camera,attach_to, 0.0, 0.0, -max.z/2, false) 65 | SetFocusEntity(attach_to, true) 66 | 67 | ClearTimecycleModifier() 68 | SetTimecycleModifier("eyeinthesky") 69 | SetTimecycleModifierStrength(0.1) 70 | 71 | return camera 72 | end 73 | 74 | Drones.CreateControls = function(abilities) 75 | local controls 76 | if type(abilities) == "string" then 77 | controls = { 78 | [1] = Config.Controls.Homing["cancel"], 79 | [2] = Config.Controls.Homing["disconnect"] 80 | } 81 | else 82 | controls = { 83 | [1] = Config.Controls.Drone["direction"], 84 | [2] = Config.Controls.Drone["heading"], 85 | [3] = Config.Controls.Drone["height"], 86 | [4] = Config.Controls.Drone["camera"], 87 | [5] = Config.Controls.Drone["zoom"], 88 | } 89 | 90 | if abilities.nightvision then 91 | table.insert(controls,Config.Controls.Drone["nightvision"]) 92 | end 93 | 94 | if abilities.infared then 95 | table.insert(controls,Config.Controls.Drone["infared"]) 96 | end 97 | 98 | if abilities.tazer then 99 | table.insert(controls,Config.Controls.Drone["tazer"]) 100 | end 101 | 102 | if abilities.boost then 103 | table.insert(controls,Config.Controls.Drone["boost"]) 104 | end 105 | 106 | if abilities.explosive then 107 | table.insert(controls,Config.Controls.Drone["explosive"]) 108 | end 109 | 110 | table.insert(controls,Config.Controls.Drone["centercam"]) 111 | table.insert(controls,Config.Controls.Drone["home"]) 112 | table.insert(controls,Config.Controls.Drone["disconnect"]) 113 | end 114 | 115 | return controls 116 | end 117 | 118 | Drones.SpawnDrone = function(drone_data) 119 | DoScreenFadeOut(500) 120 | local controls = Drones.CreateControls(drone_data.abilities) 121 | Drones.ButtonsScaleform = Instructional.Create(controls) 122 | Wait(500) 123 | 124 | local drone_model = drone_data.model 125 | local ply_ped = PlayerPedId() 126 | local ply_pos = GetEntityCoords(ply_ped) 127 | local drone = Drones.CreateObject(ply_pos, drone_model, 1) 128 | local cam = Drones.CreateCam(drone) 129 | 130 | SetEntityAsMissionEntity(drone, true, true) 131 | SetObjectPhysicsParams(drone, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0) 132 | 133 | local pos = GetEntityCoords(drone) 134 | local hed = GetEntityHeading(drone) 135 | local rot = GetEntityRotation(drone, 2) 136 | 137 | local velocity = vector3(0.0, 0.0, 0.0) 138 | local rotation = vector3(0.0, 0.0, 0.0) 139 | 140 | Drones.DroneScaleform = Scaleforms.LoadMovie("DRONE_CAM") 141 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_EMP_METER_IS_VISIBLE", 0) 142 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_INFO_LIST_IS_VISIBLE", 0) 143 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_SOUND_WAVE_IS_VISIBLE", 0) 144 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_TRANQUILIZE_METER_IS_VISIBLE", 0) 145 | 146 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_DETONATE_METER_IS_VISIBLE", drone_data.abilities.explosive) 147 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_SHOCK_METER_IS_VISIBLE", drone_data.abilities.tazer) 148 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_RETICLE_IS_VISIBLE", drone_data.abilities.tazer) 149 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_BOOST_METER_IS_VISIBLE", drone_data.abilities.boost) 150 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_HEADING_METER_IS_VISIBLE", 1) 151 | Scaleforms.PopBool(Drones.DroneScaleform,"SET_ZOOM_METER_IS_VISIBLE", 1) 152 | 153 | Scaleforms.PopInt(Drones.DroneScaleform,"SET_ZOOM", 0) 154 | Scaleforms.PopInt(Drones.DroneScaleform,"SET_BOOST_PERCENTAGE", 100) 155 | Scaleforms.PopInt(Drones.DroneScaleform,"SET_DETONATE_PERCENTAGE", 100) 156 | Scaleforms.PopInt(Drones.DroneScaleform,"SET_SHOCK_PERCENTAGE", 100) 157 | 158 | Scaleforms.PopInt(Drones.DroneScaleform,"SET_TRANQUILIZE_PERCENTAGE", 100) 159 | Scaleforms.PopInt(Drones.DroneScaleform,"SET_EMP_PERCENTAGE", 100) 160 | 161 | Scaleforms.PopMulti(Drones.DroneScaleform,"SET_ZOOM_LABEL", 0, "DRONE_ZOOM_1") 162 | Scaleforms.PopMulti(Drones.DroneScaleform,"SET_ZOOM_LABEL", 1, "") 163 | Scaleforms.PopMulti(Drones.DroneScaleform,"SET_ZOOM_LABEL", 2, "DRONE_ZOOM_2") 164 | Scaleforms.PopMulti(Drones.DroneScaleform,"SET_ZOOM_LABEL", 3, "") 165 | Scaleforms.PopMulti(Drones.DroneScaleform,"SET_ZOOM_LABEL", 4, "DRONE_ZOOM_3") 166 | 167 | Drones.SoundID = GetSoundId() 168 | if Config.DroneSounds then 169 | PlaySoundFromEntity(Drones.SoundID, "Flight_Loop", drone, "DLC_BTL_Drone_Sounds", true, 0) 170 | end 171 | 172 | DoScreenFadeIn(500) 173 | Drones.DroneControl(drone_data, drone, cam) 174 | end 175 | 176 | local tab, temp = nil, false 177 | 178 | function attachObject() 179 | tab = CreateObject(GetHashKey("prop_cs_tablet"), 0, 0, 0, true, true, true) 180 | AttachEntityToEntity(tab, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), -0.05, 0.0, 0.0, 0.0, 0.0, 0.0, true, true, false, true, 1, true) 181 | end 182 | 183 | function stopAnim() 184 | temp = false 185 | 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) 186 | DeleteObject(tab) 187 | FreezeEntityPosition(PlayerPedId(), false) 188 | end 189 | 190 | function startAnim() 191 | if not temp then 192 | RequestAnimDict("amb@code_human_in_bus_passenger_idles@female@tablet@idle_a") 193 | while not HasAnimDictLoaded("amb@code_human_in_bus_passenger_idles@female@tablet@idle_a") do 194 | Citizen.Wait(0) 195 | end 196 | attachObject() 197 | 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) 198 | FreezeEntityPosition(PlayerPedId(), true) 199 | temp = true 200 | end 201 | end 202 | 203 | Drones.DroneControl = function(drone_data, drone, camera) 204 | local ply_ped = PlayerPedId() 205 | local ply_pos = GetEntityCoords(ply_ped) 206 | local ply_fwd = GetEntityForwardVector(ply_ped) 207 | 208 | local pos = ply_pos + ply_fwd 209 | 210 | local zoom = 0 211 | local head = 0.0 212 | local boost = 100.0 213 | local explosive = 100.0 214 | local tazer = 100.0 215 | 216 | local rotation_momentum = 0.0 217 | local movement_momentum = vector3(0.0, 0.0, 0.0) 218 | local camera_rotation = vector3(0.0, 0.0, 0.0) 219 | 220 | Drones.DisplayRadar = (not IsRadarHidden()) 221 | DisplayRadar(false) 222 | startAnim() 223 | while true do 224 | local forward,right,up,p = GetEntityMatrix(drone) 225 | local dist = Vdist(ply_pos,p) 226 | 227 | DisableAllControlActions(0) 228 | SetEntityNoCollisionEntity(ply_ped, drone, true) 229 | 230 | 231 | 232 | -- 233 | -- Boost 234 | -- 235 | local boosted = false 236 | if drone_data.abilities.boost then 237 | if IsDisabledControlPressed(0, Config.Controls.Drone["boost"].codes[1]) and boost > 1.0 then 238 | boost = math.max(1.0, boost - (Config.BoostDrain * GetFrameTime())) 239 | boosted = true 240 | else 241 | boost = math.min(100.0, boost + (Config.BoostFill * GetFrameTime())) 242 | end 243 | Scaleforms.PopInt(Drones.DroneScaleform, "SET_BOOST_PERCENTAGE", math.floor(boost)) 244 | end 245 | 246 | -- 247 | -- Drone Movement 248 | -- 249 | local did_move = false 250 | local max_boost = (Config.MaxVelocity * drone_data.stats.speed) 251 | if boosted then 252 | max_boost = max_boost * Config.BoostSpeed 253 | end 254 | if IsDisabledControlPressed(0, Config.Controls.Drone["direction"].codes[1]) then 255 | movement_momentum = V3ClampMagnitude(movement_momentum + (forward * drone_data.stats.agility),max_boost) 256 | did_move = true 257 | end 258 | 259 | if IsDisabledControlPressed(0, Config.Controls.Drone["direction"].codes[2]) then 260 | movement_momentum = V3ClampMagnitude(movement_momentum - (forward * drone_data.stats.agility),max_boost) 261 | did_move = true 262 | end 263 | 264 | if IsDisabledControlPressed(0, Config.Controls.Drone["direction"].codes[3]) then 265 | movement_momentum = V3ClampMagnitude(movement_momentum - (right * drone_data.stats.agility),max_boost) 266 | did_move = true 267 | end 268 | 269 | if IsDisabledControlPressed(0, Config.Controls.Drone["direction"].codes[4]) then 270 | movement_momentum = V3ClampMagnitude(movement_momentum + (right * drone_data.stats.agility),max_boost) 271 | did_move = true 272 | end 273 | 274 | if IsDisabledControlPressed(0, Config.Controls.Drone["height"].codes[1]) then 275 | movement_momentum = V3ClampMagnitude(movement_momentum - (up * drone_data.stats.agility),max_boost) 276 | did_move = true 277 | end 278 | 279 | if IsDisabledControlPressed(0,Config.Controls.Drone["height"].codes[2]) then 280 | movement_momentum = V3ClampMagnitude(movement_momentum + (up * drone_data.stats.agility),max_boost) 281 | did_move = true 282 | end 283 | 284 | -- 285 | -- Cam Rotation 286 | -- 287 | 288 | 289 | if IsDisabledControlPressed(0,Config.Controls.Drone["camera"].codes[1]) then 290 | camera_rotation = camera_rotation - (vector3(1.0,0.0,0.0) / math.max(2,zoom)) 291 | end 292 | 293 | if IsDisabledControlPressed(0,Config.Controls.Drone["camera"].codes[2]) then 294 | camera_rotation = camera_rotation + (vector3(1.0,0.0,0.0) / math.max(2,zoom)) 295 | end 296 | 297 | -- 298 | -- Drone Heading 299 | -- 300 | if IsDisabledControlPressed(0,Config.Controls.Drone["heading"].codes[1]) then 301 | rotation_momentum = math.max(-1.5,rotation_momentum - 0.02) 302 | elseif IsDisabledControlPressed(0,Config.Controls.Drone["heading"].codes[2]) then 303 | rotation_momentum = math.min(1.5,rotation_momentum + 0.02) 304 | else 305 | if rotation_momentum > 0.0 then 306 | rotation_momentum = math.max(0.0,rotation_momentum - 0.04) 307 | elseif rotation_momentum < 0.0 then 308 | rotation_momentum = math.min(0.0,rotation_momentum + 0.04) 309 | end 310 | end 311 | 312 | -- 313 | -- Zoom 314 | -- 315 | if IsDisabledControlJustPressed(0,Config.Controls.Drone["zoom"].codes[1]) then 316 | zoom = math.max(0, (zoom or 0) - 1) 317 | Scaleforms.PopInt(Drones.DroneScaleform, "SET_ZOOM", zoom) 318 | 319 | SetCamFov(camera, 50.0 - (10.0 * zoom)) 320 | end 321 | 322 | if IsDisabledControlJustPressed(0,Config.Controls.Drone["zoom"].codes[2]) then 323 | zoom = math.min(4, (zoom or 0) + 1) 324 | Scaleforms.PopInt(Drones.DroneScaleform, "SET_ZOOM", zoom) 325 | 326 | SetCamFov(camera, 50.0 - (10.0 * zoom)) 327 | end 328 | 329 | -- 330 | -- Nightvision 331 | -- 332 | if drone_data.abilities.nightvision and IsDisabledControlJustPressed(0,Config.Controls.Drone["nightvision"].codes[1]) then 333 | if not NightvisionEnabled then 334 | NightvisionEnabled = true 335 | SetNightvision(true) 336 | else 337 | NightvisionEnabled = false 338 | SetNightvision(false) 339 | end 340 | end 341 | 342 | -- 343 | -- Infared 344 | -- 345 | if drone_data.abilities.infared and IsDisabledControlJustPressed(0,Config.Controls.Drone["infared"].codes[1]) then 346 | if not InfaredEnabled then 347 | InfaredEnabled = true 348 | SetSeethrough(true) 349 | else 350 | InfaredEnabled = false 351 | SetSeethrough(false) 352 | end 353 | end 354 | 355 | -- 356 | -- Tazer 357 | -- 358 | if drone_data.abilities.tazer then 359 | if IsDisabledControlJustPressed(0,Config.Controls.Drone["tazer"].codes[1]) and tazer >= 100.0 then 360 | tazer = 1.0 361 | local right,forward,up,p = GetCamMatrix(camera) 362 | forward = forward * 10.0 363 | 364 | SetCanAttackFriendly(PlayerPedId(), true, false) 365 | SetCanAttackFriendly(drone, true, false) 366 | NetworkSetFriendlyFireOption(true) 367 | Wait(0) 368 | 369 | ShootSingleBulletBetweenCoords(p.x,p.y,p.z, p.x+forward.x, p.y+forward.y, p.z+forward.z, 0, false, GetHashKey('WEAPON_STUNGUN'), PlayerPedId(), true, true, 100.0) 370 | else 371 | tazer = math.min(100.0,tazer + (Config.TazerFill * GetFrameTime())) 372 | end 373 | Scaleforms.PopInt(Drones.DroneScaleform, "SET_SHOCK_PERCENTAGE", math.floor(tazer)) 374 | end 375 | 376 | -- 377 | -- Explosive 378 | -- 379 | if drone_data.abilities.explosive then 380 | if IsDisabledControlJustPressed(0,Config.Controls.Drone["explosive"].codes[1]) and explosive >= 100.0 then 381 | local pos = GetEntityCoords(drone) 382 | Drones.Disconnect(drone, drone_data, true) 383 | Drones.DestroyCam(camera) 384 | AddExplosion(pos.x,pos.y,pos.z,1,1.0,true,false,1.0) 385 | return 386 | else 387 | explosive = math.min(100.0, explosive + (1.0 * GetFrameTime())) 388 | end 389 | Scaleforms.PopInt(Drones.DroneScaleform, "SET_DETONATE_PERCENTAGE", math.floor(explosive)) 390 | end 391 | 392 | -- 393 | -- Default Cam Position 394 | -- 395 | if IsDisabledControlPressed(0,Config.Controls.Drone["centercam"].codes[1]) then 396 | camera_rotation = vector3(0.0,0.0,0.0) 397 | end 398 | 399 | -- 400 | -- Return Home 401 | -- 402 | if IsDisabledControlPressed(0,Config.Controls.Drone["home"].codes[1]) then 403 | -- ShowHelpNotification("Eve dönülüyor") 404 | QBCore.Functions.Notify('returning home') 405 | PointCamAtEntity(camera,PlayerPedId(),0.0,0.0,0.0,1) 406 | 407 | local continue_flying = false 408 | local dist = Vdist(GetEntityCoords(drone),GetEntityCoords(PlayerPedId())) 409 | local controls = Drones.CreateControls("home") 410 | Drones.ButtonsScaleform = Instructional.Create(controls) 411 | 412 | Wait(100) 413 | while dist > 3.0 do 414 | local ply_ped = PlayerPedId() 415 | local drone_pos = GetEntityCoords(drone) 416 | local ply_pos = GetEntityCoords(ply_ped) 417 | local direction = -V3ClampMagnitude((drone_pos - ply_pos) * 10.0,(Config.MaxVelocity * drone_data.stats.speed)) 418 | 419 | DisableAllControlActions(0) 420 | SetEntityNoCollisionEntity(ply_ped,drone,true) 421 | 422 | ApplyForceToEntity(drone,0,direction.x,direction.y,20.0 + (V2Dist(drone_pos,ply_pos) <= 5.0 and direction.z or 0.0), 0.0,0.0,0.0, 0, 0,1,1,0,1) 423 | 424 | DrawScaleformMovieFullscreen(Drones.ButtonsScaleform,255,255,255,255,0) 425 | DrawScaleformMovieFullscreen(Drones.DroneScaleform,255,255,255,255,0) 426 | 427 | if IsDisabledControlJustReleased(0,Config.Controls.Homing["cancel"].codes[1]) then 428 | continue_flying = true 429 | Wait(100) 430 | break 431 | elseif IsDisabledControlJustReleased(0, Config.Controls.Homing["disconnect"].codes[1]) then 432 | Wait(100) 433 | break 434 | end 435 | 436 | dist = Vdist(drone_pos,ply_pos) 437 | SetTimecycleModifierStrength(dist / drone_data.stats.range) 438 | Wait(0) 439 | end 440 | 441 | if not continue_flying then 442 | Drones.Disconnect(drone, drone_data) 443 | Drones.DestroyCam(camera) 444 | return 445 | else 446 | local controls = Drones.CreateControls(drone_data.abilities) 447 | Drones.ButtonsScaleform = Instructional.Create(controls) 448 | StopCamPointing(camera) 449 | end 450 | end 451 | 452 | -- 453 | -- Disconnect Drone 454 | -- 455 | if IsDisabledControlJustReleased(0,Config.Controls.Drone["disconnect"].codes[1]) then 456 | Drones.Disconnect(drone, drone_data) 457 | Drones.DestroyCam(camera) 458 | return 459 | end 460 | 461 | -- 462 | -- Drone Movement 463 | -- 464 | local boost_val = Config.BoostSpeed 465 | head = head + (rotation_momentum * drone_data.stats.agility) 466 | 467 | if not did_move then 468 | if V3Magnitude(movement_momentum) > 0.0 then 469 | movement_momentum = movement_momentum - ((movement_momentum / 10.0) * drone_data.stats.agility) 470 | end 471 | end 472 | 473 | ApplyForceToEntity(drone,0,movement_momentum.x,movement_momentum.y,20.0 + movement_momentum.z, 0.0,0.0,0.0, 0, 0,1,1,0,1) 474 | SetEntityHeading(drone,head) 475 | SetCamRot(camera,camera_rotation.x,camera_rotation.y,camera_rotation.z+head,2) 476 | 477 | -- 478 | -- Scaleform 479 | -- 480 | SetTimecycleModifierStrength(dist / drone_data.stats.range) 481 | DrawScaleformMovieFullscreen(Drones.ButtonsScaleform,255,255,255,255,0) 482 | DrawScaleformMovieFullscreen(Drones.DroneScaleform,255,255,255,255,0) 483 | 484 | Wait(0) 485 | end 486 | end 487 | 488 | Drones.DestroyCam = function(cam) 489 | local ply_ped = PlayerPedId() 490 | SetFocusEntity(ply_ped) 491 | ClearTimecycleModifier() 492 | RenderScriptCams(false,true,500,0,0) 493 | Wait(500) 494 | stopAnim() 495 | DestroyCam(cam) 496 | end 497 | 498 | Drones.Disconnect = function(drone, drone_data, destroy) 499 | local ply_pos = GetEntityCoords(PlayerPedId()) 500 | local drone_pos = GetEntityCoords(drone) 501 | 502 | if not destroy and Vdist(drone_pos, ply_pos) <= 10.0 then 503 | -- ShowHelpNotification("Drone geri döndü") 504 | QBCore.Functions.Notify('The drone is back') 505 | TriggerServerEvent("Drones:Back", drone_data) 506 | elseif destroy then 507 | -- ShowHelpNotification("Drone yok oldu") 508 | QBCore.Functions.Notify("The drone disappeared") 509 | else 510 | -- ShowHelpNotification("Drone Bağlantısı Kesildi") 511 | QBCore.Functions.Notify("Drone Disconnected") 512 | local pos = GetGroundZ(drone_pos) + vector3(0.0,0.0,0.8) 513 | TriggerServerEvent("Drones:Disconnect", GetEntityModel(drone), drone_data, pos) 514 | end 515 | 516 | StopSound(Drones.SoundID) 517 | ReleaseSoundId(Drones.SoundID) 518 | Drones.SoundID = nil 519 | 520 | DisplayRadar(Drones.DisplayRadar) 521 | 522 | SetSeethrough(false) 523 | SetNightvision(false) 524 | DeleteObject(drone) 525 | end 526 | 527 | Citizen.CreateThread(function() 528 | ClearTimecycleModifier() 529 | ClearPedTasks(PlayerPedId()) 530 | SetFocusEntity(PlayerPedId()) 531 | end) 532 | 533 | Drones.Use = function(drone_data) 534 | Drones.SceneModels["drone"] = drone_data.model 535 | 536 | Drones.SpawnDrone(drone_data) 537 | 538 | Wait(1000) 539 | FreezeEntityPosition(PlayerPedId(), false) 540 | ClearPedTasks(PlayerPedId()) 541 | end 542 | 543 | Drones.DropDrone = function(drone, drone_data, pos) 544 | Drones.CreateObject(pos, drone, 1) 545 | droneDropped = true 546 | droneDropped_pos = pos 547 | droneDropped_data = drone_data 548 | end 549 | 550 | 551 | Citizen.CreateThread(Drones.Init) 552 | 553 | 554 | RegisterNetEvent("Drones:UseDrone") 555 | AddEventHandler("Drones:UseDrone", Drones.Use) 556 | 557 | RegisterNetEvent("Drones:DropDrone") 558 | AddEventHandler("Drones:DropDrone", Drones.DropDrone) 559 | --------------------------------------------------------------------------------