Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- command, minGMLevel, syntax
- local Table = {
- ["vipinfo"] = { 0, ".vipinfo <player name>" },
- ["viplevel"] = { 1, ".viplevel <player name> <new level>"},
- }
- -- Here we check if the written command exists in the table
- -- If command exists in table then we handle
- local function CommandsSystem(event, player, command)
- local cmd, parameters = command:match("([^%s]+)%s?(.*)")
- if not cmd then
- return
- end
- for com,_ in pairs(Table) do
- if (string.find(com, cmd) == 1) then
- player:HandleCommand(com, parameters)
- return false
- end
- end
- end
- -- Here we handle all available commands
- -- We check if player has required gm level to use that command
- function Player:HandleCommand(command, parameters)
- if (self:GetGMRank() >= Table[command][1]) then
- if (command == "vipinfo") then
- SendWorldMessage("Here we do something for command vipinfo")
- else
- self:SendBroadcastMessage("|cffFF0000Command not yet handled!")
- end
- end
- end
- RegisterPlayerEvent(42, CommandsSystem)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement