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 » Scripting Helpers
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
Madified is not online. Madified
Joined: 19 Apr 2011
Total Posts: 5292
03 Dec 2013 09:38 AM
[ Content Deleted ]
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
03 Dec 2013 09:41 AM
basically search for patterns.

Example:

function locate(sub)
pla = {}
for i, v in next, game.Players:GetPlayers() do
for x in string.gmatch(sub, "%w+") do
if v:Find(x) then
table.insert(pla, v)
end
end
end
Report Abuse
crazyman32 is not online. crazyman32
Joined: 13 Apr 2008
Total Posts: 18027
03 Dec 2013 09:43 AM
I don't know, but this is how I would do it:

Let's say 'name' is the variable that contains the current fragment of a name. For this example, let's say it is 'cra' and I happen to be in the game:


-- Assuming variable 'name' equals 'cra' (name = "cra")

local player = nil
for _,p in pairs(game.Players:GetPlayers()) do
local nameFragment = p.Name:sub(1, #name):lower()
if (nameFragment == name:lower()) then
if (player) then
player = nil
print("Ambiguous")
break
end
player = p
end
end


Put into english:
- Scan through all players
- For each name, get the substring based on the length of the name fragment to test
- Compare the player's name with the name fragment
- If a match is made, set variable 'player' to that player
- CONDITION: If a match is made, but 'player' was already set, this means that there is MORE than 1 match, meaning the command should not go through since more than 1 player could apply to the name fragment.
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
03 Dec 2013 09:49 AM
They do it like this:

Get the max lenght of the string.
Make any possible number combination between 1 and the max lenght.
Take a part of the string with :sub()
Check if that is what the player entered.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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