Garry's Mod 中的 Lua 踢人和禁言问题。

我有一个服务器,想要在菜单中添加选项卡,我使用了以下命令:

local force = actions:AddOption( "Kick Player from the game" )
force:SetIcon( "icon16/delete.png" )
function force:DoClick()
  RunConsoleCommand("ulx kick","reason", ply:EntIndex())
end

但是我收到了这个错误:

RunConsoleCommand: Command has invalid characters! (ulx kick (' '))
        The first parameter of this function should contain only the command, the second parameter should contain arguments.

请问有人能帮我吗?

点赞
用户4273199
用户4273199

你的命令是 ulx

你的参数是: kickreasonply:EntIndex()

因此,代码行应为:

RunConsoleCommand("ulx", "kick", ply:EntIndex(), "reason")

而不是

RunConsoleCommand("ulx kick","reason", ply:EntIndex())

因为该函数的第一个参数应该只包含想要调用的命令。

来源:错误信息 ("该函数的第一个参数应该只包含命令,[…]") 和http://wiki.garrysmod.com/page/Global/RunConsoleCommand

2014-11-20 07:55:53