|
| 05 Jan 2014 03:47 PM |
ok so i am needing onchatted help (admin commands) i am trying to make somthing like this so how would i do it
Admins = {"","","",""}
function OnChatted(msg) if msg = "kill/" then killPlayer.Name end |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2014 03:47 PM |
or ...
Admins = {"","","",""} if not Admins then script.Parent:remove() function OnChatted(msg) if msg = "kill/" then killPlayer.Name end |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2014 03:52 PM |
Here's a simple way without anything super fancy like shortening names.
admins = {"rosenburger", "McChicken72")
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:wait() for i,v in pairs(admins) do if v:lower() == plr.Name:lower() then plr.Chatted:connect(function(msg) if string.sub(msg,1,5):lower() == "/kill" then if game.Players:FindFirstChild(string.sub(msg, 6) then local victim = game.Players:FindFirstChild(string.sub(msg, 6) if victim.Character:FindFirstChild("Humanoid") then humanoid:TakeDamage(100) -- :TakeDamage() doesn't take damage if they have a forcefield end end end end) end end end) |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2014 03:52 PM |
| Whoops my above code actually has some syntax error I'll fix it one sec |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2014 03:55 PM |
admins = {"rosenburger", "McChicken72")
function isAdmin(plr) for i,v in pairs(admins) do if v:lower() == plr.Name:lower() then return true end end return false end
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:wait() if isAdmin(plr) then plr.Chatted:connect(function(msg) if string.sub(msg,1,5):lower() == "/kill" then if game.Players:FindFirstChild(msg:sub(6)) then local victim = game.Players:FindFirstChild(msg:sub(6)) if victim.Character:FindFirstChild("Humanoid") then local humanoid = victim.Character:FindFirstChild("Humanoid") humanoid:TakeDamage(100) -- TakeDamage doesn't take damage if they have a force field end end end end) end end) |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2014 03:57 PM |
| um i was looking for somthing like kill:rosenburger commands |
|
|
| Report Abuse |
|
|
|
| 05 Jan 2014 04:02 PM |
No I just gave you a script, whenever you want to kill someone just do this
/kill rosenburger
You have to use the full name because I didn't script the shortening names since I try to help people quickly.
You can make it all caps or all lowercase or a mix it doesn't matter. |
|
|
| Report Abuse |
|
|