Jump to content

Message every 5 mins


S3Nn4oXx

Recommended Posts

function server (player) 
    setTimer ( function() 
outputChatBox ( "Message", getRootElement(), 255, 255, 255, true ) 
    end, 300000,0 ) 
end 
addCommandHandler ( "teamspeak", server ) 

This works?

how i'm doing this show alone without the command?

Edited by Guest
Link to comment
addEventHandler("onResourceStart",root, 
function() 
setTimer ( function() 
outputChatBox ( "Message", getRootElement(), 255, 255, 255, true ) 
    end, 300000,0 ) 
end 
) 

or

setTimer ( function() 
outputChatBox ( "Message", getRootElement(), 255, 255, 255, true ) 
    end, 300000,0 ) 

Link to comment
addEventHandler("onResourceStart",root, 
function() 
setTimer ( function() 
outputChatBox ( "Message", getRootElement(), 255, 255, 255, true ) 
    end, 300000,0 ) 
end 
) 

or

setTimer ( function() 
outputChatBox ( "Message", getRootElement(), 255, 255, 255, true ) 
    end, 300000,0 ) 

Now i know how to do it, Thanks a lot bro

Link to comment

Technically you're assigning a function to call a function there, the most elegant solutions (lowest amount of code) should be something like my example below.

setTimer(outputChatBox, 300000, 0, "Message", getRootElement(), 255, 255, 255, true) 

For the time argument you can use basic multiplication where 5 minutes is 5*60*1000 (minutes*seconds*milleseconds). Just a friendly advice, all the ways works and does what you want.

setTimer(outputChatBox, 5*60*1000, 0, "Message", getRootElement(), 255, 255, 255, true) 

Link to comment
Guys if i want to make another one like this It shows in the same time, how to change it ?

setTimer(function ()  
outputChatBox("Message 1", getRootElement(), 255, 255, 255, true)  
outputChatBox("Message 2", getRootElement(), 255, 255, 255, true) end, 300000, 0) 

Link to comment

setTimer(function ()  
outputChatBox("Message 1", getRootElement(), 255, 255, 255, true)  
outputChatBox("Message 2", getRootElement(), 255, 255, 255, true) end, 300000, 0) 

Like this ?

  
addEventHandler("onResourceStart",root, 
function() 
setTimer ( function() 
outputChatBox("Message 1", getRootElement(), 255, 255, 255, true) 
outputChatBox("Message 2", getRootElement(), 255, 255, 255, true) end, 300000, 0)  
end 
) 
  

Link to comment

this will work

  
 addEventHandler("onResourceStart",root, 
function() 
setTimer ( function() 
setTimer(outputChatBox, 30000, 0, "Message 1", root, 255, 255, 255, true) 
setTimer(outputChatBox, 30000*2, 0, "Message 2", root, 255, 255, 255, true) 
end  
) 
  

?

Link to comment
--[[ 
    format: 
     
    { "Message", time (in minutes) }, 
--]] 
  
Messages = { 
    { "Message 1", 2 }, 
    { "Message 2", 5 }, 
    { "another msg", 1 }, 
    { "blablablabla", 20 }, 
} 
  
for _, v in ipairs ( Messages ) do 
    setTimer ( 
        function ( ) 
            outputChatBox ( v[1], root, 255, 255, 255, true ) 
        end 
    , v[2] * 60000, 0 ) 
end 

Link to comment
--[[ 
    format: 
     
    { "Message", time (in minutes) }, 
--]] 
  
Messages = { 
    { "Message 1", 2 }, 
    { "Message 2", 5 }, 
    { "another msg", 1 }, 
    { "blablablabla", 20 }, 
} 
  
for _, v in ipairs ( Messages ) do 
    setTimer ( 
        function ( ) 
            outputChatBox ( v[1], root, 255, 255, 255, true ) 
        end 
    , v[2] * 60000, 0 ) 
end 

{ "Message 1", 2 },

    { "Message 2", 5 },

    { "another msg", 1 },

    { "blablablabla", 20 },

what is that numbers example in Message 1 there is number 2

Link to comment
{ "Message 1", 2 },

    { "Message 2", 5 },

    { "another msg", 1 },

    { "blablablabla", 20 },

what is that numbers example in Message 1 there is number 2

it's the time (in minutes) to function be called.

for example, "Message 1" will be called every 2 minutes, "another msg" every 1 etc

Link to comment
{ "Message 1", 2 },

    { "Message 2", 5 },

    { "another msg", 1 },

    { "blablablabla", 20 },

what is that numbers example in Message 1 there is number 2

it's the time (in minutes) to function be called.

for example, "Message 1" will be called every 2 minutes, "another msg" every 1 etc

what's the better minutes for [iNFO] Messages ?

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