Chronok
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 402 |
|
|
| 02 Jan 2012 02:35 PM |
if tierOne[playerObject.Name] or tierTwo[playerObject.Name] or tierThree[playerObject.Name] then
This is part of my admin command script, but I don't find this to be efficient... at all. The tables I have aren't necessary, but if you want to see them, I'll post 'em for you.
{ ["Chronok"] = "Intermediate scripter/programmer." }
|
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 02 Jan 2012 02:41 PM |
| Are you able to use logic operators(ternary blab whatever you call it). What you posted isn't ineffecient but you can't really say much only looking at one line of code |
|
|
| Report Abuse |
|
|
Chronok
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 402 |
|
|
| 02 Jan 2012 02:46 PM |
local tierOne = { ["nameOne"] = true; ["nameTwo"] = true; ["nameThree"] = true } local tierTwo = { ["nameOne"] = true; ["nameTwo"] = true; ["nameThree"] = true } local tierThree = { ["nameOne"] = true; ["nameTwo"] = true; ["nameThree"] = true; ["Chronok"] = true } local playersService = game:GetService("Players") local workspaceService = game:GetService("Workspace") playersService.PlayerAdded:connect(function(playerObject) playerObject.Chatted:connect(function(stringMessage) if string.sub(stringMessage, 1, 5) == "kill/" then if tierOne[playerObject.Name] or tierTwo[playerObject.Name] or tierThree[playerObject.Name] then
{ ["Chronok"] = "Intermediate scripter/programmer." } |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 02 Jan 2012 02:55 PM |
| It doesn't get much better than what you posted unless you wanted us to rescript your code which i dun think anyone wants to do |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 02 Jan 2012 02:58 PM |
Check if the player is an admin after the playeradded function
|
|
|
| Report Abuse |
|
|
Chronok
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 402 |
|
|
| 02 Jan 2012 03:01 PM |
@smurf
I can't do that because then all tiers would be allowed to use all of the commands.
{ ["Chronok"] = "Intermediate scripter/programmer." } |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2012 03:07 PM |
| That's as efficient as it needs to be. |
|
|
| Report Abuse |
|
|
Chronok
|
  |
| Joined: 29 Dec 2011 |
| Total Posts: 402 |
|
|
| 02 Jan 2012 03:10 PM |
@Merlin
Oh. It just seemed sort of... repetitive.
{ ["Chronok"] = "Intermediate scripter/programmer." } |
|
|
| Report Abuse |
|
|