Jump to content

Announcments Bar ?


X-SHADOW

Recommended Posts

Hello

iam want ask about

i have Made an Announcments Bar but it's for 1 Msg

how to Make table with messegs and timer to show all messegs

for example

#1 -- 'Welcome'

-- after 20 sec .. change to

#2 'Enjoy our server'

etc ...

Can someone Show Me an example ?

Link to post
  
local messages = { 
    "Welcome", 
    "Enjoy our server", 
} 
  
  
addEventHandler("onClientResourceStart", resourceRoot,  
    function() 
        outputChatBox(messages[1], 255, 255, 255) 
        setTimer( function() 
            outputChatBox(messages[2], 255, 255, 255) 
        end, 20000, 1 ) 
    end 
) 

You can do something more advanced, if you want more messages.

Link to post
addEventHandler("onClientResourceStart", resourceRoot, 
    function()  
        addEventHandler("onClientRender",root,welcomeMessages) 
    end 
) 
  
local messages = { 
    "Welcome", 
    "Enjoy our server" 
} 
  
local screenWidth, screenHeight = guiGetScreenSize ( ) 
local frame = 0 
local msgCount = 1 
local msgLimit = #messages 
function  welcomeMessages() 
    if  msgCount > msgLimit then 
        msgCount=1 
        -- if you want to stop the messages when they reached the last one. 
        --removeEventHandler("onClientRender",root,welcomeMessages) 
        --frame, screenWidth, screenHeight, messages, msgCount, msgLimit = nil,nil,nil,nil,nil,nil -- unload information. 
    end 
    frame = frame+1 
    dxDrawText (messages[msgCount],screenWidth/2, screenHeight/2) 
    if frame > 1000 then 
        frame = 0 
        msgCount = msgCount+1 
    end 
end 

no laggy timers needed and not tested..

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...