Guest User

Untitled

a guest
May 14th, 2021
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.50 KB | None | 0 0
  1. // Called when the player creates the Final Meth by Pressing E on the frezzing Tray
  2. hook.Add("zmlab2_OnMethMade", "zmlab2_OnMethMade_test", function(ply, frezzingTray, methEnt)
  3.     if not IsValid(ply) then return end
  4.  
  5.     /*
  6.         methEnt can either be a meth bag or a meth crate, depending if the frezzer tray is put on a packing table or not
  7.     */
  8. end)
  9.  
  10. // Called before the player receives his earning
  11. // Can be used to modify the money earned from selling meth
  12. hook.Add("zmlab2_PreMethSell","zmlab2_PreSell_test",function(ply,earning)
  13.  
  14.     /*
  15.         if ply:IsSuperAdmin() then
  16.             earning = earning * 2
  17.         end
  18.     */
  19.  
  20.     return earning
  21. end)
  22.  
  23. // Gets called when a Player destorys Methbag, Methcrate or Palette with Meth
  24. hook.Add("zmlab2_OnMethObjectDestroyed", "zmlab2_OnMethObjectDestroyed_test", function(methObject,damageinfo)
  25.  
  26.     if IsValid(methObject) then
  27.         local ply = damageinfo:GetAttacker()
  28.  
  29.         local Earning = 0
  30.         if methObject:GetClass() == "zmlab2_item_palette" then
  31.             for k,v in pairs(methObject.MethList) do
  32.                 Earning = Earning + zmlab2.Meth.GetValue(v.t,v.a,v.q)
  33.             end
  34.         else
  35.             Earning = zmlab2.Meth.GetValue(methObject:GetMethType(),methObject:GetMethAmount(),methObject:GetMethQuality())
  36.         end
  37.         if Earning <= 0 then return end
  38.  
  39.         if methObject.GetMethType then
  40.             zmlab2.NetEvent.Create("meth_explo", methObject:GetPos(),methObject:GetMethType())
  41.         else
  42.             zmlab2.NetEvent.Create("meth_explo", methObject:GetPos(),1)
  43.         end
  44.  
  45.         // If the attacker is a player with a police job then we reward that player
  46.         if IsValid(ply) and ply:IsPlayer() and ply:Alive() and zmlab2.config.Police.Jobs[zmlab2.Player.GetJob(ply)] then
  47.  
  48.             // Add Rank multiplicator
  49.             Earning = Earning * ( zmlab2.config.NPC.SellRanks[zmlab2.Player.GetRank(ply)] or zmlab2.config.NPC.SellRanks["default"])
  50.  
  51.             // Multiply by police cut
  52.             Earning = Earning * zmlab2.config.Police.PoliceCut
  53.  
  54.             zmlab2.Money.Give(ply, Earning)
  55.             zmlab2.Notify(ply, "+" .. zmlab2.Money.Display(math.Round(Earning)), 0)
  56.         end
  57.     end
  58. end)
  59.  
  60. // Called when a player gets wanted for selling meth
  61. hook.Add("zmlab2_OnWanted", "zmlab2_OnWanted_test", function(ply)
  62.     if (IsValid(ply)) then
  63.         //print(ply:Nick() .. " is now wanted for Selling Meth!")
  64.     end
  65. end)
  66.  
  67. // Here you can return which sellmode this player should have for selling meth
  68. // Return 1,2, 3, 4 or return nothing if you want to use the default sellmode defind in the config
  69. hook.Add("zmlab2_GetSellMode", "zmlab2_GetSellMode_test", function(ply)
  70.  
  71.     // 1 = Methcrates can be absorbed by Players and sold by the MethBuyer on use
  72.     // 2 = Methcrates cant be absorbed and the MethBuyer tells you a dropoff point instead (Palette Entity gets used here for easier transport)
  73.     // 3 = Methcrates can be absorbed and the MethBuyer tells you a dropoff point
  74.     // 4 = Methcrates need to be moved to the MethBuyer and sold directly by him
  75.  
  76.     if IsValid(ply) and ply:IsSuperAdmin() then
  77.         //return 3
  78.     end
  79. end)
  80.  
  81. // Gets called when a dropoff point gets assinged to a player
  82. hook.Add("zmlab2_OnDropOffPoint_Assigned", "zmlab2_OnDropOffPoint_Assigned_test", function(dropoffpoint,ply)
  83.     /*
  84.     if IsValid(dropoffpoint) and IsValid(ply) then
  85.         print("Player: " .. ply:Nick() .. " just got assigned DropOffPoint: " .. tostring(dropoffpoint) .. ".")
  86.     end
  87.     */
  88. end)
  89.  
  90. // Called when a player consums meth
  91. hook.Add("zmlab2_OnMethConsum", "zmlab2_OnMethConsum_test", function(ply, MethType,MethQuality)
  92.     if not IsValid(ply) then return end
  93. end)
  94.  
  95. // Can be used to overwrite the limit for a specific item which the player trys to buy from the storage entity
  96. hook.Add("zmlab2_Storage_GetItemLimit", "zmlab2_Storage_GetItemLimit_test", function(ply,ItemID)
  97.  
  98.     /*
  99.     // Superadmins can buy double as much
  100.     if IsValid(ply) and ply:IsSuperAdmin() then
  101.         return zmlab2.config.Storage.Shop[ItemID].limit * 2
  102.     end
  103.     */
  104. end)
  105.  
  106. // Can be used to overwrite the limit for a specific item which the player trys to buy / build from the Equipmentbox entity
  107. hook.Add("zmlab2_Equipment_GetItemLimit", "zmlab2_Equipment_GetItemLimit_test", function(ply,ItemID)
  108.  
  109.     /*
  110.     // Superadmins can buy double as much
  111.     if IsValid(ply) and ply:IsSuperAdmin() then
  112.         return zmlab2.config.Equipment.List[ItemID].limit * 2
  113.     end
  114.     */
  115. end)
  116.  
Add Comment
Please, Sign In to add comment