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: Would this be correct?

Previous Thread :: Next Thread 
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 02:50 PM
Admins = {"Player"}
Players = { }

function findPlayers(name, speaker)
if string.lower(name) == (name) then
local chars = { }
local c = game.Players:GetChildren()
for i = 1, #c do
if c[i].className == "Player" then
table.insert(chars,c[i])
end
end
end
end

I have no idea, I'm trying to work on something, so.


RAP:833,922
Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
27 Apr 2015 02:58 PM
I really don't know strings and all, but isn't it string:lower()?
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 02:59 PM
No idea to be honest. I was just looking through Person299's Admin..


RAP:833,922
Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
27 Apr 2015 03:00 PM
Yeah I just check, it's :lower(). Person299's admin is ages old, so you might have to use another one for reference, lol.
Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
27 Apr 2015 03:01 PM
checked*
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
27 Apr 2015 03:01 PM
it can be written as string.lower(stringToLower), or be called as a method
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
27 Apr 2015 03:02 PM
@prox

you can call it with '.' too

> print(string.lower 'UPPER->LOWER')
upper->lower

Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
27 Apr 2015 03:04 PM
Oh ok, glad you know.
Well on my admin commands I always use :lower(), and since I don't know sht about strings, I wouldn't know haha
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
27 Apr 2015 03:04 PM
And OP, syntactically it is correct, but you may want to check some things.

Admins = {"Player"}
Players = { }

function findPlayers(name, speaker)
if string.lower(name) == (name) then
-- is the first element of the conditional supposed to be the speaker's name?
local chars = { }
-- the table is named 'chars', but the players are inserted.
local c = game.Players:GetChildren()
for i = 1, #c do
if c[i].className == "Player" then
table.insert(chars,c[i])
end
end
end
end
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:05 PM
Okay, but would this work if I were to say something like..
";Kill Noob" or something?


RAP:833,922
Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
27 Apr 2015 03:06 PM
Just use the chatted function, it makes things a lot less confusing.
Of course you could still apply standard string things on it if you used chatted,
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:06 PM
@Jimmy
No.
I'm intending the speaker to say something like "Kill Noob" and it kills the player. Would mine work?


RAP:833,922
Report Abuse
JimmyChance is not online. JimmyChance
Joined: 01 Nov 2009
Total Posts: 3681
27 Apr 2015 03:08 PM
well nothing is returned and I don't know how this is being used in the script
Report Abuse
Proxemics is not online. Proxemics
Joined: 30 Oct 2013
Total Posts: 2542
27 Apr 2015 03:09 PM
As I said before, Durst, just use the chatted function. It's really easy.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:10 PM
I know it is, but Scripth/Kohl suggested I look through Person299's admin for all this.. ._.


RAP:833,922
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
27 Apr 2015 03:24 PM
Prox, you don't know sht about strings yet you made admin commands?

That must have been pretty fking hellish for you then.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:31 PM
I'm thinking about re-writing my script sorta. I don't like to make stuff like
"function functionName(blah,blah)
end"

I prefer

game.Blah.Blah:connect(function(blah)
end)

.-.


RAP:833,922
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
27 Apr 2015 03:35 PM
do it

its more efficient
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
27 Apr 2015 03:40 PM
You mean you prefer anonymous functions? They're good, but if you make them connect to a named function, you can use that named function from other parts of your script if necessary, which can yield some cool/efficient results.

Although I would make them anonymous if you weren't going to use them anywhere else.
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:42 PM
How's this so far then?

local Admin = {["Player"] = true}

function findPlayer(name)
for _, c player in ipairs(game.Players:GetPlayers())do
if player.Name:lower() == name:lower()then
return player
end
end
end
function adminPlayer(message, player)
if message:sub(1,7) == "!admin " and Admin[player.Name]then
plr = findPlayer(message:sub(8))
if plr and plr.Character then
table.insert(Admin, 1, "["plr.Name"] = true")
end
end
end


RAP:833,922
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:43 PM
Wouldn't it be table.insert(Admin, 1, "["..plr.Name"] = true") ?


RAP:833,922
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
27 Apr 2015 03:48 PM
scratch all of that

local admins = {"AbstractMadness","Player"}

function FindPlayer(name)
return game:GetService("Players"):FindFirstChild(name)
end

function IsAdmin(plr)
for _,admin in next, admins do
if admin == plr.Name then
return true
else
return false
end
end
end

function MakeAdmin(msg, chatter)
if msg:sub(1,7):lower() == "!admin " and IsAdmin(chatter) then
plr = FindPlayer(message:sub(8))
if plr and plr.Character then
table.insert(admins, plr.Name)
end
end
end
Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:56 PM
Would it need a Changed event for players to use the commands?


RAP:833,922
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
27 Apr 2015 03:56 PM
Why are you doing it like that? Just have a list of actual names.

It would be easier to search admins if you did it with instances.

In this example, you would also be able to set their privilege level (like 1 for a temp, 2 for a normal, 3 for a special, 4 for owner, whatever).

I recommend using a system that goes by userIds, so you don't have to change the script if an admin changes their name.

ownerAdmins = {myID}
specialAdmins = {someID, someOtherID}
normalAdmins = {otherID, anotherID, yetAnotherID}
termpAdmins = {}

admins = Instance.new("Folder", script)
admins.Name = "Admins"

for _, v in pairs(ownerAdmins) do
local admin = Instance.new("IntValue", admins)
admin.Name, admin.Value = tostring(v), 4
end

for _, v in pairs(specialAdmins) do
local admin = Instance.new("IntValue", admins)
admin.Name, admin.Value = tostring(v), 3
end

for _, v in pairs(normalAdmins) do
local admin = Instance.new("IntValue", admins)
admin.Name, admin.Value = tostring(v), 2
end

for _, v in pairs(tempAdmins) do
local admin = Instance.new("IntValue", admins)
admin.Name, admin.Value = tostring(v), 1
end

This way you can do admins:FindFirstCHild(player.userId) and easily check their privileges and stuff.


Report Abuse
DurstAuric is not online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
27 Apr 2015 03:57 PM
>for _,admin in next, admins do

Uhh, "in next"?


RAP:833,922
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