_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 "..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-cQ0.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)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)