|
| 25 Jun 2016 11:41 PM |
do you know how to make adding commands easy? like in kohl's theres a function called MakeCommand where all you do is make a table full of stuff and it parses it into a command
how2do??? im so confused, but prob overthinking
#code R+ | local RAP = "R$725,537"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2016 11:46 PM |
you have string calculations and stuff
prefix=':' cmds={}
function Chatted(Player,Message) if Message:sub(1,#prefix)==prefix then Message=Message:sub(#prefix+1) local cmdname = Message:sub(1,string.find(Message,' ')-1) for i,v in pairs(cmds) do if v.name == cmdname then v.func(Player,Message:sub(string.find(Message,' ')+1)) end end end end function addcommand(name,func) cmds[#cmds+1]={name=name,func=func} end
addcommand('ff',function(Player,Message) end) |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2016 11:49 PM |
e.e
#code R+ | local RAP = "R$725,698"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2016 11:59 PM |
wat
#code R+ | local RAP = "R$725,711"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:01 AM |
| & if you have a suffix not a prefix just remove prefix and replace teh spaces with the suffix or split |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:02 AM |
This is the model I'm talking about btw: https://www.roblox.com/item.aspx?id=441662896
There's a module inside called "Plugins" where you can add all of the commands just with a table. I don't understand how you do it...
#code R+ | local RAP = "R$725,711"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:04 AM |
i just explainneneneednddddd they use a table then calculate the command like this:
%prefix%%command%%splitter(space)%% THE STUFF AT THE END HERE IS SPLIT BY SPACES OR ARGS AND STUF % |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:09 AM |
darth personally I believe thats a complex way of doing it
|
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:12 AM |
eeeeeeeee
plzzzz help
#code R+ | local RAP = "R$725,752"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:13 AM |
| its only complex if your simple |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:14 AM |
you're*
#code R+ | local RAP = "R$725,752"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:15 AM |
this is set.MakeCommand
I dunt get it tho...
#code set.MakeCommand=function(desc,adminlevel,prefix,cmds,argtypes,args,func) local name if not desc or type(desc)~='string' then print('No Description') return elseif not adminlevel or type(adminlevel)~='number' then print(name..' has no admin level') return elseif not prefix or type(prefix)~='string' then print(name..' has no prefix') return elseif not cmds or type(cmds)~='table' then print(name..' has no cmds') return elseif not argtypes or type(argtypes)~='table' then print(name..' has no argtypes') return elseif not args or type(args)~='number' then print(name..' has no args') return elseif not func or type(func)~='function' then print(name..' has no func') return end local com={} com.Cmds=cmds com.MaxArgs=args com.Function=func com.ArgTypes=argtypes com.AdminLevel=adminlevel com.Prefix=prefix com.Desc=desc table.insert(set.Commands,com) end
#code R+ | local RAP = "R$725,752"; local robux = "R$11,038"; |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:16 AM |
converts the arguments of the function to a table, then puts it in the commands table
|
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:24 AM |
My idea is this
Prefix = ":"
CommandList= { [Prefix.."kick"] = function(...) local vars = [...] local Player = game.Players:FindFirstChild(vars[1]) if Player then Player:Kick() end end, [Prefix.."heal"] = function(...) local vars = [...] local Player = game.Players:FindFirstChild(vars[1]) if Player then Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth end end, [Prefix.."tp"] = function(...) local vars = [...] local Player1 = game.Players:FindFirstChild(vars[1]) local Player2 = game.Players:FindFirstChild(vars[2]) if Player1 and Player2 then Player1.Character:MoveTo(Player2.Character.Torso.Position) end end, }
game.Players.PlayerAdded:connect(function(p) p.Chatted:connect(function(msg) local Command = {} for word in msg:gmatch("%w+") do table.insert(Command, string.lower(word) end CommandList[Command[1]](select(2,unpack(Command))) end) end)
You would still need to add functions in to auto complete names using string.match and make it work with "me","other"
|
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 12:53 AM |
asdffffffff
#code R+ | local RAP = "R$725,838"; local robux = "R$11,041"; |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 01:00 AM |
Just read through Peron299's admin, MakerModelLua's admin and Kohl's admin v2 in order to catch a brief idea of how it works.
-=[ RAP: 326,952 || DurstAuric; the narb of ROBLOX ]=- |
|
|
| Report Abuse |
|
|
|
| 26 Jun 2016 01:08 AM |
I'd rather not use Person299's style
#code R+ | local RAP = "R$726,101"; local robux = "R$11,041"; |
|
|
| Report Abuse |
|
|