Blitzorz
|
  |
| Joined: 24 Aug 2012 |
| Total Posts: 31 |
|
|
| 04 Jun 2014 07:59 PM |
Alright slags, I use string patterns to create commands on my admin script, why do they only work on players who enter before me.
cmds={}
cmds["kill"]=function(plr) for _,v in next,game.Players:GetPlayers() do if string.find(v.Name:lower(),plr:lower()) ~= nil then ypcall(function() v.Character:BreakJoints() end) end end end
function onChatted(msg) cmd,parm=string.match(msg,"^(%w*)%s(%w*)") if cmd then cmd=cmd:lower() if cmds[cmd] then cmds[cmd](parm) else return print("That is not a command!") end end end game.Players.LocalPlayer.Chatted:connect(onChatted)
Can someone please tell me why this wouldn't work on a player who enters after you enter? Giving rare admin to the first person to give me the correct answer.... |
|
|
| Report Abuse |
|
|
magnalite
|
  |
| Joined: 18 Oct 2009 |
| Total Posts: 2467 |
|
| |
|
Blitzorz
|
  |
| Joined: 24 Aug 2012 |
| Total Posts: 31 |
|
| |
|
| |
|
|
| 04 Jun 2014 08:47 PM |
"Prove it" It doesn't work, there's your proof. |
|
|
| Report Abuse |
|
|
Insoul
|
  |
| Joined: 04 May 2014 |
| Total Posts: 66 |
|
|
| 04 Jun 2014 09:29 PM |
ya
cmds={}
so how can you cmds['kill']
no
cmds={ kill=function() kill(); end; };
cmds.kill();
ok now we got it
herro Im syKo |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2014 09:57 PM |
| Insoul: What are you doing, that works fine |
|
|
| Report Abuse |
|
|
Blitzorz
|
  |
| Joined: 24 Aug 2012 |
| Total Posts: 31 |
|
|
| 04 Jun 2014 10:43 PM |
| Don't worry Tas, they're stupid. Just trying to figure out why it only works on players who were already in the server when I entered. |
|
|
| Report Abuse |
|
|
RA2lover
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 1254 |
|
|
| 05 Jun 2014 09:49 AM |
| you probably made the script crash by entering or something. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2014 12:20 PM |
| PlayerAdded doesn't work in a LocalScript. (That's probably not what you did wrong though) |
|
|
| Report Abuse |
|
|
Insoul
|
  |
| Joined: 04 May 2014 |
| Total Posts: 66 |
|
|
| 11 Jun 2014 07:43 PM |
blueTalsem : it was the cmds={kill=function() end} part that kinda threw me off.
herro Im syKo |
|
|
| Report Abuse |
|
|