1
0
Fork 0
forked from Simnation/Main
Main/resources/[standalone]/utility_lib/client/native_min.lua
2025-06-07 08:51:21 +02:00

1 line
No EOL
56 KiB
Lua

_G["xPlayer"],_G["source"],_G["developer"]={},GetPlayerServerId(PlayerId()),function()end;local a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t=AddTextEntry,BeginTextCommandDisplayHelp,EndTextCommandDisplayHelp,SetNotificationTextEntry,AddTextComponentSubstringPlayerName,DrawNotification,GetEntityCoords,World3dToScreen2d,SetTextScale,SetTextFont,SetTextEntry,SetTextCentre,AddTextComponentString,DrawText,DoesEntityExist,GetDistanceBetweenCoords,GetPlayerPed,TriggerEvent,TriggerServerEvent;local u=GetCurrentResourceName()local v={["ESC"]=322,["F1"]=288,["F2"]=289,["F3"]=170,["F5"]=166,["F6"]=167,["F7"]=168,["F8"]=169,["F9"]=56,["F10"]=57,["~"]=243,["1"]=157,["2"]=158,["3"]=160,["4"]=164,["5"]=165,["6"]=159,["7"]=161,["8"]=162,["9"]=163,["-"]=84,["="]=83,["BACKSPACE"]=177,["TAB"]=37,["Q"]=44,["W"]=32,["E"]=38,["R"]=45,["T"]=245,["Y"]=246,["U"]=303,["P"]=199,["["]=39,["]"]=40,["ENTER"]=18,["CAPS"]=137,["A"]=34,["S"]=8,["D"]=9,["F"]=23,["G"]=47,["H"]=74,["K"]=311,["L"]=182,["LEFTSHIFT"]=21,["Z"]=20,["X"]=73,["C"]=26,["V"]=0,["B"]=29,["N"]=249,["M"]=244,[","]=82,["."]=81,["LEFTCTRL"]=36,["LEFTALT"]=19,["SPACE"]=22,["RIGHTCTRL"]=70,["HOME"]=213,["PAGEUP"]=10,["PAGEDOWN"]=11,["DELETE"]=178,["LEFT"]=174,["RIGHT"]=175,["TOP"]=27,["DOWN"]=173,["NENTER"]=201,["N4"]=108,["N5"]=60,["N6"]=107,["N+"]=96,["N-"]=97,["N7"]=117,["N8"]=61,["N9"]=118}DevModeStatus=false;UtilityLibLoaded=true;local w={Cache={PlayerPedId=PlayerPedId(),Marker={},Object={},Dialogue={},Blips={},N3d={},Events={},Guards={},Scenes={},SetData={},Frozen={},FlowDetector={},Textures={},Settings={},EntityStack={},Loop={},SliceGroups={}}}UtilityNet={}Citizen.CreateThreadNow(function()if UFAPI then if u=="utility_lib"then _G["Utility"]=w else _G["UtilityLibrary"]=w end else _G["Utility"]=w end end)UseDelete=function(x)w.Cache.Settings.UseDelete=x end;On=function(type,y,z)RegisterNetEvent("Utility:On:"..(z and"!"or"")..type)local A=AddEventHandler("Utility:On:"..(z and"!"or"")..type,y)table.insert(w.Cache.Events,A)return A end;_G.old_TaskVehicleDriveToCoord=TaskVehicleDriveToCoord;TaskVehicleDriveToCoord=function(ped,B,C,D,E)old_TaskVehicleDriveToCoord(ped,B,C,D or 10.0,0,GetEntityModel(B),2883621,E or 1.0)end;_G.old_DisableControlAction=DisableControlAction;DisableControlAction=function(F,G,H)H=H~=nil and H or true;if v[string.upper(F)]then return old_DisableControlAction(0,v[string.upper(F)],G)else return old_DisableControlAction(F,G,H)end end;DisableControlForSeconds=function(G,I)local J=I;Citizen.CreateThread(function()while J>0 do Citizen.Wait(1000)J=J-1 end;return end)Citizen.CreateThread(function()while J>0 do DisableControlAction(v[string.upper(G)])Citizen.Wait(1)end;return end)end;_G.old_IsControlJustPressed=IsControlJustPressed;IsControlJustPressed=function(K,L,M)if type(K)=="number"then local N=K;local G=L;return old_IsControlJustPressed(N,G)end;developer("^2Created^0","key map",K)local O="keyboard"K=K:lower()if K:find("mouse_")or K:find("iom_wheel")then O="mouse_button"elseif K:find("_index")then O="pad_digitalbutton"elseif K:find("iom_axis")then O="pad_axis"end;RegisterKeyMapping('utility '..u..' '..K,M or'',O,K)local P=nil;Citizen.CreateThread(function()Citizen.Wait(500)P=RegisterNetEvent("Utility:Pressed_"..u.."_"..K,L)table.insert(w.Cache.Events,P)end)end;ShowNotification=function(Q)d('STRING')e(Q)f(false,true)end;ButtonNotification=function(Q)if string.match(Q,"{.*}")then Q=string.multigsub(Q,{"{A}","{B}","{C}","{D}","{E}","{F}","{G}","{H}","{L}","{M}","{N}","{O}","{P}","{Q}","{R}","{S}","{T}","{U}","{V}","{W}","{X}","{Y}","{Z}"},{"~INPUT_VEH_FLY_YAW_LEFT~","~INPUT_SPECIAL_ABILITY_SECONDARY~","~INPUT_LOOK_BEHIND~","~INPUT_MOVE_LR~","~INPUT_CONTEXT~","~INPUT_ARREST~","~INPUT_DETONATE~","~INPUT_VEH_ROOF~","~INPUT_CELLPHONE_CAMERA_FOCUS_LOCK~","~INPUT_INTERACTION_MENU~","~INPUT_REPLAY_ENDPOINT~","~INPUT_FRONTEND_PAUSE~","~INPUT_FRONTEND_LB~","~INPUT_RELOAD~","~INPUT_MOVE_DOWN_ONLY~","~INPUT_MP_TEXT_CHAT_ALL~","~INPUT_REPLAY_SCREENSHOT~","~INPUT_NEXT_CAMERA~","~INPUT_MOVE_UP_ONLY~","~INPUT_VEH_HOTWIRE_LEFT~","~INPUT_VEH_DUCK~","~INPUT_MP_TEXT_CHAT_TEAM~","~INPUT_HUD_SPECIAL~"})end;a('ButtonNotification'..string.len(Q),Q)b('ButtonNotification'..string.len(Q))c(0,false,true,-1)end;ButtonFor=function(Q,R)local S=GetGameTimer()Citizen.CreateThread(function()while GetGameTimer()-S<(R or 5000)do ButtonNotification(Q)Citizen.Wait(1)end end)end;FloatingNotification=function(Q,T)a('FloatingNotification',Q)SetFloatingHelpTextWorldPosition(1,T)SetFloatingHelpTextStyle(1,1,2,-1,3,0)b('FloatingNotification')c(2,false,false,-1)end;MakeEntityFaceEntity=function(U,V,W)local X=g(U,true)local Y=g(V,true)if W then local Z=GetHeadingFromVector_2d(Y.x-X.x,Y.y-X.y)SetEntityHeading(U,Z)else local Z=GetHeadingFromVector_2d(X.x-Y.x,X.y-Y.y)SetEntityHeading(V,Z)end end;DrawText3Ds=function(T,_,a0,a1,a2)if T then local a3,a4,a5=h(T.x,T.y,T.z)if a3 then i(a0 or 0.35,a0 or 0.35)j(a1 or 4)k("STRING")l(1)m(_)o(a4,a5)if a2 then local a6=string.len(_)/370;local a7,a8=string.gsub(a6,"\n","\n")*0.025;if a8==nil then a8=0 end;DrawRect(a4,a5+0.0125,0.025+a6,0.025+a8,0,0,0,90)end end end end;_G.old_TaskPlayAnim=TaskPlayAnim;TaskPlayAnim=function(ped,a9,...)if not HasAnimDictLoaded(a9)then RequestAnimDict(a9)while not HasAnimDictLoaded(a9)do Citizen.Wait(1)end end;old_TaskPlayAnim(ped,a9,...)RemoveAnimDict(a9)end;TaskEasyPlayAnim=function(aa,ab,ac,ad)if ac==nil then ac=51 end;if ad==nil then ad=-1 end;TaskPlayAnim(PlayerPedId(),aa,ab,2.0,2.0,ad,ac,0)if ad>-1 or ad>0 then Citizen.Wait(ad)end end;_G.old_CreateObject=CreateObject;CreateObject=function(ae,...)local af=ae;if type(ae)=="string"then af=GetHashKey(ae)end;if not IsModelValid(af)then error("Model \""..ae.."\" loaded from \""..GetCurrentResourceName().."\" is not valid^0")return end;if not HasModelLoaded(af)then RequestModel(af)while not HasModelLoaded(af)do Citizen.Wait(1)end end;local ag=old_CreateObject(af,...)if w.Cache.Settings.UseDelete then table.insert(w.Cache.EntityStack,ag)end;SetModelAsNoLongerNeeded(af)local ah=0;if NetworkGetEntityIsNetworked(ag)then ah=ObjToNet(ag)SetNetworkIdExistsOnAllMachines(ah,true)SetNetworkIdCanMigrate(ah,true)end;return ag,ah end;_G.old_CreatePed=CreatePed;CreatePed=function(af,...)if type(af)=="string"then af=GetHashKey(af)end;if not HasModelLoaded(af)then RequestModel(af)while not HasModelLoaded(af)do Citizen.Wait(1)end end;local ped=old_CreatePed(0,af,...)SetModelAsNoLongerNeeded(af)local ah=0;if NetworkGetEntityIsNetworked(ped)then ah=PedToNet(ped)SetNetworkIdExistsOnAllMachines(ah,true)SetNetworkIdCanMigrate(ah,true)end;return ped,ah end;SetPedStatic=function(ai,aj)FreezeEntityPosition(ai,aj)SetEntityInvincible(ai,aj)SetBlockingOfNonTemporaryEvents(ai,aj)end;_G.old_CreateVehicle=CreateVehicle;CreateVehicle=function(af,...)if type(af)=="string"then af=GetHashKey(af)end;if not HasModelLoaded(af)then RequestModel(af)while not HasModelLoaded(af)do Citizen.Wait(1)end end;local ak=old_CreateVehicle(af,...)SetModelAsNoLongerNeeded(af)local ah=0;if NetworkGetEntityIsNetworked(ak)then ah=VehToNet(ak)SetNetworkIdExistsOnAllMachines(ah,true)SetNetworkIdCanMigrate(ah,true)end;return ak,ah end;_G.old_DeleteEntity=DeleteEntity;DeleteEntity=function(ai,al)if not al then local am=0;NetworkRequestControlOfEntity(ai)while not NetworkRequestControlOfEntity(ai)and am<10 do am=am+1;Citizen.Wait(1)end;if not IsEntityAMissionEntity(ai)then SetEntityAsMissionEntity(ai)end;old_DeleteEntity(ai)else NetworkRequestControlOfNetworkId(ai)local an=NetworkGetEntityFromNetworkId(ai)local am=0;while not NetworkRequestControlOfEntity(an)and am<10 do am=am+1;Citizen.Wait(1)end;SetEntityAsMissionEntity(an)old_DeleteEntity(an)end end;_G.old_GetPlayerName=GetPlayerName;GetPlayerName=function(ao)return old_GetPlayerName(ao or PlayerId())end;_G.old_PlayerPedId=PlayerPedId;PlayerPedId=function()if not p(w.Cache.PlayerPedId)then w.Cache.PlayerPedId=old_PlayerPedId()end;return w.Cache.PlayerPedId end;StopLoop=function(ao)w.Cache.Loop[ao].status=false end;CreateLoop=function(L,ap,aq)local ar=RandomId(5)w.Cache.Loop[ar]={status=true,func=L,tick=ap}if aq~=false then Citizen.CreateThread(function()while w.Cache.Loop[ar]and w.Cache.Loop[ar].status do L(ar)Citizen.Wait(ap or 1)end end)end;return ar end;PauseLoop=function(ar,as)Citizen.SetTimeout(as or 0,function()print("Pausing loop "..ar)w.Cache.Loop[ar].status=false end)end;ResumeLoop=function(ar,as)local at=w.Cache.Loop[ar]Citizen.SetTimeout(as or 0,function()print("Resuming loop "..ar)at.status=true;Citizen.CreateThread(function()while at and at.status do at.func(ar)Citizen.Wait(at.tick or 1)end end)end)end;GetWorldClosestPed=function(au)local av=0;local aw=GetGamePool("CPed")local T=g(PlayerPedId())local ax=au+5.0;for ay=1,#aw do local az=q(T,g(aw[ay]),false)if az<=au and aw[ay]~=PlayerPedId()then if ax>az then ax=az;av=aw[ay]end end end;return av,aw end;GetWorldClosestPlayer=function(au)local av=0;local aA={}local ax=au+5.0;local aw=GetGamePool("CPed")local T=g(PlayerPedId())for ay=1,#aw do if IsPedAPlayer(aw[ay])then table.insert(aA,NetworkGetPlayerIndexFromPed(aw[ay]))local az=q(T,g(aw[ay]),false)if az<=au and aw[ay]~=PlayerPedId()then if ax>az then ax=az;av=NetworkGetPlayerIndexFromPed(aw[ay])end end end end;return av,aA end;GetEntitySurfaceMaterial=function(ai)local T=GetEntityCoords(ai)local aB=StartShapeTestCapsule(T.x,T.y,T.z,T.x,T.y,T.z-2.5,2,1,ai,7)local a7,aC,a7,a7,aD=GetShapeTestResultIncludingMaterial(aB)return aD,aC end;GetLoadoutOfPed=function(ped)local aE=ESX.GetWeaponList()local aF={}for ay=1,#aE,1 do local hash=GetHashKey(aE.name)if HasPedGotWeapon(ped,hash,false)then table.insert(aF,{name=aE.name,hash=hash,ammo=GetAmmoInPedWeapon(ped,hash)})end end;return aF end;local aG=FreezeEntityPosition;FreezeEntityPosition=function(ai,aj)w.Cache.Frozen[ai]=aj;aG(ai,aj)end;IsEntityFrozen=function(ai)return w.Cache.Frozen[ai]==true end;GetNearestValue=function(aH,aI)local aJ=100*100000000000;local aK=0;for ay=1,#aI do local aL=math.abs(aI[ay]-aH)if aL<aJ then aJ=aL;n=aI[ay]aK=ay end end;return n,aJ,aK end;StartESX=function(aM,aN)Citizen.CreateThreadNow(function()ESX=exports["es_extended"]:getSharedObject()while ESX.GetPlayerData().job==nil do Citizen.Wait(1)end;uPlayer=ESX.GetPlayerData()xPlayer=uPlayer;if aN~=nil then while ESX.GetPlayerData()[aN]==nil do Citizen.Wait(1)end;uPlayer=ESX.GetPlayerData()xPlayer=uPlayer end;if aN~=nil then RegisterNetEvent('esx:set'..string.upper(aN:sub(1,1))..aN:sub(2),function(aO)uPlayer[aN]=aO;xPlayer=uPlayer end)end;RegisterNetEvent('esx:setJob',function(aO)uPlayer.job=aO;xPlayer=uPlayer;if OnJobUpdate then OnJobUpdate()end end)end)end;StartQB=function()QBCore=exports['qb-core']:GetCoreObject()uPlayer=QBCore.Functions.GetPlayerData()Player=uPlayer;RegisterNetEvent('QBCore:Client:OnPlayerLoaded',function()uPlayer=QBCore.Functions.GetPlayerData()Player=uPlayer end)RegisterNetEvent('QBCore:Client:OnJobUpdate',function(aP)uPlayer.job=aP;Player=uPlayer;if OnJobUpdate then OnJobUpdate()end end)end;StartFramework=function()if GetResourceState("qb-core")~="missing"then StartQB()return true elseif GetResourceState("es_extended")~="missing"then StartESX()return true end end;GetDataForJob=function(aO)local aQ=promise:new()if GetResourceState("es_extended")=="started"then ESX.TriggerServerCallback("Utility:GetJobData",function(aR)aQ:resolve(aR)end,aO)elseif GetResourceState("qb-core")=="started"then QBCore.Functions.TriggerCallback("Utility:GetJobData",function(aR)aQ:resolve(aR)end,aO)end;aQ=Citizen.Await(aQ)return#aQ,aQ end;local aS=0;GetOnHandObject=function()return aS end;TakeObjectOnHand=function(ped,aT,aU,aV,aW,aX,aY,aZ,a_)developer("^2Taking^0","object",aT.." ("..GetEntityModel(aT)..")")if type(aT)=="number"then NetworkRequestControlOfEntity(aT)while not NetworkHasControlOfEntity(aT)do Citizen.Wait(1)end;TaskPlayAnim(ped,"anim@heists@box_carry@","idle",3.0,3.0,-1,63,0,0,0,0)Citizen.Wait(100)AttachEntityToEntity(aT,ped,GetPedBoneIndex(ped,60309),aV or 0.2,aW or 0.08,aX or 0.2,aY or-45.0,aZ or 290.0,a_ or 0.0,true,true,false,true,1,true)aS=aT elseif type(aT)=="string"then local T=g(ped)local b0=CreateObject(aT,T+vector3(0.0,0.0,aU or 0.2),true,false,false)SetEntityAsMissionEntity(b0)TaskPlayAnim(ped,"anim@heists@box_carry@","idle",3.0,-8,-1,63,0,0,0,0)Citizen.Wait(100)AttachEntityToEntity(b0,ped,GetPedBoneIndex(ped,60309),aV or 0.2,aW or 0.08,aX or 0.2,aY or-45.0,aZ or 290.0,a_ or 0.0,true,true,false,true,1,true)aS=b0;return b0 end end;DropObjectFromHand=function(b1,b2)if b2 then developer("^1Deleting^0","from hand",b1)DeleteEntity(b1)else developer("^3Dont delete^0","from hand",b1)DetachEntity(b1)SetEntityCoords(b1,GetOffsetFromEntityInWorldCoords(b1,0,0.5,0))PlaceObjectOnGroundProperly(b1)FreezeEntityPosition(b1,true)end;ClearPedTasks(PlayerPedId())aS=0 end;IsInRadius=function(X,Y,au,b3)local az=#(X-Y)if b3 then DrawSphere(Y,au,255,0,0,0.5)end;return az<au end;IsNearCoords=function(T,au,b3)local az=#(GetEntityCoords(PlayerPedId())-T)if b3 then DrawSphere(T,au,255,0,0,0.5)end;return az<au end;GenerateRandomCoords=function(T,au,Z)local b4=T.x+math.random(-au,au)local b5=T.y+math.random(-au,au)local a7,b6=GetGroundZFor_3dCoord(b4,b5,200.0,0)if Z then return vector3(b4,b5,b6),math.random(0.0,360.0)end;return vector3(b4,b5,b6)end;SetFor=function(ao,b7,b8)if w.Cache["SetData"][ao]==nil then w.Cache["SetData"][ao]={}end;if type(b7)=="table"then for b9,aH in pairs(b7)do if type(aH)=="function"then developer("^2Setting^0","data","("..ao..") ["..b9 .." = "..tostring(aH).."] {table}")else developer("^2Setting^0","data","("..ao..") ["..b9 .." = "..json.encode(aH).."] {table}")end;w.Cache["SetData"][ao][b9]=aH end else if type(b8)=="function"then developer("^2Setting^0","data","("..ao..") ["..b7 .." = "..tostring(b8).."] {single}")else developer("^2Setting^0","data","("..ao..") ["..b7 .." = "..json.encode(b8).."] {single}")end;w.Cache["SetData"][ao][b7]=b8 end end;GetFrom=function(ao,b7)if b7==nil then b7="not defined"end;developer("^3Getting^0","data","("..ao..") ["..b7 .."]")if w.Cache["SetData"][ao]~=nil then if b7=="not defined"then return w.Cache["SetData"][ao]else return w.Cache["SetData"][ao][b7]end else return nil end end;local ba=100.0;local bb=8100;local bc=bb/ba;function GetSliceColRowFromCoords(T)local bd=math.floor(T.x/ba)local be=math.floor(T.y/ba)return be,bd end;function GetWorldCoordsFromSlice(bf)local be=math.floor(bf/bc)local bd=bf%bc;return vec3(bd*ba,be*ba,0.0)end;function GetSliceIdFromColRow(be,bd)return math.floor(be*bc+bd)end;function GetSliceFromCoords(bg)local be,bd=GetSliceColRowFromCoords(bg)return GetSliceIdFromColRow(be,bd)end;function GetEntitySlice(ped)return GetSliceFromCoords(GetEntityCoords(ped))end;function GetPlayerSlice(bh)local ped=GetPlayerPed(bh)return GetSliceFromCoords(GetEntityCoords(ped))end;function GetSelfSlice()local ped=PlayerPedId()return GetSliceFromCoords(GetEntityCoords(ped))end;function IsOnScreen(T)local a3,a4,a5=World3dToScreen2d(T.x,T.y,T.z)return a3 end;function GetSurroundingSlices(bf)local bi=bf-bc;local bj=bf+bc;local bk=bf-1;local bl=bf+1;local bm=bf-bc-1;local bn=bf-bc+1;local bo=bf+bc-1;local bp=bf+bc+1;return{bi,bj,bl,bk,bm,bn,bo,bp}end;function DrawDebugSlice(bf,bq,aU)local br={}local bs=bq and GetSurroundingSlices(bf)or{}for b9,aH in pairs({bf,table.unpack(bs)})do local bt=bf+bc+1;table.insert(br,{GetWorldCoordsFromSlice(aH)+vec3(0.0,0.0,aU or 500.0),GetWorldCoordsFromSlice(bt)+vec3(0.0,0.0,aU or 500.0)})end;local bu={{255,0,0},{0,255,0},{0,0,255},{255,255,0},{0,255,255},{255,0,255},{255,255,255}}for ay=1,#br do local bv=bu[ay%#bu+1]DrawBox(br[ay][1],br[ay][2],bv[1],bv[2],bv[3],150)end end;function SliceUsed(bf)return w.Cache.SliceGroups[bf]or false end;function SetSliceUsed(bf,b8)bf=tonumber(bf)if b8 then w.Cache.SliceGroups[bf]=b8 else w.Cache.SliceGroups[bf]=nil end end;RandomId=function(bw)bw=bw or 5;local bx=""for ay=1,bw do bx=bx.."9"end;return math.random(0,bx)end;CreateMarker=function(ao,T,by,bz,bA)if DoesExist("m",ao)then Citizen.Wait(100)return else if type(T)~="vector3"then developer("^1Error^0","You can use only vector3 for coords!",ao)return end;ao=string.gsub(ao,"{r}",RandomId())developer("^2Created^0","Marker",ao)local bB={render_distance=by,interaction_distance=bz,coords=T,slice=bA and bA.slice=="ignore"and"ignore"or GetSliceFromCoords(T)}if type(bA)=="table"then if bA.rgb~=nil then bB.type=1;bB.rgb=bA.rgb elseif bA.text~=nil then bB.type=0;bB.text=bA.text else bB.type=1;bB.rgb={bA[1],bA[2],bA[3]}end;if bA.type~=nil and type(bA.type)=="number"then bB._type=bA.type end;if bA.direction~=nil and type(bA.direction)=="vector3"then bB._direction=bA.direction end;if bA.rotation~=nil and type(bA.rotation)=="vector3"then bB._rot=bA.rotation end;if bA.scale~=nil and type(bA.scale)=="vector3"then bB._scale=bA.scale end;if bA.alpha~=nil and type(bA.alpha)=="number"then bB.alpha=bA.alpha end;if bA.animation~=nil and type(bA.animation)=="boolean"then bB.anim=bA.animation end;if bA.job~=nil then bB.job=bA.job end;if bA.notify~=nil then local bC=string.multigsub(bA.notify,{"{A}","{B}","{C}","{D}","{E}","{F}","{G}","{H}","{L}","{M}","{N}","{O}","{P}","{Q}","{R}","{S}","{T}","{U}","{V}","{W}","{X}","{Y}","{Z}"},{"~INPUT_VEH_FLY_YAW_LEFT~","~INPUT_SPECIAL_ABILITY_SECONDARY~","~INPUT_LOOK_BEHIND~","~INPUT_MOVE_LR~","~INPUT_CONTEXT~","~INPUT_ARREST~","~INPUT_DETONATE~","~INPUT_VEH_ROOF~","~INPUT_CELLPHONE_CAMERA_FOCUS_LOCK~","~INPUT_INTERACTION_MENU~","~INPUT_REPLAY_ENDPOINT~","~INPUT_FRONTEND_PAUSE~","~INPUT_FRONTEND_LB~","~INPUT_RELOAD~","~INPUT_MOVE_DOWN_ONLY~","~INPUT_MP_TEXT_CHAT_ALL~","~INPUT_REPLAY_SCREENSHOT~","~INPUT_NEXT_CAMERA~","~INPUT_MOVE_UP_ONLY~","~INPUT_VEH_HOTWIRE_LEFT~","~INPUT_VEH_DUCK~","~INPUT_MP_TEXT_CHAT_TEAM~","~INPUT_HUD_SPECIAL~"})bB.notify=bC end elseif type(bA)=="string"then bB.type=0;bB.text=bA end;w.Cache.Marker[ao]=bB;s("Utility:Create","Marker",ao,bB)end end;SetMarker=function(ao,bD,K,b8)if type(b8)~=bD and b8~=nil then developer("^1Error^0",K.." can be only a "..bD,"[Marker]")return end;if DoesExist("marker",ao)then w.Cache.Marker[ao][K]=b8;s("Utility:Edit","Marker",ao,K,b8)else developer("^1Error^0","Unable to edit the marker as it does not exist",ao)end end;SetMarkerType=function(ao,bD)SetMarker(ao,"number","_type",bD)end;SetMarkerDirection=function(ao,bE)SetMarker(ao,"vector3","_direction",bE)end;SetMarkerRotation=function(ao,bF)SetMarker(ao,"vector3","_rot",bF)end;SetMarkerScale=function(ao,a0)SetMarker(ao,"vector3","_scale",a0)end;SetMarkerColor=function(ao,bG)SetMarker(ao,"table","rgb",bG)end;SetMarkerCoords=function(ao,T)SetMarker(ao,"string","slice",tostring(GetSliceFromCoords(T)))SetMarker(ao,"vector3","coords",T)end;SetMarkerRenderDistance=function(ao,by)SetMarker(ao,"number","render_distance",by)end;SetMarkerInteractionDistance=function(ao,bz)SetMarker(ao,"number","interaction_distance",bz)end;SetMarkerAlpha=function(ao,bH)SetMarker(ao,"number","alpha",bH)end;SetMarkerAnimation=function(ao,aj)SetMarker(ao,"boolean","anim",aj)end;SetMarkerDrawOnEntity=function(ao,aj)SetMarker(ao,"boolean","draw_entity",aj)end;SetMarkerNotify=function(ao,_)if type(_)=="string"then _=string.multigsub(_,{"{A}","{B}","{C}","{D}","{E}","{F}","{G}","{H}","{L}","{M}","{N}","{O}","{P}","{Q}","{R}","{S}","{T}","{U}","{V}","{W}","{X}","{Y}","{Z}"},{"~INPUT_VEH_FLY_YAW_LEFT~","~INPUT_SPECIAL_ABILITY_SECONDARY~","~INPUT_LOOK_BEHIND~","~INPUT_MOVE_LR~","~INPUT_PICKUP~","~INPUT_ARREST~","~INPUT_DETONATE~","~INPUT_VEH_ROOF~","~INPUT_CELLPHONE_CAMERA_FOCUS_LOCK~","~INPUT_INTERACTION_MENU~","~INPUT_REPLAY_ENDPOINT~","~INPUT_FRONTEND_PAUSE~","~INPUT_FRONTEND_LB~","~INPUT_RELOAD~","~INPUT_MOVE_DOWN_ONLY~","~INPUT_MP_TEXT_CHAT_ALL~","~INPUT_REPLAY_SCREENSHOT~","~INPUT_NEXT_CAMERA~","~INPUT_MOVE_UP_ONLY~","~INPUT_VEH_HOTWIRE_LEFT~","~INPUT_VEH_DUCK~","~INPUT_MP_TEXT_CHAT_TEAM~","~INPUT_HUD_SPECIAL~"})end;SetMarker(ao,"string","notify",_)end;Set3dText=function(ao,_)SetMarker(ao,"string","text",_)end;Set3dTextScale=function(ao,a0)SetMarker(ao,"number","_scale",a0)end;Set3dTextDrawRect=function(ao,aj)SetMarker(ao,"boolean","rect",aj)end;Set3dTextFont=function(ao,a1)SetMarker(ao,"number","font",a1)end;DeleteMarker=function(ao)if not DoesExist("m",ao)then Citizen.Wait(100)return else developer("^1Deleted^0","Marker",ao)w.Cache.Marker[ao]=nil;s("Utility:Remove","Marker",ao)ClearAllHelpMessages()end end;CreateiObject=function(ao,ae,bg,Z,bz,bI,aO)developer("^2Created^0 Object "..ao.." ("..ae..")")local ag;if bI~=nil then ag=CreateObject(GetHashKey(ae),bg.x,bg.y,bg.z,bI,false,false)or nil else ag=CreateObject(GetHashKey(ae),bg.x,bg.y,bg.z,true,false,false)or nil end;SetEntityHeading(ag,Z)SetEntityAsMissionEntity(ag,true,true)FreezeEntityPosition(ag,true)SetModelAsNoLongerNeeded(hash)_object={obj=ag,coords=bg,interaction_distance=bz or 3.0,slice=GetSliceFromCoords(bg),job=aO}w.Cache.Object[ao]=_object;s("Utility:Create","Object",ao,_object)return ag,g(ag)end;DeleteiObject=function(ao,b2)developer("^1Deleted^0","Object",ao)if b2 then DeleteEntity(w.Cache.Object[ao].obj)end;w.Cache.Object[ao]=nil;s("Utility:Remove","Object",ao)end;CreateBlip=function(bJ,T,bK,bL,a0)developer("^2Created^0","Blip",bJ)local bM=AddBlipForCoord(T)SetBlipSprite(bM,bK)SetBlipScale(bM,a0 or 1.0)SetBlipColour(bM,bL)SetBlipAsShortRange(bM,true)BeginTextCommandSetBlipName('STRING')e(bJ)EndTextCommandSetBlipName(bM)return bM end;CreateJobBlip=function(bJ,T,aO,bK,bL,a0)s("Utility:Create","Blips",math.random(10000,99999),{name=bJ,coords=T,job=aO,sprite=bK,colour=bL,scale=a0 or 1.0})end;SetIdOf=function(type,ao,bN)if type:lower()=="marker"or type:lower()=="m"then type="Marker"elseif type:lower()=="object"or type:lower()=="o"then type="Object"else return nil end;if DoesExist(type,ao)then w.Cache[type][bN]=w.Cache[type][ao]w.Cache[type][ao]=nil else developer("^1Error^0","Unable to set id of the "..type.." as it does not exist",ao)return end;developer("^3Change^0","Setted id to "..bN.." of the id",ao)s("Utility:Remove",type,ao)s("Utility:Create",type,bN,w.Cache[type][bN])end;GetDistanceFrom=function(type,ao)if type:lower()=="marker"or type:lower()=="m"then type="Marker"elseif type:lower()=="object"or type:lower()=="o"then type="Object"else return nil end;local az=0.0;if w.Cache[type][ao].coords~=nil then return q(g(PlayerPedId()),w.Cache[type][ao].coords,true)else return false end end;GetCoordOf=function(type,ao)if type:lower()=="marker"or type:lower()=="m"then type="Marker"elseif type:lower()=="object"or type:lower()=="o"then type="Object"else return nil end;if DoesExist(type,ao)then return w.Cache[type][ao].coords else developer("^1Error^0","Unable to get the coords of the id",ao)return false end end;DoesExist=function(type,ao)if type:lower()=="marker"or type:lower()=="m"then type="Marker"elseif type:lower()=="object"or type:lower()=="o"then type="Object"else return nil end;if w.Cache[type][ao]~=nil then return true else return false end end;CreateCamera=function(T,bO,aj,bP)local bQ=CreateCam("DEFAULT_SCRIPTED_CAMERA",true)SetCamCoord(bQ,T)if bO~=nil then SetCamRot(bQ,bO.x,bO.y,bO.z)end;if bP~=nil then ShakeCam(bQ,bP.type or"",bP.amount or 0.0)end;if aj then SetCamActive(bQ,true)RenderScriptCams(1,1,1500)end;return bQ end;SwitchBetweenCam=function(bR,bQ,ad)SetCamActiveWithInterp(bQ,bR,ad or 1500,1,1)Citizen.Wait(ad or 1500)DestroyCam(bR)end;DevMode=function(bS,bT,bU)DevModeStatus=bS;if bT==nil then bT=true end;bU=bU or"%s %s %s"if bS then developer=function(bV,type,ao)local a7,a7,a7,bW,bX,bY=GetLocalTime()if bT then if type==nil then print(bW..":"..bX..":"..bY.." - "..bV)else print(bW..":"..bX..":"..bY.." - "..string.format(bU,bV,type,ao or""))end else if type==nil then print(bV)else print(string.format(bU,bV,type,ao or""))end end end else developer=function()end end end;ReplaceTexture=function(b0,bZ,b_,c0,c1)local c2=b0 ..":"..bZ..":"local c3=c2 ..":"..b_;if not w.Cache.Textures[c3]then local c4=CreateRuntimeTxd(c2 ..'duiTxd')local c5=CreateDui(b_,c0,c1)local c6=GetDuiHandle(c5)CreateRuntimeTextureFromDuiHandle(c4,c2 ..'duiTex',c6)w.Cache.Textures[c3]=true end;AddReplaceTexture(b0,bZ,c2 .."duiTxd",c2 .."duiTex")end;printd=function(c7,c8)if c8 then local c9={}local function ca(cb,cc)if c9[tostring(cb)]then print(cc.."*"..tostring(cb))else c9[tostring(cb)]=true;if type(cb)=="table"then for bg,cd in pairs(cb)do if type(cd)=="table"then print(cc.."["..bg.."] => "..tostring(cb).." {")ca(cd,cc..string.rep(" ",string.len(bg)+8))print(cc..string.rep(" ",string.len(bg)+6).."}")elseif type(cd)=="string"then print(cc.."["..bg.."] => \""..cd.."\"")else print(cc.."["..bg.."] => "..tostring(cd))end end else print(cc..tostring(cb))end end end;if type(c7)=="table"then print(tostring(c7).." {")ca(c7," ")print("}")else developer("^1Error^0","error dumping table "..c7 .." why isnt a table")end else if type(c7)=="table"then print(json.encode(c7,{indent=true}))else developer("^1Error^0","error dumping table "..c7 .." why isnt a table")end end end;local ce=string.gsub;string.multigsub=function(string,table,cf)if type(table)then for ay=1,#table do string=ce(string,table[ay],cf[ay])end else for ay=1,#table do string=ce(string,table[ay],cf)end end;return string end;table.fexist=function(c7,cg)return c7[cg]~=nil end;local ch=table.remove;table.remove=function(c7,ci,cj)if type(ci)=="number"then return ch(c7,ci)elseif type(ci)=="string"then for b9,aH in pairs(c7)do if b9==ci then c7[b9]=nil;if cj then return b9 end end end end end;table.empty=function(cb)return next(cb)==nil end;local ck=function(cb,b9,aH)if type(b9)=="number"then table.insert(cb,aH)else cb[b9]=aH end end;table.merge=function(cl,cm)local cn=table.clone(cl)for b9,aH in pairs(cm)do ck(cn,b9,aH)end;return cn end;table.includes=function(cb,b8)if type(b8)=="function"then for a7,aH in pairs(cb)do if b8(aH)then return true end end else for a7,aH in pairs(cb)do if b8==aH then return true end end end;return false end;table.filter=function(cb,co)local cn={}if type(co)=="function"then for b9,aH in pairs(cb)do if co(b9,aH)then ck(cn,b9,aH)end end elseif type(co)=="table"then for b9,aH in pairs(cb)do if table.includes(co,aH)then ck(cn,b9,aH)end end end;return cn end;table.find=function(cb,b8)if type(b8)=="function"then for b9,aH in pairs(cb)do if b8(aH)then return b9,aH end end else for b9,aH in pairs(cb)do if b8==aH then return b9,aH end end end end;table.keys=function(cb)local cp={}for b9,a7 in pairs(cb)do table.insert(cp,b9)end;return cp end;table.values=function(cb)local cq={}for a7,aH in pairs(cb)do table.insert(cq,aH)end;return cq end;math.round=function(cr,cs)local a7=10^cs;return math.floor(cr*a7+0.5)/a7 end;local function ct(ai,cu,cv)return{Question=function(...)cu.questions={...}return ct(ai,cu,cv)end,Response=function(...)local cw={...}local cx={}local cy={}for cz,cA in pairs(cw)do cy[cz]={}for b9,aH in pairs(cA)do if cx[cz]==nil then cx[cz]=""end;cx[cz]=cx[cz]..b9 .."~w~ "..aH.." | "b9=string.multigsub(b9,{"%[","%]"},{"",""})b9=string.multigsub(b9,{"~r~","~b~","~g~","~y~","~p~","~o~","~c~","~m~","~u~","~n~","~s~","~w~"},{"","","","","","","","","","","",""})cy[cz][b9]=aH end;cx[cz]=cx[cz]:sub(1,-3)end;cu.response={no_formatted=cy,formatted=cx}if cv then s("Utility:Remove","Dialogue",ai)s("Utility:Create","Dialogue",ai,cu)else s("Utility:Create","Dialogue",ai,cu)end;w.Cache.Dialogue[ai]=cu;return ct(ai,cu,cv)end,LastQuestion=function(cB)w.Cache.Dialogue[ai].lastQuestion=cB;s("Utility:Edit","Dialogue",ai,"lastQuestion",cB)return ct(ai,cu,cv)end}end;StartDialogue=function(ai,az,cC,cD)local cu={entity=ai,distance=az,curQuestion=1,callback=cC,stopWhenTalking=cD,slice=GetEntitySlice(ai)}developer("^2Created^0","dialogue with entity",ai)return ct(ai,cu)end;EditDialogue=function(ai)if ai~=nil and IsEntityOnDialogue(ai)then return ct(ai,w.Cache.Dialogue[ai],true)end end;StopDialogue=function(ai,cE)if ai~=nil and IsEntityOnDialogue(ai)then developer("^1Stopping^0","dialogue",ai)if cE then w.Cache.Dialogue[ai]=nil else local cF=w.Cache.Dialogue[ai].questions[1]s("Utility:Edit","Dialogue",ai,"curQuestion",#cF)end end end;IsEntityOnDialogue=function(ai)return w.Cache.Dialogue[ai]end;RegisterNetEvent("Utility:DeleteDialogue",function(ai)w.Cache.Dialogue[ai]=nil end)function GetScaleformsStatus()local cG={}local cH={}for ay=1,10 do local cI="utility_lib_"..ay;if IsScaleformTaken(cI)then table.insert(cG,{name=cI,data=w.Cache.N3d[cI]})else table.insert(cH,{name=cI,data={txd=false,show=false,rotation={}}})end end;return cG,cH end;function IsScaleformTaken(cI)return w.Cache.N3d[cI]~=nil end;local cJ=RequestScaleformMovie;local function RequestScaleformMovie(cK)local cL,cM=pcall(cJ,cK)while not cL do cL,cM=pcall(cJ,cK)Citizen.Wait(1)end;return cM end;local function cN(cO,cI)local cP=RequestScaleformMovie(cI)local cQ=GetGameTimer()while not HasScaleformMovieLoaded(cP)and GetGameTimer()-cQ<4000 do Citizen.Wait(0)end;if GetGameTimer()-cQ>4000 then developer("^1Error^0","After 4000 ms to load the scaleform the scaleform has not loaded yet, try again or check that it has started correctly!")return end;w.Cache.N3d[cO].scaleform=cP;s("Utility:Edit","N3d",cO,"scaleform",cP)end;local function cR(cO,b_,c0,c1)local c4=CreateRuntimeTxd('txd'..cO)w.Cache.N3d[cO].dui=CreateDui(b_,c0,c1)s("Utility:Edit","N3d",cO,"dui",w.Cache.N3d[cO].dui)while not IsDuiAvailable(w.Cache.N3d[cO].dui)do Citizen.Wait(1)end;local c6=GetDuiHandle(w.Cache.N3d[cO].dui)CreateRuntimeTextureFromDuiHandle(c4,'txn'..cO,c6)if w.Cache.N3d[cO].scaleform~=nil and not w.Cache.N3d[cO].txd then BeginScaleformMovieMethod(w.Cache.N3d[cO].scaleform,'SET_TEXTURE')ScaleformMovieMethodAddParamTextureNameString('txd'..cO)ScaleformMovieMethodAddParamTextureNameString('txn'..cO)ScaleformMovieMethodAddParamInt(0)ScaleformMovieMethodAddParamInt(0)ScaleformMovieMethodAddParamInt(c0)ScaleformMovieMethodAddParamInt(c1)EndScaleformMovieMethod()w.Cache.N3d[cO].txd=true;s("Utility:Edit","N3d",cO,"txd",true)end end;function CreateNui3d(cI,b_)local cO=tostring(math.random(0,9999))local cS={txd=false,show=false,rotation={}}w.Cache.N3d[cO]=cS;s("Utility:Create","N3d",cO,cS)cN(cO,cI)if b_~=nil then developer("^2Starting^0",cO.." with url ".."nui://"..GetCurrentResourceName().."/"..b_.." sf "..cI)cR(cO,"nui://"..GetCurrentResourceName().."/"..b_,1920,1080)end;local cT={}cT.__index=cT;cT.init=function(self,b_,c0,c1)cR(cO,"nui://"..GetCurrentResourceName().."/"..b_,c0 or 1920,c1 or 1080)end;cT.datas=function(self)return w.Cache.N3d[cO]end;cT.scale=function(self,a0)w.Cache.N3d[cO].advanced_scale=a0;s("Utility:Edit","N3d",cO,"advanced_scale",a0)end;cT.rotation=function(self,bO,cU)w.Cache.N3d[cO].rotation.rotation=bO;w.Cache.N3d[cO].rotation.syncedwithplayer=cU;s("Utility:Edit","N3d",cO,"rotation",{rotation=bO,syncedwithplayer=cU})end;cT.destroy=function(self)if w.Cache.N3d[cO].dui~=nil then DestroyDui(w.Cache.N3d[cO].dui)SetScaleformMovieAsNoLongerNeeded(w.Cache.N3d[cO].scaleform)w.Cache.N3d[cO]=nil;s("Utility:Remove","N3d",cO)end end;cT.started=function()return w.Cache.N3d[cO].dui~=nil end;cT.show=function(self,T,a0)w.Cache.N3d[cO].coords=T;w.Cache.N3d[cO].scale=a0 or 0.1;w.Cache.N3d[cO].show=true;s("Utility:Edit","N3d",cO,"coords",T)s("Utility:Edit","N3d",cO,"scale",a0 or 0.1)s("Utility:Edit","N3d",cO,"show",true)end;cT.visible=function()return w.Cache.N3d[cO].show end;cT.hide=function()w.Cache.N3d[cO].show=false;s("Utility:Edit","N3d",cO,"show",false)end;cT.attach=function(self,ai,cV)w.Cache.N3d[cO].attach={entity=ai,offset=cV or vector3(0.0,0.0,0.0)}s("Utility:Edit","N3d",cO,"attach",{entity=ai,offset=cV or vector3(0.0,0.0,0.0)})end;cT.detach=function(self,cW)if cW then w.Cache.N3d[cO].coords=GetEntityCoords(w.Cache.N3d[cO].attach.entity)s("Utility:Edit","N3d",cO,"coords",w.Cache.N3d[cO].coords)end;w.Cache.N3d[cO].attach=nil;s("Utility:Edit","N3d",cO,"attach",nil)end;cT.object=function()return w.Cache.N3d[cO].dui end;cT.msg=function(self,Q)if self:started()then SendDuiMessage(self:object(),json.encode(Q))end end;cT.replaceTexture=function(self,aa,bZ,cX)if cX then Citizen.Wait(cX)end;AddReplaceTexture(aa,bZ,'txd'..cO,'txn'..cO)end;return setmetatable({},cT),cO end;AddEventHandler("onResourceStop",function(cY)if cY==u then for ay=1,#w.Cache.Events do RemoveEventHandler(w.Cache.Events[ay])end;for cZ,c_ in pairs(w.Cache.N3d)do if c_.dui~=nil and IsDuiAvailable(c_.dui)then DestroyDui(c_.dui)end;s("Utility:Remove","N3d",cZ)end;if w.Cache.Settings.UseDelete then for ay=1,#w.Cache.EntityStack do local d0=w.Cache.EntityStack[ay]NetworkRequestControlOfEntity(d0)if DoesEntityExist(d0)then DeleteEntity(d0)end end end end end)local d1=10;local d2=0.01;local d3=0.0000001;local d4=10;local d5=11;local d6=1.0/(d5-1.0)local function d7(d8,d9)return 1.0-3.0*d9+3.0*d8 end;local function da(d8,d9)return 3.0*d9-6.0*d8 end;local function db(d8)return 3.0*d8 end;local function dc(dd,d8,d9)return((d7(d8,d9)*dd+da(d8,d9))*dd+db(d8))*dd end;local function de(dd,d8,d9)return 3.0*d7(d8,d9)*dd*dd+2.0*da(d8,d9)*dd+db(d8)end;local function df(dg,dh,di,dj,dk)local dl,dm,ay=0,0,0;repeat dm=dh+(di-dh)/2.0;dl=dc(dm,dj,dk)-dg;if dl>0.0 then di=dm else dh=dm end;ay=ay+1 until math.abs(dl)<=d3 or ay>=d4;return dm end;local function dn(dg,dp,dj,dk)for ay=1,d1 do local dq=de(dp,dj,dk)if dq==0.0 then return dp end;local dl=dc(dp,dj,dk)-dg;dp=dp-dl/dq end;return dp end;local function dr(b4)return b4 end;local function ds(dj,dt,dk,du)if not(0<=dj and dj<=1 and 0<=dk and dk<=1)then error('bezier x values must be in [0, 1] range')end;if dj==dt and dk==du then return dr end;local dv={}for ay=1,d5 do dv[ay]=dc((ay-1)*d6,dj,dk)end;local function dw(dg)local dx=0.0;local dy=1;local dz=d5-1;while dy~=dz and dv[dy]<=dg do dx=dx+d6;dy=dy+1 end;dy=dy-1;local dA=(dg-dv[dy])/(dv[dy+1]-dv[dy])local dB=dx+dA*d6;local dC=de(dB,dj,dk)if dC>=d2 then return dn(dg,dB,dj,dk)elseif dC==0.0 then return dB else return df(dg,dx,dx+d6,dj,dk)end end;return function(b4)if b4==0 or b4==1 then return b4 end;return dc(dw(b4),dt,du)end end;local dD={ease={0.25,0.1,0.25,1},easeIn={0.42,0,1,1},easeOut={0,0,0.58,1},easeInOut={0.42,0,0.58,1}}TranslateObjectCoordsCubicBezier=function(ag,C,ad,dE)local dF=GetEntityCoords(ag)local cQ=GetNetworkTimeAccurate()local S=GetNetworkTimeAccurate()local dG=false;local dH=C-dF;local dI={"x","y","z"}if type(dE)=="string"then dE=dD[dE]if not dE then error("TranslateObjectCoordsCubicBezier: `"..dE.."` its not a predefined cubic bezier")return end end;local dJ=ds(table.unpack(dE))while not dG and S-cQ<ad do Citizen.Wait(0)local dK=GetNetworkTimeAccurate()if S~=0 and dK-S~=0 then local D={}local dL=(S-cQ)/ad;for b9,aH in pairs(dI)do if dF[aH]==C[aH]then D[aH]=0 else local dM=math.lerp(dF[aH],C[aH],dJ(dL))local dN=GetEntityCoords(ag)local az=dN[aH]-dM;local dO=math.abs(az)D[aH]=dO end end;dG=SlideObject(ag,C,D.x,D.y,D.z,false)end;S=dK end;SetEntityCoords(ag,C)end;TranslateObjectCoords=function(ag,C,ad)local dF=GetEntityCoords(ag)local cQ=GetNetworkTimeAccurate()local S=GetNetworkTimeAccurate()local dG=false;local dH=C-dF;local dI={"x","y","z"}while not dG and S-cQ<ad do Citizen.Wait(0)local dK=GetNetworkTimeAccurate()if S~=0 and dK-S~=0 then local dP=dK-S;local bT=dP/ad;local D={}for b9,aH in pairs(dI)do if dH[aH]==0 then D[aH]=0 else D[aH]=math.abs(dH[aH])*bT end end;dG=SlideObject(ag,C,D.x,D.y,D.z,false)end;S=dK end;SetEntityCoords(ag,C)end;TranslateUniformRectilinearMotion=TranslateObjectCoords;TranslateObjectRotation=function(ag,C,ad,dQ)local dR=GetEntityRotation(ag,dQ or 2)local cQ=GetNetworkTimeAccurate()local S=GetNetworkTimeAccurate()local dH=C-dR;local dI={"x","y","z"}while S-cQ<ad do Citizen.Wait(0)local dK=GetNetworkTimeAccurate()local dL=(S-cQ)/ad;if S~=0 and dK-S~=0 then local bF={}for b9,aH in pairs(dI)do bF[aH]=math.lerp(dR[aH],C[aH],dL)end;SetEntityRotation(ag,vec3(bF.x,bF.y,bF.z),2)end;S=dK end;SetEntityRotation(ag,C,dQ or 2)end;TranslateObjectRotationCubicBezier=function(ag,C,ad,dQ,dE)local dS=GetEntityRotation(ag)local cQ=GetNetworkTimeAccurate()local S=GetNetworkTimeAccurate()local dG=false;local dH=C-dS;dH={tonumber(string.format("%.3f",dH.x)),tonumber(string.format("%.3f",dH.y)),tonumber(string.format("%.3f",dH.z))}local dI={"x","y","z"}if type(dE)=="string"then dE=dD[dE]if not dE then error("TranslateObjectCoordsCubicBezier: `"..dE.."` its not a predefined cubic bezier")return end end;local dJ=ds(table.unpack(dE))while not dG and S-cQ<ad do Citizen.Wait(0)local dK=GetNetworkTimeAccurate()if S~=0 and dK-S~=0 then local bF={}local dL=(S-cQ)/ad;for b9,aH in pairs(dI)do if dH[aH]==0 then bF[aH]=0 else local dT=math.lerp(dS[aH],C[aH],dJ(dL))bF[aH]=dT end end;SetEntityRotation(ag,bF.x,bF.y,bF.z,dQ or 2)end;S=dK end;SetEntityRotation(ag,C,dQ or 2)end;CreateScene=function(T,bF,dU,dV,dW,dX)local dY=NetworkCreateSynchronisedScene(T,bF,2,dU or false,dV or false,1065353216,dX or 0,dW or 1.3)w.Cache.Scenes[dY]={coords=T,rotation=bF,players={},entities={},dicts={}}return dY end;AddEntityToScene=function(ai,dY,aa,bJ,D,dZ,d_)if not DoesEntityExist(tonumber(ai))then local ae=ai;local T=GetEntityCoords(PlayerPedId())ai=CreateObject(ai,T+vector3(0,0,-4.0),true)SetEntityCollision(ai,false,true)w.Cache.Scenes[dY].entities[ae]=ai end;RequestAnimDict(aa)while not HasAnimDictLoaded(aa)do Citizen.Wait(1)end;developer("^3Scenes^0","Adding object",ai,"to scene",dY,"[",aa,bJ,"]")NetworkAddEntityToSynchronisedScene(ai,dY,aa,bJ,D or 4.0,dZ or-8.0,d_ or 1)table.insert(w.Cache.Scenes[dY].dicts,aa)end;AddPlayerToScene=function(bh,dY,aa,bJ,...)Citizen.InvokeNative(0x144da052257ae7d8,true)local ped=DoesEntityExist(bh)and bh or GetPlayerPed(bh)AddPedToScene(ped,dY,aa,bJ,...)w.Cache.Scenes[dY].players[ped]={dict=aa,name=bJ}end;AddPedToScene=function(ped,dY,aa,bJ,e0,e1,ad,d_)if not DoesEntityExist(ped)then local ae=ped;ped=CreatePed(ped,vector3(0,0,0),0.0,true)w.Cache.Scenes[dY].entities[ae]=ped end;RequestAnimDict(aa)while not HasAnimDictLoaded(aa)do Citizen.Wait(1)end;developer("^3Scenes^0","Adding ped",ped,"to scene",dY,"[",aa,bJ,"]")NetworkAddPedToSynchronisedScene(ped,dY,aa,bJ,e0 or 1.5,e1 or-4.0,ad or 1,d_ or 16,0,0)table.insert(w.Cache.Scenes[dY].dicts,aa)end;GoNearInitialOffset=function(bh,T,bF,aa,bJ)local ped=DoesEntityExist(bh)and bh or GetPlayerPed(bh)local Z=bF and bF.z or GetEntityHeading(ped)RequestAnimDict(aa)while not HasAnimDictLoaded(aa)do Citizen.Wait(1)end;local bg=GetAnimInitialOffsetPosition(aa,bJ,T,0.0,0.0,Z,0.0,2)local bF=GetAnimInitialOffsetRotation(aa,bJ,T,0.0,0.0,Z,0.0,2)RemoveAnimDict(aa)TaskGoStraightToCoord(ped,bg,0.6,-1,bF.z,0.4)local e2=GetGameTimer()while#(GetEntityCoords(ped)-bg)>0.3 and GetGameTimer()-e2<4000 do Citizen.Wait(1)end;while GetEntitySpeed(ped)>0.2 and GetGameTimer()-e2<4000 do Citizen.Wait(50)end;if GetGameTimer()-e2>=4000 then TaskPedSlideToCoord(ped,bg,Z,2000)Citizen.Wait(2000)end end;StartScene=function(dY,e3)local e4=w.Cache.Scenes[dY]if e3 then for ped,aH in pairs(e4.players)do GoNearInitialOffset(ped,e4.coords,e4.rotation,aH.dict,aH.name)end end;NetworkStartSynchronisedScene(dY)end;StopScene=function(dY)developer("^3Scenes^0","Stop scene",dY)NetworkStopSynchronisedScene(dY)local e4=w.Cache.Scenes[dY]for ae,ai in pairs(e4.entities)do developer("^3Scenes^0","Deleting entity",ai)DeleteEntity(ai)end;for ay=1,#e4.dicts do RemoveAnimDict(e4.dicts[ay])end end;GetSceneEntity=function(dY,ae)if ae then return w.Cache.Scenes[dY].entities[ae]else return w.Cache.Scenes[dY].entities end end;local e5=function(e6,T)local ped=PlayerPedId()local bF=GetEntityRotation(e6)local dY=CreateScene(T,bF)AddPlayerToScene(ped,dY,"anim@heists@ornate_bank@thermal_charge","thermal_charge")AddEntityToScene("hei_p_m_bag_var22_arm_s",dY,"anim@heists@ornate_bank@thermal_charge","bag_thermal_charge")StartScene(dY,true)return dY end;local e7=function(e6)local e8=GetEntitySize(e6)if doorHash==GetHashKey("hei_v_ilev_bk_safegate_pris")then return GetOffsetFromEntityInWorldCoords(e6,-(e8.x-0.1),-0.05,0.0)else return GetOffsetFromEntityInWorldCoords(e6,e8.x-0.1,-0.05,0.0)end end;local e9=function(ped,T)local ea=CreateObject("hei_prop_heist_thermite",T-vector3(0,0,5),true)SetEntityCollision(ea,false,false)AttachEntityToEntity(ea,ped,GetPedBoneIndex(ped,28422),0,0,0,0,0,200.0,true,true,false,true,1,true)return ea end;local eb=function(ea)DetachEntity(ea,true,true)end;local ec=function(ea)return StartParticleFxOnNetworkEntity("scr_ornate_heist","scr_heist_ornate_thermal_burn",ea,vector3(0.0,1.0,-0.1),vector3(0.0,0.0,0.0),1.0)end;local ed=function(ped)TaskPlayAnim(ped,"anim@heists@ornate_bank@thermal_charge","cover_eyes_loop",1.5,1.0,-1,51,1,0,0,0)end;local ee=function(e6)local ae=GetEntityModel(e6)if ae==GetHashKey("hei_v_ilev_bk_gate_pris")then return"hei_v_ilev_bk_gate_molten"elseif ae==GetHashKey("hei_v_ilev_bk_gate2_pris")then return"hei_v_ilev_bk_gate2_molten"elseif ae==GetHashKey("hei_v_ilev_bk_safegate_pris")then return"hei_v_ilev_bk_safegate_molten"end end;local ef=function(e6)local eg=ee(e6)if eg then SetEntityModel(e6,eg)end end;local eh=function(ped,ea)DeleteObject(ea)TaskPlayAnim(ped,"anim@heists@ornate_bank@thermal_charge","cover_eyes_exit",1.0,8.0,1000,51,1,0,0,0)Citizen.Wait(1000)ClearPedTasks(ped)end;BreakDoorWithThermalCharge=function(e6,ei,ad)local ped=PlayerPedId()local ej=e7(e6)local dY=e5(e6,ej)SetPedComponentVariation(ped,5,0,0,0)Citizen.Wait(1000)local ea=e9(ped,ej)Citizen.Wait(3000)eb(ea)Citizen.Wait(1000)local ek=ec(ea)StopScene(dY)SetPedComponentVariation(ped,5,ei or 45,0,0)developer("^3Scenes^0","Cover eyes")ed(ped)Citizen.Wait(1000)ef(e6)developer("^3Scenes^0","Wait "..(ad or 3000))Citizen.Wait(ad or 3000)eh(ped,ea)end;local el=function(type)if type=="cash"then return"hei_prop_hei_cash_trolly_01"elseif type=="gold"then return"ch_prop_gold_trolly_01a"elseif type=="diamond"then return"ch_prop_diamond_trolly_01a"end end;local em=function(type)return"utility_heist:"..type.."_trolly:"..math.random(1,10000)end;CreateTrolly=function(type,T,en,bC,eo,ep,eq,er)if type(eo)=="number"then er=eq;eq=ep;ep=eo end;local ag=nil;local ao=em(type)if type=="cash"then ag=CreateObject("hei_prop_hei_cash_trolly_01",T,er)elseif type=="gold"then ag=CreateObject("ch_prop_gold_trolly_01a",T,er)elseif type=="diamond"then ag=CreateObject("ch_prop_diamond_trolly_01a",T,er)end;PlaceObjectOnGroundProperly(ag)CreateMarker(ao,T,0.0,2.0,{notify=bC or"Press {E} to begin looting the trolly"})SetFor(ao,"minSpeed",ep)SetFor(ao,"maxSpeed",eq)SetFor(ao,"giveCash",en)SetFor(ao,"repeatedlyPress",eo)local P=nil;P=On("marker",function(es)if es==ao then local type=ao:match("utility_heist:(%w+)_trolly")local T=GetEntityCoords(PlayerPedId())local ae=el(type)local et=GetClosestObjectOfType(T,3.0,GetHashKey(ae))DeleteMarker(ao)Citizen.Wait(500)ClearAllHelpMessages()if et>0 then LootTrolly(ao,type,et)RemoveEventHandler(P)end end end)return ao,ag end;local eu=function(type)if type=="cash"then return"hei_prop_hei_cash_trolly_03"else return"hei_prop_hei_cash_trolly_03"end end;local ev=function(type)if type=="cash"then return"hei_prop_heist_cash_pile"elseif type=="gold"then return"ch_prop_gold_bar_01a"elseif type=="diamond"then return"ch_prop_vault_dimaondbox_01a"end end;local ew=function(ao,en)PlaySoundFrontend(-1,"LOCAL_PLYR_CASH_COUNTER_INCREASE","DLC_HEISTS_GENERAL_FRONTEND_SOUNDS",true)en()end;local ex=function(ao,ae,en)local ped=PlayerPedId()local T=GetEntityCoords(ped)local ey=CreateObject(ae,T,true)FreezeEntityPosition(ey,true)SetEntityInvincible(ey,true)SetEntityNoCollisionEntity(ey,ped)SetEntityVisible(ey,false,false)AttachEntityToEntity(ey,ped,GetPedBoneIndex(ped,60309),0.0,0.0,0.0,0.0,0.0,0.0,false,false,false,false,0,true)DisableCamCollisionForEntity(ey)w.Cache.LootingTrolly=true;Citizen.CreateThread(function()local ez=GetHashKey("CASH_APPEAR")local eA=GetHashKey("RELEASE_CASH_DESTROY")while w.Cache.LootingTrolly do if HasAnimEventFired(ped,ez)then SetEntityVisible(ey,true,false)end;if HasAnimEventFired(ped,eA)then if IsEntityVisible(ey)then SetEntityVisible(ey,false,false)ew(ao,en)end end;Citizen.Wait(1)end;DeleteObject(ey)end)end;local eB=function(eC,eD)local ped=PlayerPedId()local T=GetEntityCoords(eD)local bF=GetEntityRotation(eD)local dY=CreateScene(T,bF)AddPlayerToScene(ped,dY,"anim@heists@ornate_bank@grab_cash","intro")AddEntityToScene(eC,dY,"anim@heists@ornate_bank@grab_cash","bag_intro")StartScene(dY,true)return dY end;local eE=function(eF,eG,eH,eo)local eI=NetworkGetLocalSceneFromNetworkId(eF)local D=eG;local eJ=false;Citizen.CreateThread(function()while not eJ do if IsControlJustPressed(0,24)then if D<=eH then D=D+0.1 end end;Citizen.Wait(0)end end)while not IsSynchronizedSceneRunning(eI)do eI=NetworkGetLocalSceneFromNetworkId(eF)Citizen.Wait(1)end;Citizen.CreateThread(function()AddTextEntry('PersistentButtonNotification',eo or"Repeatedly press ~INPUT_SCRIPT_RDOWN~ to grab faster")BeginTextCommandDisplayHelp('PersistentButtonNotification')EndTextCommandDisplayHelp(0,true,true,-1)end)while GetSynchronizedScenePhase(eI)<0.99 do eI=NetworkGetLocalSceneFromNetworkId(eF)if D>eG then D=D-0.1 end;SetSynchronizedSceneRate(eI,D)Citizen.Wait(300)end;ClearAllHelpMessages()eJ=true end;local eK=function(eC,eD)local ped=PlayerPedId()local T=GetEntityCoords(eD)local bF=GetEntityRotation(eD)local dY=CreateScene(T,bF)AddPlayerToScene(ped,dY,"anim@heists@ornate_bank@grab_cash","grab")AddEntityToScene(eC,dY,"anim@heists@ornate_bank@grab_cash","bag_grab")AddEntityToScene(eD,dY,"anim@heists@ornate_bank@grab_cash","cart_cash_dissapear")StartScene(dY)return dY end;local eL=function(eC,eD)local ped=PlayerPedId()local T=GetEntityCoords(eD)local bF=GetEntityRotation(eD)local dY=CreateScene(T,bF)AddPlayerToScene(ped,dY,"anim@heists@ornate_bank@grab_cash","exit")AddEntityToScene(eC,dY,"anim@heists@ornate_bank@grab_cash","bag_exit")StartScene(dY)return dY end;LootTrolly=function(ao,type,eD)local ped=PlayerPedId()local eM=ev(type)local eN=eu(type)local bA=GetFrom(ao)if IsEntityPlayingAnim(eD,"anim@heists@ornate_bank@grab_cash","cart_cash_dissapear",3)then return end;while not NetworkHasControlOfEntity(eD)do Citizen.Wait(1)NetworkRequestControlOfEntity(eD)end;local eO=CreateObject("hei_p_m_bag_var22_arm_s",vector3(0.0,0.0,0.0),true)SetEntityCollision(eO,false,true)local eP=eB(eO,eD)developer("^3Scenes^0","Started Intro scene")SetPedComponentVariation(ped,5,0,0,0)Citizen.Wait(1500)developer("^3Scenes^0","Create cash prop")ex(ao,eM,bA.giveCash)developer("^3Scenes^0","Starting grabbing scene")local eF=eK(eO,eD)developer("^3Scenes^0","Started grab scene")eE(eF,bA.minSpeed or 1.0,bA.maxSpeed or 1.6,bA.repeatedlyPress)ew(ao,bA.giveCash)SetEntityModel(eD,eN)w.Cache.LootingTrolly=false;local eQ=eL(eO,eD)developer("^3Scenes^0","Started exit scene",eD)Citizen.Wait(1800)DeleteEntity(eO)StopScene(eP)StopScene(eF)StopScene(eQ)developer("^3Scenes^0","Stopped all scenes",eD)SetPedComponentVariation(ped,5,45,0,0)end;local eR=false;local eS=false;Citizen.CreateThread(function()AddRelationshipGroup("GUARDS")SetPedRelationshipGroupHash(PlayerPedId(),GetHashKey("PLAYER"))end)local eT=function(bh,aH)if HasEntityClearLosToEntity(aH,bh,27)and GetPedTaskCombatTarget(aH)~=bh then TaskCombatHatedTargetsAroundPed(aH,10.0,0)SetRelationshipBetweenGroups(5,GetHashKey("GUARDS"),GetHashKey("PLAYER"))SetPedToInformRespectedFriends(aH,30.0,3)SetPedAiBlipHasCone(aH,false)if not eS then eS=true;TriggerEvent("Utility:On:spotted",aH)end end end;local eU=function()if not eR then eR=true;Citizen.CreateThread(function()while eR do if next(w.Cache.Guards)then local bh=PlayerPedId()local T=GetEntityCoords(bh)local eV=GetPedStealthMovement(bh)local az=eV and 30.0 or 60.0;local eW=IsPedRunning(bh)for b9,aH in ipairs(w.Cache.Guards)do local eX=GetEntityCoords(aH)if IsPedDeadOrDying(aH)then SetPedCanRagdoll(aH,true)SetEntityAsNoLongerNeeded(aH)table.remove(w.Cache.Guards,b9)else if#(T-eX)<(eW and 8.0 or 5.0)then eT(bh,aH)end;if#(T-eX)<az then local eY=GetOffsetFromEntityInWorldCoords(aH,0.0,az,0.0)if IsEntityInAngledArea(PlayerPedId(),eX,eY,50.0)then eT(bh,aH)end end;if IsPedShooting(aH)or IsPedInCombat(aH)then SetPedToInformRespectedFriends(aH,30.0,3)SetPedAiBlipHasCone(aH,false)if not eS then eS=true;TriggerEvent("Utility:On:spotted",aH)end end end end else eS=false;eR=false end;Citizen.Wait(500)end end)end end;SetGuardDifficulty=function(eZ,e_)local f0,f1,f2,f3,f4=0,0,0,0,0;if e_=="easy"then f1=1;f2=40;f3=0;f4=0 elseif e_=="medium"then f1=2;f2=60;f3=2;f4=1 elseif e_=="hard"then f1=3;f2=80;f3=2;f4=2;f0=50 elseif e_=="veryhard"then f1=3;f2=95;f3=2;f4=2;f0=100 end;SetPedArmour(ped,f0)SetPedAlertness(ped,f1)SetPedAccuracy(ped,f2)SetPedCombatRange(ped,f3)SetPedCombatAbility(ped,f4)end;CreateGuard=function(ae,T,Z,e_,f5)local ped,ah=CreatePed(ae,T,Z,true)SetPedAiBlip(ped,true)SetPedAiBlipForcedOn(ped,true)SetPedAiBlipHasCone(ped,true)SetPedRandomComponentVariation(ped,0)SetPedRandomProps(ped)SetPedCanRagdoll(ped,false)SetPedCombatMovement(ped,2)SetGuardDifficulty(ped,e_)SetPedCombatAttributes(ped,46,true)SetPedFleeAttributes(ped,0,false)SetPedRelationshipGroupHash(ped,GetHashKey("GUARDS"))if f5 then TaskPatrol(ped,"miss_"..f5,1,0,1)end;table.insert(w.Cache.Guards,ped)eU()return ped end;CreateGuardRoute=function(bJ,f6,f7)OpenPatrolRoute("miss_"..bJ)local f8={}for ay=1,#f6 do local f9=f6[ay]if type(f9)=="vector3"then AddPatrolRouteNode(ay,"StandGuard",f9,f9,5000)else AddPatrolRouteNode(ay,f9.anim or"StandGuard",f9.destination,f9.viewat or f9.destination,f9.wait or 5000)end;if f7 then f7(ay-1,ay)else if ay==#f6 then AddPatrolRouteLink(ay,1)table.insert(f8,{f6[ay],f6[1]})end;if ay>1 then AddPatrolRouteLink(ay-1,ay)table.insert(f8,{f6[ay-1],f6[ay]})end end end;ClosePatrolRoute()CreatePatrolRoute()if DevModeStatus then CreateLoop(function(ar)for ay=1,#f8 do DrawLine(f8[ay][1],f8[ay][2],255,0,0,255)end end)end end;SetGuardRoute=function(eZ,fa)TaskPatrol(eZ,"miss_"..fa,1,0,1)end;SetEntityModel=function(ai,ae)TriggerServerEvent("Utility:SwapModel",GetEntityCoords(ai),GetEntityModel(ai),type(ae)=="string"and GetHashKey(ae)or ae)end;StopCurrentTaskAndWatchPlayer=function(ped,ad)local X=GetEntityCoords(ped,true)local Y=GetEntityCoords(PlayerPedId(),true)local Z=GetHeadingFromVector_2d(Y.x-X.x,Y.y-X.y)TaskAchieveHeading(ped,Z,ad or 2000)end;StartParticleFxOnNetworkEntity=function(fb,bJ,ag,...)TriggerServerEvent("Utility:StartParticleFxOnNetworkEntity",fb,bJ,ObjToNet(ag),...)end;GetEntitySize=function(ai)local ae=GetEntityModel(ai)local eG,eH=GetModelDimensions(ae)return eH-eG end;DebugCoords=function(T)CreateLoop(function(ar)DrawText3Ds(T,"V")end)end;GetDirectionFromVectors=function(fc,fd)return fc-fd end;RotationToDirection=function(bO)local fe={x=math.pi/180*bO.x,y=math.pi/180*bO.y,z=math.pi/180*bO.z}local bE={x=-math.sin(fe.z)*math.abs(math.cos(fe.x)),y=math.cos(fe.z)*math.abs(math.cos(fe.x)),z=math.sin(fe.x)}return vector3(bE.x,bE.y,bE.z)end;SetVehicleWheelsPowered=function(ak,aj)for ay=0,GetVehicleNumberOfWheels(ak)-1 do SetVehicleWheelIsPowered(ak,ay,aj)end end;apairs=function(cb,ff)local fg={}local ay=0;for b9 in pairs(cb)do table.insert(fg,b9)end;table.sort(fg,ff)local fh=function()ay=ay+1;if fg[ay]==nil then return nil else return fg[ay],cb[fg[ay]]end end;return fh end;math.lerp=function(fi,fj,fk)return fi+(fj-fi)*fk end;math.invlerp=function(fi,fj,b8)return(b8-fi)/(fj-fi)end;CreateMissionText=function(Q,ad)SetTextEntry_2("STRING")AddTextComponentString(Q)DrawSubtitleTimed(ad and math.floor(ad)or 60000*240,1)return{delete=function()ClearPrints()end}end;WaitNear=function(T)local bh=PlayerPedId()while#(GetEntityCoords(bh)-T)>10 do Citizen.Wait(100)end end;FindInTable=function(table,_)for ay=1,#table do if table[ay]==_ then return ay end end;return nil end;GetRandom=function(table)local fl=math.random(1,#table)return table[fl]end;Probability=function(cr)return math.random(1,100)<=cr end;AddPercentage=function(cr,fm)return cr+cr*fm/100 end;RemovePercentage=function(cr,fm)return cr-cr*fm/100 end;InTimeRange=function(eG,eH)local bW=nil;if utc then local a7,a7,a7,fn=GetUtcTime()bW=fn else bW=GetClockHours()end;if eH>eG then if bW>=eG and bW<=eH then return true end else if bW<=eH or bW>=eG then return false end end end;quat2euler=function(fo)local fp=2*(fo.w*fo.x+fo.y*fo.z)local fq=1-2*(fo.x*fo.x+fo.y*fo.y)local fr=math.atan2(fp,fq)local fs=math.sqrt(1+2*(fo.w*fo.y-fo.x*fo.z))local ft=math.sqrt(1-2*(fo.w*fo.y-fo.x*fo.z))local fu=2*math.atan2(fs,ft)-math.pi/2;local fv=2*(fo.w*fo.z+fo.x*fo.y)local fw=1-2*(fo.y*fo.y+fo.z*fo.z)local fx=math.atan2(fv,fw)return vec3(math.deg(fr),math.deg(fu),math.deg(fx))end;GenerateMatrix=function(bg,bF)local fy,fz,fA=math.rad(bF.x),math.rad(bF.y),math.rad(bF.z)local fB,fC=math.cos(fy),math.sin(fy)local fD,fE=math.cos(fz),math.sin(fz)local fF,fG=math.cos(fA),math.sin(fA)local fH=mat3(vec3(1,0,0),vec3(0,fB,-fC),vec3(0,fC,fB))local fI=mat3(vec3(fD,0,fE),vec3(0,1,0),vec3(-fE,0,fD))local fJ=mat3(vec3(fF,-fG,0),vec3(fG,fF,0),vec3(0,0,1))local fK=fH*fI*fJ;local fL=mat4(vec4(fK[1].x,fK[2].x,fK[3].x,0),vec4(fK[1].y,fK[2].y,fK[3].y,0),vec4(fK[1].z,fK[2].z,fK[3].z,0),vec4(bg.x,bg.y,bg.z,1))return fL end;GetOffsetFromPositionInWorldCoords=function(bg,bF,cV)local fM=GenerateMatrix(bg,bF)return fM*cV end;GetInteriorPositionAndRotation=function(fN)local bg=vec3(GetInteriorPosition(fN))local bF=vec4(GetInteriorRotation(fN))bF=quat2euler(bF)return bg,bF end;GetOffsetFromInteriorInWorldCoords=function(fN,cV)local bg,bF=GetInteriorPositionAndRotation(fN)return GetOffsetFromPositionInWorldCoords(bg,bF,cV)end;local fO={}UtilityNet.SetDebug=function(bS)UtilityNetDebug=bS;local fP={}Citizen.CreateThread(function()while UtilityNetDebug do local fQ=GlobalState.Entities;if#fQ>0 then fP={}for ay,aH in pairs(fQ)do if aH.createdBy==GetCurrentResourceName()then local ag=UtilityNet.GetEntityFromUNetId(aH.id)if DoesEntityExist(ag)then table.insert(fP,{obj=ag,netId=aH.id})end end end end;Citizen.Wait(3000)end end)Citizen.CreateThread(function()while UtilityNetDebug do for b9,aH in pairs(fP)do local bS=UtilityNet.State(aH.netId)DrawText3Ds(GetEntityCoords(aH.obj),"NetId: "..aH.netId,0.25)end;Citizen.Wait(1)end end)end;UtilityNet.SetModelRenderDistance=function(ae,az)TriggerServerEvent("Utility:Net:SetModelRenderDistance",ae,az)end;UtilityNet.CreateEntity=function(ae,T,bA)if type(ae)~="string"then error("Invalid model, got "..type(ae).." expected string",0)end;bA=bA or{}bA.resource=GetCurrentResourceName()local fR=math.random(0,10000000)local A=nil;local ai=promise:new()A=RegisterNetEvent("Utility:Net:EntityCreated",function(fS,fT)if fS==fR then ai:resolve(fT)RemoveEventHandler(A)end end)TriggerLatentServerEvent("Utility:Net:CreateEntity",5120,fR,ae,T,bA)local ao=Citizen.Await(ai)table.insert(fO,ao)return ao end;UtilityNet.DoesEntityExist=function(fT)return DoesEntityExist(UtilityNet.GetEntityFromUNetId(fT))end;UtilityNet.DeleteEntity=function(fT)TriggerServerEvent("Utility:Net:DeleteEntity",fT)for b9,aH in pairs(fO)do if aH==fT then table.remove(fO,b9)break end end end;UtilityNet.AttachToEntity=function(fT,fU,fV,bg,bF,fW,fX,dQ,fY)local fZ={bone=fV,pos=bg,rot=bF,useSoftPinning=fW,collision=fX,rotationOrder=dQ,syncRot=fY}if NetworkGetEntityIsNetworked(fU)and DoesEntityExist(fU)then TriggerServerEvent("Utility:Net:AttachToEntity",fT,NetworkGetNetworkIdFromEntity(fU),fZ)else fZ.isUtilityNet=true;TriggerServerEvent("Utility:Net:AttachToEntity",fT,fU,fZ)end end;UtilityNet.DetachEntity=function(fT)local ag=UtilityNet.GetEntityFromUNetId(fT)local T=GetEntityCoords(ag)TriggerServerEvent("Utility:Net:DetachEntity",fT,T)while IsEntityAttached(ag)do Citizen.Wait(1)end;local bS=UtilityNet.State(fT)while bS.__attached do Citizen.Wait(1)end end;UtilityNet.SetEntityCoords=function(fT,T)TriggerLatentServerEvent("Utility:Net:SetEntityCoords",5120,fT,T)end;UtilityNet.SetEntityRotation=function(fT,bF)TriggerLatentServerEvent("Utility:Net:SetEntityRotation",5120,fT,bF)end;UtilityNet.GetEntityCoords=function(fT)local fQ=GlobalState.Entities;for b9,aH in pairs(fQ)do if aH.id==fT then return aH.coords end end end;UtilityNet.GetEntityRotation=function(fT)local fQ=GlobalState.Entities;for b9,aH in pairs(fQ)do if aH.id==fT then return aH.options.rotation end end end;UtilityNet.PreserveEntity=function(fT)local ai=UtilityNet.GetEntityFromUNetId(fT)if ai then Entity(ai).state.preserved=true else warn("PreserverEntity: Entity with uNetId "..fT.." not found")end end;UtilityNet.OnRender=function(f_)AddEventHandler("Utility:Net:OnRender",f_)end;UtilityNet.OnUnrender=function(f_)AddEventHandler("Utility:Net:OnUnrender",f_)end;UtilityNet.IsReady=function(fT)local ag=UtilityNet.GetEntityFromUNetId(fT)return DoesEntityExist(ag)and UtilityNet.IsEntityRendered(ag)end;UtilityNet.IsEntityRendered=function(ag)local bS=Entity(ag).state;return bS.rendered end;UtilityNet.DoesUNetIdExist=function(fT)for b9,aH in pairs(GlobalState.Entities)do if aH.id==fT then return true end end;return false end;UtilityNet.AddStateBagChangeHandler=function(fT,g0)return RegisterNetEvent("Utility:Net:UpdateStateValue",function(g1,K,b8)if fT==g1 then g0(K,b8)end end)end;UtilityNet.RemoveStateBagChangeHandler=function(g2)if g2 and g2.key and g2.name then RemoveEventHandler(g2)end end;UtilityNet.State=function(fT)local bS=setmetatable({},{__index=function(a7,b9)return exports["utility_lib"]:GetEntityStateValue(fT,b9)end,__newindex=function(a7,b9,aH)error("Cannot set states from client")end})return bS end;UtilityNet.StateFromObj=function(ag)local ah=UtilityNet.GetUNetIdFromEntity(ag)return UtilityNet.State(ah)end;UtilityNet.GetEntityFromUNetId=function(fT)return exports["utility_lib"]:GetEntityFromUNetId(fT)end;UtilityNet.GetUNetIdFromEntity=function(ai)return exports["utility_lib"]:GetUNetIdFromEntity(ai)end;AddEventHandler("onResourceStop",function(g3)local g4=GetCurrentResourceName()if g3==g4 then for b9,aH in pairs(fO)do TriggerServerEvent("Utility:Net:DeleteEntity",aH)end end end)