Ok thanks. At work at the moment so will look as soon as I get back tomorrow or will try tonight from hotel.
Welcome Message and Notifications [Abandoned]
Discussion in 'Plugin Support' started by Taffy, Oct 16, 2014.
-
To fix spawn broadcast
Make the changes below:
Change:
Code:function PLUGIN:OnPlayerSpawn( ply,connection ) if(self.Config.ShowConnected) then tmpuser= ( connection.username ) --Send message to all connected users allusermsg = (self.Config.AllUserMessage) allusermsg = allusermsg:gsub("USERNAME",tmpuser) global.ConsoleSystem.Broadcast("chat.add \"" .. self.Config.ChatName .. "\" \"" .. allusermsg .. "\"") end end---testing for when player clicks wake up function PLUGIN:OnRunCommand( arg , ply) -- Sanity checks if (not arg) then return end if (not arg.connection) then return end if (not arg.connection.player) then return end local ply = arg.connection.player DName = ply.displayName if (ply.wakeup) then -- user has pressed the wake up button if self.DisplayedWelcome[DName] == nil then usermsg = (self.Config.UserMessage) usermsg = usermsg:gsub("USERNAME",DName) ply:ChatMessage(usermsg) -- sends the message to the connecting player self.DisplayedWelcome[DName] = DName end end end
Code:--Logged into the game world function PLUGIN:OnPlayerSpawn(ply, connection) end---When player wakes up function PLUGIN:OnRunCommand( arg , ply) -- Sanity checks if (not arg) then return end if (not arg.connection) then return end if (not arg.connection.player) then return end local target = arg.connection.player displayName = target.displayName if (target.wakeup) then -- user has pressed the wake up button if self.DisplayedWelcome[displayName] == nil then broadcast = self.Config.Messages.BroadcastLogin broadcast = broadcast:gsub("{UserName}",displayName) global.ConsoleSystem.Broadcast("chat.add \"" .. self.Config.Settings.ChatName .. "\" \"" .. broadcast.. "\"") usermsg = (self.Config.Messages.NewUserMessage) usermsg = usermsg:gsub("{UserName}",displayName) target:ChatMessage(usermsg) -- sends the message to the connecting player target:ChatMessage("Use /list to see available commands!") self.DisplayedWelcome[displayName] = displayName end end end
Note: This solution moves the spawn broadcast to when the player wakes up, not on world entry.
Forgot to mention very nice work Taffy!Last edited by a moderator: Oct 24, 2014 -
Taffy updated Welcome Message and Notifications with a new update entry:
Changed user connection method following Oxide Update
-
Still do not understand how this works?
if (ply.wakeup) then
There is no thing called wakeup associated with the baseplayer class. Also it doesn't conform to the coding standards they use (i.e. ply.displayName). How is this detecting that the player has clicked the wakeup button?
Code:public enum Type { Normal, Sleeping, Dead, Spectating }
I think you want the following
if ( ply.playerState.state == 1 ) then
endLast edited by a moderator: Oct 24, 2014 -
Bad idea to be coding and drinking at the same time. Going to update the evaluator as follows;
Code:if (arg.cmd.name == "wakeup")
Cheers
Dave -
Taffy updated Welcome Message and Notifications with a new update entry:
Changes to evaluator for when wake up pressed
-
-
Had this issue all day, updating the plugin still causes this error. -
-
Taffy updated Welcome Message and Notifications with a new update entry:
Added updater variable
-
hi m8 just added this is there a tip for loading plugin , i used oxide.load but since oxide update doesnt
work is there any other way, i cant restart server because if i do all keys on server stop working ??? -
oxide.load
oxide.unload
oxide.reload
That should be correct, if they don't work try reinstalling oxide.
Once you've loaded a plugin you can reload it to get the config files working and then reload again to get the modded versions (the mods you made) working. -
thanks very much
-
Would it be possible to add timed notifications (like motd, rules, etc) to this plugin?
-
probably better to make a new plugin for it
-
Working on either implementing an optional timed broadcast message or another plugin, intention is to make it part of this plugin though
-
Taffy updated Welcome Message and Notifications with a new update entry:
Bugfix
-
Hi, v1.0.5 , spam :
Oxide b16 for v313 -
Taffy updated Welcome Message and Notifications with a new update entry:
Bugfix