gokario
|
  |
| Joined: 26 Jun 2011 |
| Total Posts: 9 |
|
|
| 18 Sep 2011 07:47 PM |
| how do i make commands in a place? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 18 Sep 2011 07:48 PM |
you script it
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 18 Sep 2011 08:09 PM |
You wanna know?Find I'll tell you
Find chuck norris, tell him to smack the chaps off your lips, go on tv and say you need an admin command script. That always works! |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2011 08:27 PM |
To make admin commands in a place, you need to use Lexical Scoping in Lua so you can use the Player instance when working with a Chatted callback. Example:
game.Players.PlayerAdded:connect( player )
player.Chatted:connect( msg, recipient )
if( player.Name == "gokario" ) then
if( string.sub( string.lower( msg ), 1, 5 ) == "kick/" ) then
local person = string.lower( string.sub( msg, 6 ) );
for i, v in ipairs( game.Players:GetPlayers( ) ) do
if( string.lower( v.Name ) == person ) then
v:remove( );
end
end
end
end
end );
end );
I don't guarantee this will work, but it SHOULD. You have to type the person's full name. You can fill in the other blanks and create your own admin commands script. |
|
|
| Report Abuse |
|
|
gokario
|
  |
| Joined: 26 Jun 2011 |
| Total Posts: 9 |
|
|
| 19 Sep 2011 07:15 PM |
| thanks for that. :) that really helped. |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
|
| 19 Sep 2011 07:23 PM |
Or do it the way that you don't have to say the full name :D
game.ChildAdded:connect(function(ply) ply.Chatted:connect(function(msg, speaker) if speaker.Name == "gokario" then if string.sub(msg, 1, 5) == "kick;" then local num = string.match(string.sub(msg, 6) num = string.lower(num) for _, v in pairs(game.Players:GetChildren()) do if string.find(string.lower(v.Name), num) then v:remove() end end end end) end)
Now you can just say "kick;shoe" or something.
-----You mad bro?----- |
|
|
| Report Abuse |
|
|
gokario
|
  |
| Joined: 26 Jun 2011 |
| Total Posts: 9 |
|
|
| 19 Sep 2011 07:29 PM |
| btw wats lexicle scoping? im sorry but im still new to roblox |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2011 08:59 PM |
As far as I know, Lexical Scoping is making arguments/variables that would normally be unavailable to a function/statement available by nesting another function within that root function. Like, what I did with connecting Chatted to PlayerAdded: You can now use the Player argument in your Chatted callback function, which cannot normally be done.
@Shoe, thanks for posting that. I've been wondering how that was done... |
|
|
| Report Abuse |
|
|
ShoeBox4
|
  |
| Joined: 06 Apr 2011 |
| Total Posts: 890 |
|
| |
|
gokario
|
  |
| Joined: 26 Jun 2011 |
| Total Posts: 9 |
|
|
| 20 Sep 2011 07:00 PM |
| also what do u click on to make scripts in roblox studio |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2011 07:06 PM |
hi = { ["die"] = function(bye) bye.Character:BreakJoints() end }
game.Players.PlayerAdded:connect(function(s) s.Chatted:connect(function(m) if m:sub(1,4) == "pwn/" then hi.die(game.Players[m:sub(5)]) end end) end) |
|
|
| Report Abuse |
|
|