Mathias submitted a new resource:
Join/Leave Messages - Broadcast messages when a player joins/leaves the server. Optional MOTD setting.
Read more about this resource...
Join/Leave Messages [Unmaintained]
Discussion in 'Plugin Support' started by mvrb, Apr 15, 2015.
-
Code:
function PLUGIN:OnPlayerDisconnected(netuser) rust.BroadcastChat(netuser:GetLocalData().displayName.. self.Config.LeaveMSG) end
OnPlayerDisconnected uses NetworkPlayer, so you first need to get the netuser with GetLocalData()
^^ -
Mathias updated Join/Leave Messages with a new update entry:
Updated OnPlayerDisconnected
-
Is this still working, it doesn't seem to work on my server.
I have the rules plugin also. -
-
-
Code:function PLUGIN:OnPlayerConnected(netuser) if(self.Config.showMOTD == "true") then rust.SendChatMessage(netuser, self.Config.MOTD) end rust.BroadcastChat(self.Config.chatName, netuser.displayName .. self.Config.JoinMSG) endfunction PLUGIN:OnPlayerDisconnected(netuser) rust.BroadcastChat(self.Config.chatName, netuser:GetLocalData().displayName.. self.Config.LeaveMSG) end
-
-
Mathias updated Join/Leave Messages with a new update entry:
Updated Broadcast Function
-
The BroadcastChat doesn't work. It just prints the chatName
e.g Oxide: Oxide
-
But if it works with the previous version, then I don't think you have updated your Oxide mod yourself.Last edited by a moderator: Apr 20, 2015 -
The previous version 1.0.0 displays OnPlayerConnected fine. I'm running the latest Oxide (2.0.765) for Legacy.
If I remove self.Config.chatName from BroadcastChat then it works fine. -
-
2.0.773 doesn't seem to happy so will wait
Code:12:47 AM [Info] Loading Oxide core v2.0.773... 12:47 AM [Info] Loading extensions... 12:47 AM [Info] Loaded extension CSharp v0.6.773 by bawNg 12:47 AM [Info] Loaded extension JavaScript v1.0.773 by Nogrod 12:47 AM [Info] Loaded extension Lua v1.0.773 by Oxide Team 12:47 AM [Info] Loaded extension MySql v1.0.773 by Nogrod 12:47 AM [Info] Loaded extension Python v1.0.773 by Nogrod 12:47 AM [Info] Loaded extension RustLegacy v1.0.773 by Oxide Team 12:47 AM [Info] Loaded extension SQLite v1.0.773 by Nogrod 12:47 AM [Info] Loaded extension Unity v1.0.773 by Oxide Team 12:47 AM [Info] Loading plugins... 12:47 AM [Info] Loaded plugin Rust Legacy Core v1.0.0 by Oxide Team 12:47 AM [Info] Loaded plugin Unity Core v1.0.0 by Oxide Team 12:47 AM [Info] Loaded plugin Admin / Player v2.0.1 by Reneb 12:47 AM [Info] Loaded plugin Auto Admin v1.0.0 by greyhawk, Ported by Reneb to Oxide 2.0 12:47 AM [Info] Loaded plugin Helptext v1.0.1 by #Domestos 12:47 AM [Info] Loaded plugin Join-Leave Messages v1.0.2 by mvrb 12:47 AM [Info] Loaded plugin Private Messaging v1.0.0 by #Domestos 12:47 AM [Info] Loaded plugin Server Rules v1.0.0 by mvrb 12:47 AM [Info] AdminAirdrop, AdminTeleportation, AntiCheat, AntiGlitch, DoorShare, GatherMultiplier, KickBan, Kits, Location, LootSpawnLists, PlayerDatabase, Prod, RemoverTool, Share, TimeManagement and TPR were compiled successfully in 1233ms 12:47 AM [Info] Loaded plugin AdminAirdrop v1.0.2 by Reneb 12:47 AM [Info] Loaded plugin AdminTeleportation v1.0.0 by Reneb 12:47 AM [Info] Loaded plugin AntiCheat v2.0.11 by Reneb 12:47 AM [Info] Loaded plugin AntiGlitch v2.0.4 by Reneb 12:47 AM [Info] Loaded plugin DoorShare v1.0.2 by Reneb 12:47 AM [Info] Loaded plugin GatherMultiplier v1.0.2 by Reneb 12:47 AM [Info] Loaded plugin KickBan v1.0.1 by Reneb & Mughisi 12:47 AM [Info] Loaded plugin Kits v1.0.7 by Reneb 12:47 AM [Info] Loaded plugin Location v1.0.1 by Reneb 12:47 AM [Info] Loaded plugin LootSpawnLists v2.0.0 by Reneb from thomasfn 12:47 AM [Info] Loaded plugin PlayerDatabase v1.2.3 by Reneb 12:47 AM [Info] Loaded plugin Prod v1.0.2 by Reneb 12:47 AM [Info] Loaded plugin RemoverTool v1.0.3 by Reneb 12:47 AM [Info] Loaded plugin Share v1.0.1 by Reneb 12:47 AM [Info] Loaded plugin TimeManagement v1.0.0 by Reneb 12:47 AM [Info] Loaded plugin TPR v1.0.2 by Reneb 12:47 AM [Info] 31 custom loot tables were loaded! 12:47 AM [Error] Failed to call hook 'OnPlayerConnected' on plugin 'Join-Leave Messages' File: JoinLeaveMessages.lua Line: 23 invalid arguments to method call: at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 12:48 AM [Error] Failed to call hook 'cmdHelp' on plugin 'Helptext' File: helptext.lua Line: 28 invalid arguments to method call: at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
-
Code:
File: JoinLeaveMessages.lua Line: 23 invalid arguments to method call:
Code:rust.SendChatMessage()
If yes, would it be:
Code:rust.SendChatMessage(netuser, self.Config.chatName, self.Config.MOTD)
-
I'll probably PR a change tonight to have the name optional so it will work with (netuser, msg) and (netuser, chatname, msg) but that will still take a few hours as I'm not able to access my pc right now.
-
-
Mathias updated Join/Leave Messages with a new update entry:
Fixed SendChatMessage (Line 23)
-
Can it do more than one line? For the motd
Last edited by a moderator: Apr 20, 2015 -