S3Nn4oXx Posted August 8, 2015 Posted August 8, 2015 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
#Madara Posted August 8, 2015 Posted August 8, 2015 setTimer How much is 5 Minutes? 50000? 30000 you can use this website to conversion minutes to milliseconds http://www.unitconversion.org/time/minu ... rsion.html
S3Nn4oXx Posted August 8, 2015 Author Posted August 8, 2015 (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 August 8, 2015 by Guest
S3Nn4oXx Posted August 8, 2015 Author Posted August 8, 2015 yes , try it how i'm doing this show alone without the command?
#Madara Posted August 8, 2015 Posted August 8, 2015 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 )
S3Nn4oXx Posted August 8, 2015 Author Posted August 8, 2015 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
Mr_Moose Posted August 9, 2015 Posted August 9, 2015 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)
S3Nn4oXx Posted August 9, 2015 Author Posted August 9, 2015 Guys if i want to make another one like this It shows in the same time, how to change it ?
Malak Posted August 9, 2015 Posted August 9, 2015 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)
S3Nn4oXx Posted August 9, 2015 Author Posted August 9, 2015 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 )
S3Nn4oXx Posted August 9, 2015 Author Posted August 9, 2015 no example The message 1 will be in 5 minutes The message 2 will be in 10 minutes but in the same script how to do it?
GTX Posted August 9, 2015 Posted August 9, 2015 setTimer(outputChatBox, 300000, 0, "Message 1", root, 255, 255, 255, true) setTimer(outputChatBox, 300000*2, 0, "Message 2", root, 255, 255, 255, true)
S3Nn4oXx Posted August 9, 2015 Author Posted August 9, 2015 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 ) ?
t3wz Posted August 9, 2015 Posted August 9, 2015 --[[ 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
S3Nn4oXx Posted August 9, 2015 Author Posted August 9, 2015 --[[ 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
t3wz Posted August 9, 2015 Posted August 9, 2015 { "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
S3Nn4oXx Posted August 10, 2015 Author Posted August 10, 2015 { "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 ?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now