generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Admin Base

Previous Thread :: Next Thread 
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 11:40 AM
Does anyone have a script where the arguments are in a table and uses match?
Like

Chat = "teleport vlek,fil,me,nonadmins,k,hi 33 33 33"
Arguments = MATCHING THING
if Argument[1] == "teleport" then
SelectedPlayers = {}
for _, n in pairs(Arguments) do
if _ ~= 1 or _ < #Arguments-2 then
SelectedPlayers:insert(n)
end
end
end

like that?


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Nov 2014 12:24 PM
You would want to use a loop, also 'SelectedPlayers:insert(n)' wouldn't work.

for argument in Char:gmatch("[^,]+") do
-- insert argument into table
end
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 01:49 PM
I tried

for Argument in Chat:gmatch("[^,]+") do
table.insert(Arguments, Argument)
end

But it simply inserts the whole Chat instead.

Full script:


local Arguments = {}

Chat = Chat:lower()

local SelectedPlayers = {}

for Argument in Chat:gmatch("[^,]+") do
table.insert(Arguments, Argument)
end

print(Arguments)
print(#Arguments)

for _, Argument in pairs(Arguments) do
print("1 "..Argument)
end


prints > table: 23E41B48
1
1 hey you frikin wot m8 8


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Nov 2014 02:34 PM
Try this:

("%W [^,]+")
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Nov 2014 02:39 PM
Woops:

Chat = "teleport vlek,fil,me,nonadmins,k,hi 33 33 33"
local cmd = Chat:match("%S+")
Chat = Chat:gsub(cmd .. " ", "");

for Argument in Chat:gmatch("[^,]+") do
print(Argument)
end
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 03:06 PM
Number of Arguments: 1
1 do you evne lift
22:05:41.243 - ReplicatedStorage.AdminLibrary.ModuleScript:6: attempt to concatenate local 'Command' (a nil value)


Full Script:

Chat = Chat:lower()
local Command = Chat:match("%S+")
Chat = Chat:gsub(Command .. " ", "");

local SelectedPlayers = {}

local Arguments = {}

for Argument in Chat:gmatch("[^,]+") do
table.insert(Arguments,Argument)
end

print("Number of Arguments: " .. #Arguments)

for _, Argument in pairs(Arguments) do
print("1 "..Argument)
end


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Nov 2014 03:08 PM
What does Chat equal?
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 03:23 PM
"do you evne lift"
in that case.



~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 03:59 PM
>_>


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 04:12 PM
Chat = Chat:lower()

local SelectedPlayers = {}

local Arguments = {}

for Argument in Chat:gmatch("[^,]+") do
print("2 " .. Argument)
table.insert(Arguments,Argument)
end


> 2hello im sir derp


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
29 Nov 2014 04:23 PM
anything?


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
29 Nov 2014 04:32 PM
The arguments are separated by commas, not spaces in what I gave you.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
29 Nov 2014 04:32 PM
Try [^,]- instead?
Or, alternatively just do

,?([%s%w]),?

The commas are of course there to be annoying.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
30 Nov 2014 04:00 AM
The "%s%w"

> Chat: hi im derpman
2 i
2 d
Number of Arguments: 2
1 i
1 d


The ^,

> Chat: derp im derpman
Number of Arguments: 0

The "[%s%w]"

> Number of Arguments: 13
1 h
1 i
1
1 i
1 m
1
1 d
1 e
1 p
1 r
1 m
1 a
1 n


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
30 Nov 2014 04:02 AM
It is like

COMMAND(SPACE)NAME,NAME,NAME,NAME,NAME ARGUMENTS
^infinity names possibility

Arguments diffrentiate on the command.
So I'll probably have to see the command, get the number of arguments needed, and on that based see how many names there are. < Or you could possibly see that by comma's.


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
30 Nov 2014 04:07 AM
I tried %w+

> Chat: teleport vlekje513,filip,king 33 48 22
2 teleport
2 vlekje513
2 filip
2 king
2 33
2 48
2 22
Number of Arguments: 7
1 teleport
1 vlekje513
1 filip
1 king
1 33
1 48
1 22

it works :D
thanks a lot of ya help :D


~Master bug finder twitch.tv/ROBLOX/c/4691695 14:08~
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image