Code:function PLUGIN:Init() command.AddChatCommand("test", self.Plugin, "cmd_test") endfunction PLUGIN:cmd_test(player, cmd, args) rust.BroadcastChat("name", "message", player) endCode:[Error] Failed to call hook 'cmd_test' File: _.lua Line: _ invalid arguments to method call:
Solved Invalid args with BroadcastChat (Lua)
Discussion in 'Rust Development' started by SwipoStyle, Jul 13, 2015.
-
Code:
function PLUGIN:cmd_test(player, cmd, args) rust.BroadcastChat("This is a message to everyone") endorfunction PLUGIN:cmd_test(player, cmd, args) rust.SendChatMessage(player, "This is a message sent to the player that used the command") end
-
The documentation is displayed 3 argument, how to use them?
Code:rust.BroadcastChat(name, message, userid)
-
in-game chat it will be displayed as
Code:[format] Name : Message [example] Zuen : "Hello World"
-
-
My mistake was that I used the player, not the UserID
Code:rust.BroadcastChat("name", "message", rust.UserIDFromPlayer(player))
-
Wulf Community Admin
-
Sorry, I wanted to make a simple command '/say ' to administrators (analogue console), but I can't
Code:function PLUGIN:cmd_say(player, cmd, args) rust.BroadcastChat("Admin", args) -- fail code end
-
Code:function PLUGIN:cmd_say(player, cmd, args) local text = tostring(args[0]) rust.BroadcastChat("Admin", text) end -- Remember to type in Quotation Marks ""