Welcome Message and Notifications [Abandoned]
Discussion in 'Plugin Support' started by Taffy, Oct 16, 2014.
-
@Shiyoda - Thanks for the input, you seem to have removed some of the settings which remove the user defined variables at disconnect. These will stay in memory until server is restarted unless I am reading it wrong.
Update to follow using simplified method of outputting JSON table entries from multiplelinemessage as per suggestion from @Mughisi -
@Loup-des-Neiges I've tried to reproduce your error and maybe it works now. Please make sure you have restarted your server. The error occurs if your server reloads the Plugin:
Code:XX:XX AM/PM [Info] Loaded plugin User Connection Notification (v1.0.8) by Taffy
Code:function PLUGIN:OnPlayerDisconnected(ply,connection) DName = ( ply.displayName ) if (ply.displayName and self.Config.ShowDisconnected) then allusermsg = (self.Config.AllUserMessageBye) allusermsg = allusermsg:gsub("USERNAME",DName) global.ConsoleSystem.Broadcast("chat.add \"" .. self.Config.ChatName .. "\" \"" .. allusermsg .. "\"") else return end if (self.DisplayedWelcome[DName] ~= nil) then self.DisplayedWelcome[DName] = nil end end
Code:function PLUGIN:OnRunCommand( arg , ply , cmd ) -- Sanity checks if (not arg) then return end if (not arg.connection) then return end if (not arg.connection.player) then return end if (not arg.cmd) then return end if (not arg.cmd.name) then return end local ply = arg.connection.player DName = ( ply.displayName ) if (arg.cmd.name == "wakeup") then -- user has pressed the wake up button --print ("wakeup button pressed") if self.DisplayedWelcome[DName] ~= nil then if self.DisplayedWelcome[DName].LineCompare > LineCount then print ("error in calculation, linecompare is greater than linecount : " .. self.DisplayedWelcome[DName].LineCompare) else while self.DisplayedWelcome[DName].LineCompare <= LineCount do LineNo="Line" ..(self.DisplayedWelcome[DName].LineCompare) usermsg = (self.Config.UserMessages[LineNo]) usermsg = usermsg:gsub("USERNAME",DName) ply:SendConsoleCommand("chat.add \""..self.Config.ChatName.."\" \""..usermsg.."\"") -- sends the message to the connecting player self.DisplayedWelcome[DName].LineCompare = self.DisplayedWelcome[DName].LineCompare + 1 end end end end end
Added these lines back... my fault
Lines:
Code:if (self.DisplayedWelcome[DName] ~= nil) then self.DisplayedWelcome[DName] = nil end
Attached Files:
Last edited by a moderator: Nov 1, 2014 -
-
Taffy updated Welcome Message and Notifications with a new update entry:
Bugfix and restructure - Less variables to balls it all up
-
11:58 PM [Error] usernotification: [string "usernotification.lua"]:77: attempt to index global 'usermsg' (a nil value)
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 -
-
{
"ChatName": "SERVER",
"ShowConnected": true,
"AllUserMessage": "USERNAME has connected",
"MultipleLineMessage": [
"Hi USERNAME! Welcome to the server",
"Enjoy you time with us."
],
"ShowDisconnected": true,
"AllUserMessageBye": "USERNAME has disconnected"
}[DOUBLEPOST=1414883714][/DOUBLEPOST]It's just Default. I haven't changed anything at all. -
Weird. Unable to recreate myself. Edited config, deleted config, no issues. Is it happening all the time? Perhaps unload the plugin, delete the config and then reload.
-
Oh god... You can make normal code?
Why from config loaded only message, except chat prefix and settings?? New version baddest that prev, developer -
-
Taffy updated Welcome Message and Notifications with a new update entry:
Error in reading config
-
-
Taffy updated Welcome Message and Notifications with a new update entry:
Additions and bugfix
-
Hey Taffy, great job on the update, not sure if this is allowed or if just set the way it is:
1. The name SERVER cant be changed
2. Where it says "USERNAME has connected" or "USERNAME has disconnected" anything inside of those fields can't be changed, is this the way its supposed to be or can this be changed?
I deleted the old config and restarted the server, then made changes, saved and restarted again and in Rust it loads the default.
Cheers -
1. The name seems to only work for broadcast messages like when someone disconnects or connects. Not found a way to change it for when just sending a chat message to an individual user. Are you saying its not taking the change at all or just when it shows the welcome message (broadcast)?
2. You should be able to change any of the text in there mate. I will take another look at it sorry -
I changed it and it didnt pickup any of the changes I have just deleted it and placed the plugin back restarted, edited config, save, restarted and it doesnt pick up the new changes.
Maybe I made a mistake:
Code:{ "AllUserMessageBye": "USERNAME has left this realm", "ChatName": "ALMIGHTY", "MultipleLineMessage": [ "Gday USERNAME! No Griefing | Respect | Have Fun", "Commands", "/kit starter", "/location", "/remove" ], "ShowDisconnected": "true", "ShowWelcomeMessage": "true", "AllUserMessage": "USERNAME has joined this realm", "ShowConnected": "true" }
-
My code example:
Code:function PLUGIN:SendMessage(prefix, message, target) message = UnityEngine.StringExtensions.QuoteSafe(message); if (target) then target:SendConsoleCommand("chat.add \"" .. prefix .. "\"" .. message); else global.ConsoleSystem.Broadcast("chat.add \"" .. prefix .. "\"" .. message); end end
-
Ummm kpoIIIkaeHo7
Chat add? Whats that to do with notifications? -
[DOUBLEPOST=1415120539][/DOUBLEPOST] -
This is interested ALMIGHTY says jf3000 is connected but then goes back to SERVER with the rest of the messages. Just says connected doesn't mention anything else