Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chatcommands.RegisterArg("boolean", function(s)
- if self.Alias[s] then return self.Alias[s] end
- if s == "1" or s == "true" or s == "yes" or "s" == "on" then return true end
- if s == "0" or s == "false" or s == "no" or "s" == "off" then return true end
- -- lmao
- if s == "not likely" then return math.random() > 0.25 end
- if s == "maybe" then return math.random() > 0.5 end
- if s == "likely" then return math.random() > 0.85 end
- if s == "very likely" then return math.random() > 0.95 end
- end)
- chatcommands.RegisterArg("vector", function(s)
- if self.Alias[s] then return self.Alias[s] end
- Vector(s)
- end) -- since Vector("0 0 0") works now
- chatcommands.RegisterArg("angle", function(s)
- if self.Alias[s] then return self.Alias[s] end
- Angle(s)
- end)
- local CHTCMD = chatcommands.New()
- CHTCMD.Prefix = nil -- or "/"
- CHTCMD.Command = {"goto"}
- CHTCMD.Description = "teleports you to a position"
- CHTCMD.ArgList = {
- "position", -- input: Entity (GetPos), Vector
- "boolean", -- input: true false, 1 0, yes no
- }
- CHTCMD.Verbosity = "all" -- "executor" or "silent" or nil
- function CHTCMD:OnExecute(executor, object, playsound)
- local var = object:GetVar()
- if object:IsVector() then
- executor:SetPos(var)
- end
- if object:IsEntity() then
- executor:SetPos(var:GetPos() + Vector(0, 0, var:OBBMaxs().z * 1.1))
- end
- if playsound:GetVar() then
- executor:EmitSound("beep.wav")
- end
- self:Notify(executor, "went to", var)
- end
- function CHTCMD:CheckExecutor(ply)
- if ply:IsUserGroup("idiot") then
- return "cannot run this command because he's an idiot"
- end
- end
- function CHTCMD:CheckObject(var)
- if var:IsEntity() and var:GetVar():IsAdmin() then
- return "You cannot go to", var:GetVar(), "because he is an admin"
- end
- if var:IsVector() and not util.IsInWorld(var:GetVar()) then
- return "You cannot go outside the world"
- end
- end
- chatcommands.Register(CHTCMD)
Advertisement
Add Comment
Please, Sign In to add comment