gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 02 Nov 2016 12:54 AM |
| how would i go about making a kick command for my admin script? local Owner = {"gunter5"} local Admins = {} local Banned = {} local Player = {} local Prefix = ":" game.Players.PlayerAdded:connect(function(player) Player.insert(player.Name) for _, child in pairs(Banned) do if child.Name == Banned then child:Kick("You Are Banned.") end end end) game.Players.PlayerAdded:connect(function() for i, # ## ############ do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:lower() == Prefix .. "shutdown" then game.Players:ClearAllChildren() game.workspace:ClearAllChildren() end if msg:lower() == Prefix .. "kick " .. Player then game.Players.Player:Kick() end end) end end) |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 02 Nov 2016 12:56 AM |
| local Owner = {"gunter5"} local Admins = {} local Banned = {} local Player = {} local Prefix = ":" game.Players.PlayerAdded:connect(function(player) Player.insert(player.Name) for _, child in pairs(Banned) do if child.Name == Banned then child:Kick("You Are Banned.") end end end) game.Players.PlayerAdded:connect(function() for i, # ## ############ do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:lower() == Prefix .. "shutdown" then game.Players:ClearAllChildren() game.workspace:ClearAllChildren() end if msg:lower() == Prefix .. "kick " .. Player then game.Players.Player:Kick() end end) end end) testing to see if i can fix format |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
cj_z
|
  |
| Joined: 28 Feb 2016 |
| Total Posts: 1120 |
|
|
| 02 Nov 2016 05:33 AM |
game.Players.cj_z.Kick()
print("get rekt")
|
|
|
| Report Abuse |
|
|
MiniNob
|
  |
| Joined: 14 May 2013 |
| Total Posts: 822 |
|
| |
|
|
| 02 Nov 2016 09:53 AM |
| ######################################################### |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 02 Nov 2016 12:17 PM |
128gig - you got hashed
And to whoever says "enters please" i said that the formatting is messed up it will not put spaces or enters. |
|
|
| Report Abuse |
|
|
|
| 02 Nov 2016 02:09 PM |
local commands = {}
commands["Kick"] = function(args) for i,v in pairs(args[1]) do v:Kick("You have been kicked by: "..args[2]) end log(args) end
commands["FF"] = function(args) for i,v in pairs(args[1]) do Instance.new("ForceField", v) end log(args) end
(this is a module script above btw) |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 02 Nov 2016 08:29 PM |
local commands = {}
commands["Kick"] = function(args) -- so this line inserts the command "Kick" into the commands table.
for i,v in pairs(args[1]) do -- whats this line searching for? unless im wrong (can you explain this) i feel its searching through an empty table?
v:Kick("You have been kicked by: "..args[2]) -- who is defined as args[2]?
end log(args) end |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
| |
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 02 Nov 2016 10:13 PM |
| kinda want this command to be simple and within my understanding ._. |
|
|
| Report Abuse |
|
|
|
| 02 Nov 2016 10:50 PM |
game.Players.PlayerAdded:connect(function(player) if player.Name == "gunter5" then player.Chatted:connect(function(msg) if msg:sub(1, 6) == ":kick " then local player; for index, thisPlayer in next,game.Players:GetPlayers() do if thisPlayer.Name:sub(1,#msg:sub(7)):lower() == msg:sub(7):lower() then player = thisPlayer; break; end; end; if player then player:Kick("gunter5 has kicked you!"); end; end); end; end); |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 03 Nov 2016 12:53 AM |
oh thanks that works great. mind explaining this line in detail for me? just so i can understand better and attempt to create more commands using this concept? trying to learn better ways to code.
if thisPlayer.Name:sub(1,#msg:sub(7)):lower() == msg:sub(7):lower() then |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 03 Nov 2016 12:56 AM |
if thisPlayer.Name:sub(1,#msg:sub(7)):lower() == msg:sub(7):lower() then
i get this first little bit up till (1,#msg:sub(7))
does the 1 mean it starts at the first letter of the characters name and the 7 is the sub of the :kick string? which the 7th char being the beginning of the players name correct? |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 03 Nov 2016 01:56 AM |
| any way i could use this for kick? game.Players.PlayerAdded:connect(function(player) for i, # ## ############ do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:sub(1,1) == Prefix then local cmd = msg:sub(2) --KICK COMMAND if cmd:sub(1,4) == "kick" then local person = ###################### if person then person.Character:Kick("You have been kicked.") end end end end) end end) function ############### for _, v in ################################ do if v.Name:sub(1,msg:len()):lower() == msg:lower() then return v end end end |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 03 Nov 2016 01:58 AM |
game.Players.PlayerAdded:connect(function(player) for i, v in pairs (Owner) do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:sub(1,1) == Prefix then local cmd = msg:sub(2) --KICK COMMAND if cmd:sub(1,4) == "kick" then local person = Find Player 2(cmd :sub (6)) if person then person.Character:Kick("You have been kicked.") end end end end) end end) function FindPlayer(msg) for _, v in pairs (game. Players :GetPlayers()) do if v.Name:sub(1,msg:len()):lower() == msg:lower() then return v end end end |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 03 Nov 2016 01:59 AM |
| any way i could do the kick command like that? |
|
|
| Report Abuse |
|
|
gunter5
|
  |
| Joined: 15 Mar 2011 |
| Total Posts: 737 |
|
|
| 03 Nov 2016 02:33 AM |
| bump (findplayer2 should just be findplayer) |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 04:13 AM |
Jeepers Creepers so much cancer I would've made a whole setup but it's 4:13 AM.. idek if this works..
local PlayerService = game:GetService('Players') local ChatConnections = {} local Admins = { 'gunter5:Id' }
Prefix = ':'
getPlayer = function(name) for __, client in next, (PlayerService:GetPlayers()) do if string.lower(client['Name']):sub(1,#name) == string.lower(name) then return client en##### en##### return ni################### function(c) for __, st###n next, (Admins) do local name,id = str:match('(.*):(.*)') if c['Name'] == name or c['UserId'] == id then return true end end return false end
local Commands = { ['Kick'] = function(nam,words) local target = getPlayer(nam) if not target then return 'Target was not found' end if #words > 0 then target:Kick(words) else target:Kick('You were kicked by an Admin.') en########################### fu###################ommand, function in next, (Commands) do if command:lower() == str:lower() then return {found=true;name=command,func=function} end end return {found=false} end
PlayerService['PlayerAdded']:connect(function(new_client) local hasAdmin = isAdmin(new_client) if hasAdmin then ChatConnections[new_client['UserId']] = new_client['Chatted']:connect(function(msg) if msg:sub(1,1) == Prefix then local p1 = msg:match(Prefix..'(%w+)') local cmd = getCommand(p1) if cmd['found'] then if cmd['name'] == 'Kick' then cmd['func'](msg:gsub(Prefix..'(%w+)',''):match('(%w+)'),'I Got lazy..') end end end end) end end)
#code Signature_mod = require(DataModel['sm_Data']) if Signature_mod['xThe..']['RbxDev_Info'] ~= 'Too Lazy To Try Again After A Year' then print('You finally did it lol') end |
|
|
| Report Abuse |
|
|
|
| 03 Nov 2016 04:14 AM |
And it got hashtagged done..
#code Signature_mod = require(DataModel['sm_Data']) if Signature_mod['xThe..']['RbxDev_Info'] ~= 'Too Lazy To Try Again After A Year' then print('You finally did it lol') end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 03 Nov 2016 09:46 AM |
My hash was a link to a video Google "How to make a basic admin script in 11 minutes" |
|
|
| Report Abuse |
|
|
yankana
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 431 |
|
|
| 03 Nov 2016 01:03 PM |
Press F9 and enter:
game.Players.player:Kick("Reason here") |
|
|
| Report Abuse |
|
|
yankana
|
  |
| Joined: 17 Jun 2011 |
| Total Posts: 431 |
|
|
| 03 Nov 2016 01:04 PM |
| ^ Need too switch tab to "Server Log" |
|
|
| Report Abuse |
|
|