0
我正在嘗試製作新的管理命令腳本;到目前爲止我所擁有的全部是kill命令......除非我使用「:* me」參數(「*」是任何命令,「:」是識別字符, 「T明白爲什麼這是行不通的。Roblox管理命令腳本
我已經嘗試了一些瘋狂的事情,試圖使這項工作,所以代碼可以從我有它最初被屠殺......
admins = {"FakeNameHereSoNoStalkers"}
function kill(target)
for i=1,#target do
game.Players.target[i].Character:BreakJoints()
end
end
function isadmin(source)
for i=1,#admins do
if admins[i]:lower()==source:lower() then return true end
end
end
function findplayer(msg, source)
people = {}
c = game.Players:GetChildren()
if msg:lower()=="me" then
table.insert(people, source)
return people
elseif msg:lower()=="all" then
for i=1,#c do
table.insert(people, c[i])
end
return people
else
local length = msg:len()
for i=1,#c do
if c[i].Name:lower():sub(1, length)==msg:lower() then
table.insert(people, c[i])
end
end
return people
end
end
game.Players.PlayerAdded:connect(function(player)
source = player.Name
if isadmin(source) == true then
player.Chatted:connect(function(msg, player)
if msg:lower():sub(1,6)==":kill " then
msg = msg:sub(7)
target = findplayer(msg, source)
kill(target)
end
end)
end
end)
這是做管理一個真正可怕的方式。用發送事件的按鈕創建一個簡單的Gui會更好。此外,你應該打破發送不是管理員的命令的任何人的關節,並記錄他們的嘗試,或將他們添加到禁止列表。 另外,您不應該根據播放器的名稱,而是UserId來執行此操作。你也應該密碼保護行動。 –