Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. // Some fucking shit.
  2. nw.Register('nlr'):Write(net.WriteDouble):Read(net.ReadDouble):SetPlayer()
  3. util.AddNetworkString("nlrAddLife")
  4.  
  5. net.Receive("nlrAddLife",function (len, ply)
  6. if ply:GetNetVar("nlr") < 2 then
  7. ply:SetNetVar("nlr", ply:GetNetVar("nlr") + 1)
  8. ply:SendLua('chat.AddText( Color( 0, 0, 255 ), "[NLR] ", Color( 255, 255, 255 ), "Вы получили плюс одну жизнь." )')
  9. ply:ChatPrint("Теперь у вас "..ply:GetNetVar('nlr').." жизней")
  10. end
  11. end)
  12. concommand.Add("nlr_set",function (ply, cmd, arg)
  13. if ply:IsAdmin() then
  14. ply:SetNetVar('nlr', 2)
  15. ply:ChatPrint("НЛР стоит на "..ply:GetNetVar('nlr'))
  16. end
  17. end)
  18.  
  19. concommand.Add("nlr_check", function (ply, cmd, arg)
  20. ply:ChatPrint("НЛР стоит на "..ply:GetNetVar('nlr'))
  21. end)
  22.  
  23. concommand.Add("nlr_minus",function (ply, cmd, arg)
  24. if ply:IsAdmin() then
  25. ply:SetNetVar('nlr', ply:GetNetVar('nlr') - 1)
  26. ply:ChatPrint("НЛР стоит на "..ply:GetNetVar('nlr'))
  27. end
  28. end)
  29.  
  30. concommand.Add("nlr_plus",function (ply, cmd, arg)
  31. if ply:IsAdmin() then
  32. ply:SetNetVar('nlr', ply:GetNetVar('nlr') + 1)
  33. ply:ChatPrint("НЛР стоит на "..ply:GetNetVar('nlr'))
  34. end
  35. end)
  36.  
  37.  
  38.  
  39. for k,v in pairs (player.GetAll()) do
  40. v:SetNetVar("nlr", 2)
  41. v:SendLua('chat.AddText( Color( 0, 0, 255 ), "[NLR] ", Color( 255, 255, 255 ), "Ваше НЛР значение было поставлено на 2." )')
  42. end
  43.  
  44.  
  45. local allow_table = {
  46. ['weapon_physcannon'] = true,
  47. ['weapon_physgun'] = true,
  48. ['gmod_tool'] = true,
  49. ['gmod_camera'] = true,
  50. ['keys'] = true,
  51. ['swep_inventory'] = true,
  52. ['weapon_keypadchecker'] = true,
  53. ['weapon_pass_rp'] = true
  54. }
  55.  
  56. -- hook.Add("string eventName",any identifier,function func)
  57. hook.Add("PlayerInitialSpawn","NLRSpawn",function (ply)
  58. if ply:IsValid() and not ply:GetNetVar("nlr") then
  59. ply:SetNetVar("nlr", 2)
  60. ply:SendLua('chat.AddText( Color( 0, 0, 255 ), "[NLR] ", Color( 255, 255, 255 ), "Ваш НЛР счетчик был поставлен на 2." )')
  61. end
  62. end)
  63.  
  64. hook.Add("PlayerDeath","nlrDeath",function (died, killer, ent)
  65. local nlr = died:GetNetVar('nlr')
  66. if died:IsValid() and nlr then
  67. if nlr > 0 then
  68. died:SetNetVar("nlr", died:GetNetVar('nlr') - 1)
  69. died:SendLua('chat.AddText( Color( 0, 0, 255 ), "[NLR] ", Color( 255, 255, 255 ), "Вы потеряли одну жизнь." )')
  70. end
  71. end
  72. end)
  73.  
  74.  
  75. hook.Add("PlayerSwitchWeapon","testingNLR",function (ply, old, new)
  76. local nlr = ply:GetNetVar("nlr")
  77. if nlr and nlr <= 0 then
  78. if allow_table[new:GetClass()] then
  79. return false
  80. else
  81. ply:SendLua('chat.AddText( Color( 0, 0, 255 ), "[NLR] ", Color( 255, 255, 255 ), "Вы не можете сменить оружите т.к у вас НЛР" )')
  82. return true
  83. end
  84. else
  85. return false
  86. end
  87. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement