Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function SetPrice(ply, args)
- if args == "" then
- DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
- return ""
- end
- local a = tonumber(args)
- if not a then
- DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("invalid_x", "argument", ""))
- return ""
- end
- local b = math.Clamp(math.floor(a), GAMEMODE.Config.pricemin, (GAMEMODE.Config.pricecap ~= 0 and GAMEMODE.Config.pricecap) or 500)
- local trace = {}
- trace.start = ply:EyePos()
- trace.endpos = trace.start + ply:GetAimVector() * 85
- trace.filter = ply
- local tr = util.TraceLine(trace)
- local ent = tr.Entity
- if IsValid(ent) and ent.CanSetPrice and ent.SID == ply.SID then
- ent:Setprice(b)
- elseif IsValid(ent) and ent:GetCreator() == ply and ent:GetClass() == "health_station" and a > GAMEMODE.Config.priceminhealth and a < GAMEMODE.Config.pricecaphealth then
- ent:Setprice(a)
- print(ent:Getprice())
- else
- DarkRP.notify(ply, 1, 4, DarkRP.getPhrase("must_be_looking_at", DarkRP.getPhrase("any_lab")))
- end
- return ""
- end
- DarkRP.defineChatCommand("price", SetPrice)
- DarkRP.defineChatCommand("setprice", SetPrice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement