|
| 02 Aug 2013 07:40 PM |
So far the "all" and selecting a segment of his/her name works, but the "me" will not. I am NOT trying to make the name select be able to kill multiple people at the moment, so please don't post anything like that...
And yes, I'm using the colon because of kohl's admin script and the colon looks better than any other character for the admin stuff...
admins = {"GreatKyle232"}
function kill(target) for i=1,#target do target[i].Character:BreakJoints() end end
function isadmin(player) for i=1,#admins do if string.lower(admins[i])==string.lower(player.Name) then return true end end end
function findplayer(msg, player) people = {} c = game.Players:GetChildren() if string.lower(msg)=="me" then table.insert(people, player) end if string.lower(msg)=="all" then for i=1,#c do table.insert(people, c[i]) end end local length = string.len(msg) for i2=1,#c do if string.lower(string.sub(c[i2].Name, 1, length))==string.lower(msg) then table.insert(people, c[i2]) end end return people end
game.Players.PlayerAdded:connect(function(player) if isadmin(player) == true then player.Chatted:connect(function(msg, player) if string.lower(string.sub(msg, 1 ,6))==":kill " then msg = string.sub(msg, 7) target = findplayer(msg, player) kill(target) end end) end end)
So what went wrong?? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 08:04 PM |
The colon is stupid, I would rather "/command arguments" or even "!command arguments"
|
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 09:57 PM |
@cntkillme
why did you even bother posting that -_- |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 02 Aug 2013 10:12 PM |
| can you tell me what actually went wrong, though? that was the whole point. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 10:13 PM |
Replace:
if string.lower(msg)=="me" then table.insert(people, player) end
With:
if string.lower(msg)=="me" then return {player} end |
|
|
| Report Abuse |
|
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 02 Aug 2013 10:27 PM |
| ?? I changed it to what you said but it still didn't work |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 02 Aug 2013 10:30 PM |
| the only output would be it killing me and it didn't do that...(how can I test this without launching the game, btw, that's getting annoying, plus the server has to shutdown for it to update) |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 10:31 PM |
| also I tried just "return player" apparently that's a syntax error, causes all of the commands to stop working : / |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 10:34 PM |
| Well, I hate kohl's admin, I prefer to use my own, so idk. |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 10:37 PM |
| i'm not using kohl's, i'm making my own, i'm just using the colon thing from his |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 10:37 PM |
| Then something is wrong with your script |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 10:38 PM |
| that's what i'm trying to fix |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 10:41 PM |
Make sure you are calling that function with player defined.
like: findPlayer(blah, speaker) < or wut you put insted of speaker |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 10:46 PM |
O:O:O:O:O:O: I fixed it!
I replaced it with
if string.lower(msg)=="me" then for i=1,#c do if string.lower(c[i].Name)~=string.lower(msg) then table.insert(people, c[i]) end end end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 02 Aug 2013 10:48 PM |
-.- That get's everyone who's name is not "me" |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 10:53 PM |
| wow, sry, mistyped that... string.lower(msg) is supposed to be player.Name:lower() |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 02 Aug 2013 10:54 PM |
| and the ~= was supposed to be ==, wow |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 02 Aug 2013 10:57 PM |
| eh worked in theory, when the server finally closed for me to test it... fail, *sigh* |
|
|
| Report Abuse |
|
|
|
| 02 Aug 2013 10:59 PM |
gtg, still not working though, might actually be worse : /
admins = {"GreatKyle232"}
function kill(target) for i=1,#target do target[i].Character:BreakJoints() end end
function isadmin(player) for i=1,#admins do if admins[i]:lower()==player.Name:lower() then return true end end end
function findplayer(msg, player) people = {} c = game.Players:GetChildren() if msg:lower()=="me" then for i=1,#c do if c[i].Name:lower()==player.Name:lower() then table.insert(people, c[i]) end end elseif msg:lower()=="all" then for i2=1,#c do table.insert(people, c[i2]) end else local length = msg:len() for i3=1,#c do if c[i3].Name:lower():sub(1, length)==msg:lower() then table.insert(people, c[i3]) end end end return people end
game.Players.PlayerAdded:connect(function(player) if isadmin(player) == true then player.Chatted:connect(function(msg, player) if msg:lower():sub(1,6)==":kill " then msg = msg:sub(7) target = findplayer(msg, player) kill(target) end end) end end)
|
|
|
| Report Abuse |
|
|