RanggaBS

Save Anywhere

May 14th, 2022 (edited)
756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. -- Garages.lua
  2.  
  3. if type(F_InitGarages) ~= "function" then
  4.     F_InitGarages = function()
  5.         DATLoad("Garages.DAT", 1)
  6.         GarageClearAll()
  7.         GarageAdd(TRIGGER._Garage_SchoolGrounds, POINTLIST._Garage_SchoolGrounds)
  8.         GarageAdd(TRIGGER._Garage_RichArea, POINTLIST._Garage_RichArea)
  9.         GarageAdd(TRIGGER._Garage_BusinessArea, POINTLIST._Garage_BusinessArea)
  10.         GarageAdd(TRIGGER._Garage_PoorArea, POINTLIST._Garage_PoorArea)
  11.     end
  12. end
  13.  
  14. shared.userDeviceIsPC = type(_G.ClassMusicSetPlayers) == "function" and true or false
  15.  
  16. shared.gSaveAnywhere = {}
  17.  
  18. _G.SaveAnywhere = function()
  19.     while not SystemIsReady() do
  20.         Wait(0)
  21.     end
  22.     shared.gSaveAnywhere.timer = GetTimer()
  23.     while true do
  24.         Wait(0)
  25.         if not PlayerIsInAnyVehicle() and PedMePlaying(gPlayer, "Default_KEY") then
  26.             if GetStickValue(6, 0) == 1 and GetStickValue(8, 0) == 1 then
  27.                 if GetTimer() >= shared.gSaveAnywhere.timer+3000 then
  28.                     if MissionActive() then
  29.                         if shared.userDeviceIsPC then
  30.                             TextPrintString("You can\'t save\nwhile in mission!", 3, 1)
  31.                         else
  32.                             MinigameSetAnnouncement("You can\'t save\nwhile in mission!", true)
  33.                         end
  34.                         --SoundPlay2D("WrongBtn")
  35.                         --Wait(1500)
  36.                     else
  37.                         local x, y, z = PedGetOffsetInWorldCoords(gPlayer, 0, 1, 1)
  38.                         local animSaveId, animSaveObj = CreatePersistentEntity("AnimSave", x, y, z, math.deg(PedGetHeading(gPlayer)), AreaGetVisible())
  39.                         Wait(50)
  40.                         PedSetActionNode(gPlayer, "/Global/WProps/SaveBookInteract", "Act/WProps.act")
  41.                         Wait(25)
  42.                         DeletePersistentEntity(animSaveId, animSaveObj)
  43.                         collectgarbage()
  44.                     end
  45.                 end
  46.             else
  47.                 shared.gSaveAnywhere.timer = GetTimer()
  48.             end
  49.         end
  50.     end
  51. end
  52.  
  53. shared.gSaveAnywhere.mainThread = CreateThread("SaveAnywhere")
Add Comment
Please, Sign In to add comment