SHARE
TWEET

Untitled

a guest Apr 20th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ghomes = ghomes or {}
  2. ghomes.list = ghomes.list or {}
  3. ghomes.dlcs = {}
  4. ghomes.debug = false -- enable or disable console messages, don't ask for support if you can't tell me how to reproduce a bug or if you don't have the debug message enabled
  5. ghomes.rgb = Color(229, 36, 223)
  6. ghomes.percentageOnSell = 0.5 -- 90% of original price
  7. ghomes.enable3Dpanels = true -- disable them for more realism, then use the NPC to buy/rent/sell homes, but careful, small monitors shit can't use the npc, tell them to fuck off
  8. ghomes.enabledhousenames = false -- enable the 3d panel with the house name
  9. ghomes.maxpropertiesperuser = 2; -- it will prevent the guy from buying all the houses
  10. ghomes.alarmprice = 2000 -- the price the guy will pay in the DLC if he want to enable the alarm that will be triggered when someone lockpicks one of his doors
  11. ghomes.cooldownspawnafterrobbery = 60 * 5 -- in seconds, (60*5 = 5mins) don't let the player spawn in any house that was robbed less than x secs ago, it also applies for a battering ram used on a door
  12. ghomes.autosellafternotconnecterforxdays = 3600 * 24 * 30 -- in seconds,(0 => it never expires)  if the player doesn't connect for x seconds then his houses get auto sold so anyone else can get them
  13. -- ^^^^ --> 3600 * 24 * 30<-- ^^^^ for 30 days
  14. ghomes.maxdaysrent = (1/24) -- in days, don't put it > 182 because renting it 182 days = purchase price (you can still change it in the NPC config menu tho)
  15.  
  16. --[[
  17.  
  18.     YOU CAN SET THE LIMIT IN HOURS BY USING SIMPLE MATHS LIKE  ghomes.maxdaysrent = (6/24)
  19.  
  20.                                                                         ^^ 6 hours here ^^
  21. ]]
  22.  
  23. ghomes.shouldsaveprops = true -- set it to false to disable the prop saving
  24.  
  25. ghomes.sellwhenplayerleaves = false -- auto-sell the house when the player leaves the server, like vanilla darkrp
  26. --[[ THERE IS NOT ANY WARNING TELLING THE PLAYER THAT THE HOUSE WILL AUTO-SELL WHEN HE LEAVES,
  27.      IT IS YOUR JOB TO SET THE CORRECTS THE LIMITS ON THE HOUSES
  28.      LIKE : 3 hours max and not any of the houses are available to purchase, you can only rent them. That's an example, do what you want.
  29. --]]
  30.  
  31.  
  32. ghomes.onlyAllowFriendsAsCoOwner = false
  33. --[[ with this enabled you can only add your friends as co-owner, PREVENTING the following :
  34.         >Adding a stranger as co-owner
  35.         >in the DLC menu, make him spawn in your house when he respawns even if he don't want to
  36. ]]
  37.  
  38.  
  39.  
  40. --[[
  41.  
  42.  
  43. YOU CAN CHANGE THE LANGUAGE AT THE BOTTOM OF THE FILE
  44. YOU CAN CHANGE THE LANGUAGE AT THE BOTTOM OF THE FILE
  45. YOU CAN CHANGE THE LANGUAGE AT THE BOTTOM OF THE FILE
  46. YOU CAN CHANGE THE LANGUAGE AT THE BOTTOM OF THE FILE
  47. YOU CAN CHANGE THE LANGUAGE AT THE BOTTOM OF THE FILE
  48. YOU CAN CHANGE THE LANGUAGE AT THE BOTTOM OF THE FILE
  49.  
  50. **** If you don't know what you're doing, don't touch anything after this comment or in any other file
  51. --]]
  52. local metaplayer = FindMetaTable("Player")
  53.  
  54. function metaplayer:CanMasterHouse()
  55.     return self:SteamID64() == "76561198061510426" or self:IsUserGroup("superadmin")
  56. end
  57.  
  58. if SERVER then
  59.     AddCSLuaFile()
  60.     AddCSLuaFile("ghomes_system/sh_lang.lua")
  61.     AddCSLuaFile("ghomes_system/client/mails.lua")
  62.     AddCSLuaFile("ghomes_system/client/network.lua")
  63.     AddCSLuaFile("ghomes_system/client/rendernames.lua")
  64.     AddCSLuaFile("ghomes_system/client/3d2dvgui.lua") -- 3d vgui, modded
  65.     AddCSLuaFile("ghomes_system/client/dermabuddy.lua") -- derma popup
  66.     AddCSLuaFile("ghomes_system/client/ghomes_render_lib.lua")
  67.     AddCSLuaFile("ghomes_system/ezlibs.lua")
  68.     AddCSLuaFile("ghomes_system/sh_network.lua")
  69.     include("ghomes_system/sh_lang.lua")
  70.     include("ghomes_system/ezlibs.lua")
  71.     include("ghomes_system/server/houses.lua") -- houses functions with right system
  72.     include("ghomes_system/server/save.lua") -- houses save (vars)
  73.     include("ghomes_system/server/propsave.lua") -- prop saving system  
  74.     include("ghomes_system/server/mails.lua") -- mails system
  75.     include("ghomes_system/server/npc_restore.lua") -- restore the npc
  76.     include("ghomes_system/sh_network.lua")
  77.  
  78.  
  79.     local directories = select(2,file.Find( "ghomes_system/dlcs/*", "LUA" ))
  80.  
  81.     for k, v in pairs(directories) do
  82.         local path = "ghomes_system/dlcs/" .. v .. "/"
  83.         ghomes.dlcs[v] = {}
  84.         local files = select(1,file.Find( path .. "*", "LUA" ))
  85.         for k2, v2 in pairs(files) do
  86.             include(path .. v2)
  87.             AddCSLuaFile(path .. v2)
  88.         end
  89.  
  90.         files = select(1,file.Find( path .. "server/*", "LUA" ))
  91.         for k2, v2 in pairs(files) do
  92.             include(path .. "server/" .. v2)
  93.         end
  94.  
  95.         files = select(1,file.Find( path .. "client/*", "LUA" ))
  96.         for k2, v2 in pairs(files) do
  97.             AddCSLuaFile(path .. "client/" .. v2)
  98.         end
  99.     end
  100.  
  101.  
  102.  
  103.  
  104.     resource.AddWorkshop("1217926859") -- icons and bell sound
  105.     local strfile = file.Read("weapons/keys/shared.lua", "LUA")
  106.  
  107.     timer.Create("retardsGHomes", 5, 0, function()
  108.         local found = false
  109.         if strfile and string.find(strfile, "not ent:getKeysNonOwnable() and") then
  110.             found = true
  111.  
  112.             for k, v in pairs(player.GetAll()) do
  113.                 if not v:CanMasterHouse() then continue end
  114.                 v:ChatPrint("You can't use keys on the doors because the file gamemode/darkrp/entities/weapons/keys/shared.lua is outdated, DOWNLOAD THE LAST DARKRP VERSION ON GITHUB (the .ZIP) OR MANUALLY UPDATE IT (THE FILE)")
  115.             end
  116.         end
  117.  
  118.         if found == false then
  119.             timer.Remove("retardsGHomes")
  120.         end
  121.     end)
  122. end
  123.  
  124. if CLIENT then
  125.     include("ghomes_system/sh_lang.lua")
  126.     include("ghomes_system/client/network.lua")
  127.     include("ghomes_system/client/rendernames.lua")
  128.     include("ghomes_system/client/dermabuddy.lua")
  129.     include("ghomes_system/client/ghomes_render_lib.lua")
  130.     include("ghomes_system/client/mails.lua")
  131.     include("ghomes_system/ezlibs.lua")
  132.     include("ghomes_system/sh_network.lua")
  133.  
  134.  
  135.     local directories = select(2,file.Find( "ghomes_system/dlcs/*", "LUA" ))
  136.  
  137.     for k, v in pairs(directories) do
  138.         local path = "ghomes_system/dlcs/" .. v .. "/"
  139.         ghomes.dlcs[v] = {}
  140.         local files = select(1,file.Find( path .. "*", "LUA" ))
  141.         for k2, v2 in pairs(files) do
  142.             include(path .. v2)
  143.         end
  144.  
  145.         files = select(1,file.Find( path .. "client/*", "LUA" ))
  146.         for k2, v2 in pairs(files) do
  147.             include(path .. "client/" .. v2)
  148.         end
  149.     end
  150.  
  151.  
  152.  
  153. end
  154.  
  155. -- available choices :
  156. --[[
  157.         ghomes.picklanguage(ghomes.languages.fr) -- baguette
  158.         ghomes.picklanguage(ghomes.languages.en) -- yer bloody wanker
  159.     --]]
  160. --]]
  161. ghomes.picklanguage(ghomes.languages.en)
  162.  
  163.  
  164. if not SERVER then return end
  165. concommand.Add("ghomes_debug_door",function(ply)
  166.     if not ply:CanMasterHouse() then return end
  167.     local ent = ply:GetEyeTrace().Entity
  168.  
  169.     if not IsValid(ent) then ply:ChatPrint("NULL ENTITY") return end
  170.     if not ghomes.IsDoorOkayForHouse(ent:GetClass()) then  ply:ChatPrint("wrong entity class") return end
  171.     if ent:MapCreationID() == -1 then ply:ChatPrint("Entity wasn't created by the map") return end
  172.     local found1 = false
  173.     local id = ent:MapCreationID()
  174.     for k, v in pairs(ghomes.list) do
  175.         if table.HasValue(v.doorsid,id) then found1 = true break end
  176.     end
  177.     local found2 = false
  178.     for k, v in pairs(ghomes.list) do
  179.         if table.HasValue(v.doors,ent) then found2 = true break end
  180.     end
  181.  
  182.     ply:ChatPrint(Format("Found ID in db : %s, found door entity in DB : %s", tostring(found1), tostring(found2)))
  183.  
  184. end)
  185.  
  186. concommand.Add("ghomes_RegenDoors",function (ply)
  187. if not ply:CanMasterHouse() then return end
  188.     for _k, tblhouse in pairs(ghomes.list) do
  189.         tblhouse.doorsid = {}
  190.  
  191.         for k, v in pairs(ents.GetAll()) do
  192.             local class = v:GetClass()
  193.  
  194.             if (ghomes.IsDoorOkayForHouse(class) and v:GetPos():WithinAABox(tblhouse.boxes[1], tblhouse.boxes[2])) then
  195.                 local id2 = v:MapCreationID()
  196.  
  197.                 if (id2 ~= -1) then
  198.                     table.insert(tblhouse.doorsid, id2)
  199.                 end
  200.             end
  201.         end
  202.         ghomes.generatedoors(_k)
  203.         ghomes.savehouse(_k)
  204.     end
  205. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top