Advertisement
PawkoW

Repairing Precision Alignment

Jan 21st, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. 1. Replacing Alt and Shift keys:
  2.  
  3. Alt key:
  4. Where you can find this:
  5. ui.lua
  6. Lines: 701, 1702 (before editing)
  7.  
  8. local alt = LocalPlayer():KeyDown( IN_WALK )
  9. replace with:
  10. local alt = input.IsKeyDown(81)
  11. ------------------------------------
  12. Shift key
  13. Where you can find this:
  14. ui.lua
  15. Line: 1701 (before editing)
  16. prop_functions.lua
  17. Lines: 53, 91, 1113 (before editing)
  18. local shift = LocalPlayer():KeyDown( IN_SPEED )
  19. replace with:
  20. local alt = input.IsKeyDown(79)
  21.  
  22. 2. Fixing a bug that occurs when you try to stack a prop over a limit, it breaks whole stacking function, justly the tool stacks over the limit, it doesn't have any limit.
  23.  
  24. Function that checks if you can spawn entity (tweak it to the server needs, I tested it on Sandbox using CVAR as limit + NPP)
  25. ------------------------------------
  26. local function CanSpawnEnt(user)
  27. local MaxProps = cvars.Number("sbox_maxprops",0)
  28. local ThingsUnfiltered = ents.GetAll()
  29. local Filtered = {}
  30. local CheckFor = {"gmod_button","keypad","keypad_advanced","prop_physics"} -- afaik the buttons etc. are counted as props on server
  31.  
  32. for _,Thing in ipairs(ThingsUnfiltered) do
  33. for i,Class in pairs(CheckFor) do
  34. if(Thing:GetClass() == Class&&NADMOD.PropOwners[Thing:EntIndex()] == LocalPlayer():Nick()) then
  35. table.insert(Filtered,Thing)
  36. end
  37. end
  38. end
  39. local ThingsCount = table.Count(Filtered)
  40. return (ThingsCount < MaxProps)
  41. end
  42. -----------------------------------
  43. Add the function to prop_functions.lua
  44. You can put it almost everywhere, mine starts at line 14
  45.  
  46. Now you need to actually stop spawning the entity, it's pretty easy
  47. Jump to line 55, add something similar to this:
  48.  
  49. -----------------------------------
  50. if shift then
  51. if(!CanSpawnEnt()) then
  52. Warning("Attempted to stack over prop limit")
  53. return false
  54. end
  55. stack = GetConVarNumber( PA_.."stack_num")
  56. ...
  57. ...
  58. -----------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement