Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. local function _kyle_Buildmode_Enable(z)
  2. z:SendLua("GAMEMODE:AddNotify(\"Build режим активирован. Введите !pvp чтобы выключить\",NOTIFY_GENERIC, 5)")
  3. --z:GodEnable()
  4. if z:Alive() then
  5. ULib.getSpawnInfo(z)
  6. if _Kyle_Buildmode["restrictweapons"]=="1" then
  7. z:StripWeapons()
  8. for x,y in pairs(_Kyle_Buildmode["buildloadout"]) do
  9. z:Give(y)
  10. end
  11. end
  12.  
  13. if z:InVehicle() then
  14. NoCollide(z:GetVehicle())
  15. end
  16. end
  17.  
  18. --having two buildmode variables seems redundant, however im too lazy to replace one with the other (if possible)
  19. z.buildmode = true
  20. z:SetNWBool("_Kyle_Buildmode", true)
  21.  
  22. --boolean to say if buildmode was enabled because the player had just spawned
  23. z:SetNWBool("_Kyle_BuildmodeOnSpawn", z:GetNWBool("_kyle_died"))
  24. end
  25.  
  26. local function _kyle_Buildmode_Disable(z)
  27. --z:GodDisable()
  28. z:SetNWBool("_Kyle_Buildmode", false)
  29. z.buildmode = false
  30. z:SendLua("GAMEMODE:AddNotify(\"PvP режим активирован. Введите !build чтобы выключить\",NOTIFY_GENERIC, 5)")
  31.  
  32. if z:Alive() then
  33. local pos = z:GetPos()
  34.  
  35. if z:InVehicle() then
  36. TryUnNoCollide(z:GetVehicle())
  37. if _Kyle_Buildmode["returntospawn"]=="1" then
  38. --eject player from vehicle so they can be returned to spawn
  39. z:ExitVehicle()
  40. end
  41. end
  42.  
  43. if _Kyle_Buildmode["restrictweapons"]=="1" then
  44. --dont use spawn info that doesnt exist
  45. ULib.spawn( z, not z:GetNWBool("_Kyle_BuildmodeOnSpawn") )
  46. --if there isnt any spawn info, use the default loadout
  47. if z:GetNWBool("_Kyle_BuildmodeOnSpawn") then z:ConCommand("kylebuildmode defaultloadout") end
  48. end
  49.  
  50. --ULIB.spawn moves the player to spawn, this will return the player to where they where while in buildmode
  51. if _Kyle_Buildmode["returntospawn"]=="0" then
  52. z:SetPos(pos)
  53. end
  54.  
  55. if z:GetNWBool("kylenocliped") then
  56. --called when the player had noclip while in buildmode
  57. z:ConCommand( "noclip" )
  58. end
  59. end
  60. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement