Jump to content

Message every 5 mins


S3Nn4oXx

Recommended Posts

Posted

Hello guys how to do that script shows every 5 mins ?

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

Thanks

Posted (edited)
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
Posted
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 ) 

Posted
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

Posted

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) 

Posted
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) 

Posted

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 
) 
  

Posted
setTimer(outputChatBox, 300000, 0, "Message 1", root, 255, 255, 255, true) 
setTimer(outputChatBox, 300000*2, 0, "Message 2", root, 255, 255, 255, true) 

Posted

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  
) 
  

?

Posted
--[[ 
    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 

Posted
--[[ 
    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

Posted
{ "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

Posted
{ "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 ?

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