Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cl_hint
#1
Code:
CreateClientConVar( "cl_showhints", "1", true, false )

-- A list of hints we've already done so we don't repeat ourselves`
local ProcessedHints = {}

--
-- Throw's a Hint to the screen
--
local function ThrowHint( name )

    local show = GetConVarNumber( "cl_showhints" )
    if ( show == 0 ) then return end

    if ( engine.IsPlayingDemo() ) then return end

    local text = language.GetPhrase( "Hint_" .. name )

    local s, e, group = string.find( text, "%%([^%%]+)%%" )
    while ( s ) do
        local key = input.LookupBinding( group )
        if ( !key ) then key = "<NOT BOUND>" end

        text = string.gsub( text, "%%([^%%]+)%%", "'" .. key:upper() .. "'" )
        s, e, group = string.find( text, "%%([^%%]+)%%" )
    end

    GAMEMODE:AddNotify( text, NOTIFY_HINT, 20 )

    surface.PlaySound( "ambient/water/drip" .. math.random( 1, 4 ) .. ".wav" )

end


--
-- Adds a hint to the queue
--
function GM:AddHint( name, delay )

    if ( ProcessedHints[ name ] ) then return end

    timer.Create( "HintSystem_" .. name, delay, 1, function() ThrowHint( name ) end )
    ProcessedHints[ name ] = true

end

--
-- Removes a hint from the queue
--
function GM:SuppressHint( name )

    timer.Remove( "HintSystem_" .. name )

end

-- Show opening menu hint if they haven't opened the menu within 30 seconds
GM:AddHint( "OpeningMenu", 30 )

-- Tell them how to turn the hints off after 1 minute
GM:AddHint( "Annoy1", 5 )
GM:AddHint( "Annoy2", 7 )
[Image: ezgif.com-effects.gif?ex=66308f7a&is=661...height=424]
find more through my linktree | Never Forget | Green Bean


Forum Jump:


Users browsing this thread: 1 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.