因此,我目前正在尝试创建一个小脚本,例如当玩家在 GMOD 中输入“!内容”时,他们将由一个窗口呈现,该窗口将引导他们进入该服务器的 Steam 内容。对于前面的示例它有效,因此我尝试复制模板并更改函数名称等。我没有遇到与所示示例相同的结果,但似乎没有发生任何事情,我不知道为什么,因为我只有更改了函数名称和字符串。如果你能帮助我,那就太好了。提前致谢。
Steam 群聊脚本(作品)
function steamgroupCommand( ply, text)
if string.sub( text, 1, 6 ) == "!steam" then
ply:PrintMessage( 3, "It Worked!" )
ply:SendLua([[gui.OpenURL("http://steamcommunity.com/groups/PhantomNetworksCommunity")]])
for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. ply:Nick() .. " has used !steam to view our community Steam Group!" )
end
end
end
hook.Add( "PlayerSay", "Chat", steamgroupCommand )
Discord 聊天脚本(不起作用)
function discordCommand( ply, text)
if string.sub( text, 1, 8 ) == "!discord" then
ply:PrintMessage( 3, "It Worked!" )
ply:SendLua([[gui.OpenURL("https://discord.gg/35rQxcE")]])
for k, v in pairs(player.GetAll()) do v:ChatPrint( "Player " .. ply:Nick() .. " has used !discord to view our official Discord server!" )
end
end
end
hook.Add( "PlayerSay", "Chat", discordCommand )