Jump to content

Help with table and outputTopChat


Adde

Recommended Posts

Hello, I am trying to do a table with (messages, r, g, b) to use that for outputTopChat. I have successed, but now I only need to now how I randomize the rows to the function. I tried to use math.random but it said that it wasn´t numbers I used. Atm the it works but shows all messages at the same time every 40second. Can anyone help me? :>

local messages = { 
{ "*Info* Staff can be found with  infront of their name", 255, 255, 255 }, 
{ "*Rule* Speak english in main chat! Use local chat, team chat or group chat for other languages!", 255, 255, 255 }, 
{ "*Info* This server need YOU to donate! Read more about donation in F1 panel.", 255, 255, 255 }, 
{ "*Info* You can start music by type /soundon, then stop it by type /soundoff", 255, 255, 255 }, 
{ "*Info* If we can get 60 players online at the same time then everyone will be able to use vip for 6days!", 255, 255, 255 } 
} 
  
function sendMessages() 
for k, v in ipairs(messages) do 
outputTopChat(v[1], v[2], v[3], v[4]) 
end 
end 
setTimer(sendMessages, 1000*40, 0) 
  

Link to comment
local messages = 
    { 
        { "*Info* Staff can be found with  infront of their name", 255, 255, 255 }, 
        { "*Rule* Speak english in main chat! Use local chat, team chat or group chat for other languages!", 255, 255, 255 }, 
        { "*Info* This server need YOU to donate! Read more about donation in F1 panel.", 255, 255, 255 }, 
        { "*Info* You can start music by type /soundon, then stop it by type /soundoff", 255, 255, 255 }, 
        { "*Info* If we can get 40 players online at the same time then everyone will be able to use vip for 6days!", 255, 255, 255 } 
    } 
  
function sendMessages ( ) 
    outputTopChat ( unpack ( messages [ math.random ( #messages ) ] ) ) 
end 
setTimer ( sendMessages, ( 1000 * 40 ), 0 ) 

Link to comment

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...