Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2016 06:13 PM |
oh dear god...
if msg:lower():sub(1,3) == "pm " then local chk1 = msg:lower():sub(4):find(" ") + 3 local plrz = GetPlr(plr, msg:lower():sub(4,chk1-1)) Message("Private Message from " .. plr.Name, msg:sub(chk1+1), true, plrz) end
if msg:lower():sub(1,11) == "resetstats " then local plrz = GetPlr(plr, msg:lower():sub(12)) for i, v in pairs(plrz) do coroutine.resume(coroutine.create(function() if v and v:findFirstChild("leaderstats") then for a, q in pairs(v.leaderstats:children()) do if q:IsA("IntValue") then q.Value = 0 end end end end)) end end
- Isosta |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2016 06:31 PM |
| I thought it used tables. Lel. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2016 06:31 PM |
Look at the date when it was created.
|
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2016 06:35 PM |
i assumed it would do something along the lines of this:
local functionSet = { ['Kill'] = { ['Alias'] = { 'Kill', 'Murder', 'Annihilate' } ['Function'] = function(RecievedArgument) --stuff end } }
for i,v in next, functionSet do for _,Alias in ipairs(v.Alias) do if Alias:lower() == FunctionToFire:lower() then v.Function('SentArgument') break end end end
that might not work, dont kill me
- Isosta |
|
|
| Report Abuse |
|
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 08 Jul 2016 06:36 PM |
| My admin commands are better :P (like most people) |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2016 06:37 PM |
@ggggg,
same
i never bothered to complete or opensource mine though, so.
- Isosta |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2016 06:39 PM |
Or I mean you could do something like this :3.
if Commmands[cmd] then Commands[cmd](Arguments); end;
A for loop would have to iterate through thousands of commands assuming if you had thousands of commands. |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
| |
|
|
| 08 Jul 2016 06:41 PM |
assuming*** not if assuming.
Also for aliases just declare the variable outside of the table and point the aliases to the variable :3. |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2016 06:42 PM |
local Commands = { ["kill"] = KillCommand; ["kill2"] = KillCommand; ["kill3"] = KillCommand; }; |
|
|
| Report Abuse |
|
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 08 Jul 2016 06:44 PM |
I have a user interface admin commands that I shared on developer's forum online...
It uses RemoteEvents and RemoteFunctions to safely pass arguments to the server and there it checks if you're an administrator w/ server variables...
It also has a built in administrator hierarchy so only certain admins can actually use commands on certain others...
But the code goes like this:
local ProcessCommand = function(Player,SelectedCommand,PlayerList) if CheckTable(Owners,Player.Name) then Commands[SelectedCommand](Player,PlayerList) elseif CheckTable(Admins,Player.Name) then if SelectedCommand ~= "kick" and SelectedCommand ~= "ban" and SelectedCommand ~= "pban" then Commands[SelectedCommand](Player,PlayerList) else Commands[SelectedCommand](Player,AdjustPlayerListForAdminLevel(PlayerList)) NotifyPlayerEvent:FireClient(Player,"System Notification","ERROR: You cannot "..SelectedCommand.." another admin. All other selected players were still "..SelectedCommand.."'d though.",60) end end end
ProcessCommandEvent.OnServerEvent:connect(ProcessCommand) |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2016 06:48 PM |
I usually don't share my coding ways.
But why remote_event's to pass variables from client to server.
.Chatted can be ran server sided, and if you needed to run something locally you could use RemoteEvent:FireClient(); |
|
|
| Report Abuse |
|
|
Isosta
|
  |
| Joined: 10 May 2015 |
| Total Posts: 14729 |
|
|
| 08 Jul 2016 06:51 PM |
@secret,
FireClient still requires a remote event.
- Isosta |
|
|
| Report Abuse |
|
|
|
| 08 Jul 2016 06:58 PM |
Yeah but he's passing from client to server.
I see now, you have a command bar now right? Not just using chat. Or custom-chat. Yeah that would be useful and necessary in that scenario. |
|
|
| Report Abuse |
|
|