• Notify Stop
    8 replies, posted
Currently i have this little piece of code for k, v in pairs( player.GetAll() ) do v:SendLua("GAMEMODE:AddNotify(\"[Universo] Server Restart Imminent!\", NOTIFY_ERROR, " .. tostring(seconds) .. ")") end But i want to remove this notify at any time using lets say a command, how would i do this is there a GAMEMODE:RemoveAllNotifications() or something?
I don't see anything about AddNotify anywhere? Probably better using this library
Ya addnotify is a sandbox only hook, im assuming it has something to do with that, you can find it here but that library doesn't seem to work, i tried notification.kill but i have no idea what the "id" is and even if i did i dont believe that's for this type of notify.
That's the old wiki you're looking at, a LOT has changed since that one's been up-to-date, so I don't know if your best bet is using those. id is the id of the notification you've created previously with notification.AddProgress, and based on that wiki page, notification.AddLegacy is what you're looking for anyway.
Ah, i see. Is there a way to use notification.AddLegacy() to make the notification but somehow kill it? because i am using two commands, !startRestart !stopRestart !startRestart, starts a server restart in a certain amount of time. I want a notification to pop up and fade away in that amount of time. BUT i also need the !stopRestart command to kill the notification if someone uses it AND stop the restart.
notification.AddLegacy notification.AddProgress notification.Kill <-------------
Okay, you all still dont understand what im getting at. Ill make it more simple to understand what im saying, how do i change the way the notification.AddProgress looks, so i can make it look better or just like my Hud. Because right now the hud im using is making it look like a white box that looks very, ugly.
You can overwrite the existing function which will make all hints use your code instead. See here https://github.com/Facepunch/garrysmod/blob/aafb77cbe8b2a13578dedb990c4f6fcb35d8eade/garrysmod/lua/includes/modules/notification.lua#L66 for the source. Just copypaste that and then edit to what you want. function notification.AddProgress(uid, text) -- your code end function notification.Kill(uid) -- your code end function notification.AddLegacy(text, type, length) -- your code end
function AddLegacyNew( text, type, length, uid ) if ( IsValid( Notices[ uid ] ) ) then Notices[ uid ].StartTime = SysTime() Notices[ uid ].Length = 1000000 Notices[ uid ]:SetText( text ) Notices[ uid ]:SetProgress() return end local parent = nil if ( GetOverlayPanel ) then parent = GetOverlayPanel() end local Panel = vgui.Create( "NoticePanel", parent ) Panel.StartTime = SysTime() Panel.Length = length Panel.VelX = -5 Panel.VelY = 0 Panel.fx = ScrW() + 200 Panel.fy = ScrH() Panel:SetAlpha( 255 ) Panel:SetText( text ) Panel:SetLegacyType( type ) Panel:SetPos( Panel.fx, Panel.fy ) table.insert( Notices, Panel ) end would this function work? Just literally taking uid and putting it in the legacy function so i may kill it at anytime. I want a notification to be slowly ticking down and if a command is called then i want it to halt and be removed. Ill be posting a video soon to demonstrate how i want this to work.
Sorry, you need to Log In to post a reply to this thread.