daily pastebin goal
36%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function SetPrice(ply, args)
  2.     if args == "" then
  3.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  4.         return ""
  5.     end
  6.  
  7.     local a = tonumber(args)
  8.     if not a then
  9.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
  10.         return ""
  11.     end
  12.     local b = math.Clamp(math.floor(a), GAMEMODE.Config.pricemin, (GAMEMODE.Config.pricecap ~= 0 and GAMEMODE.Config.pricecap) or 500)
  13.     local trace = {}
  14.  
  15.     trace.start = ply:EyePos()
  16.     trace.endpos = trace.start + ply:GetAimVector() * 85
  17.     trace.filter = ply
  18.  
  19.     local tr = util.TraceLine(trace)
  20.  
  21.     local ent = tr.Entity
  22.  
  23.     if IsValid(ent) and ent.CanSetPrice and ent.SID == ply.SID then
  24.         ent:Setprice(b)
  25.     elseif IsValid(ent) and ent:GetCreator() == ply and ent:GetClass() == "health_station" and a > GAMEMODE.Config.priceminhealth and a < GAMEMODE.Config.pricecaphealth then
  26.         ent:Setprice(a)
  27.         print(ent:Getprice())
  28.     else
  29.         DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", DarkRP.getPhrase("any_lab")))
  30.     end
  31.     return ""
  32. end
  33. DarkRP.defineChatCommand("price", SetPrice)
  34. DarkRP.defineChatCommand("setprice", SetPrice)
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