S3Nn4oXx Posted August 8, 2015 Share 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 Link to comment
S3Nn4oXx Posted August 8, 2015 Author Share Posted August 8, 2015 setTimer How much is 5 Minutes? 50000? Link to comment
#Madara Posted August 8, 2015 Share 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 Link to comment
iMr.SFA7 Posted August 8, 2015 Share Posted August 8, 2015 How much is 5 Minutes? 50000? Yes ,50000 Link to comment
S3Nn4oXx Posted August 8, 2015 Author Share 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 Link to comment
S3Nn4oXx Posted August 8, 2015 Author Share Posted August 8, 2015 yes , try it how i'm doing this show alone without the command? Link to comment
#Madara Posted August 8, 2015 Share 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 ) Link to comment
S3Nn4oXx Posted August 8, 2015 Author Share 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 Link to comment
Mr_Moose Posted August 9, 2015 Share 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) Link to comment
S3Nn4oXx Posted August 9, 2015 Author Share Posted August 9, 2015 Guys if i want to make another one like this It shows in the same time, how to change it ? Link to comment
Malak Posted August 9, 2015 Share 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) Link to comment
S3Nn4oXx Posted August 9, 2015 Author Share 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 ) Link to comment
S3Nn4oXx Posted August 9, 2015 Author Share 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? Link to comment
GTX Posted August 9, 2015 Share 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) Link to comment
S3Nn4oXx Posted August 9, 2015 Author Share 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 ) ? Link to comment
t3wz Posted August 9, 2015 Share 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 Link to comment
S3Nn4oXx Posted August 9, 2015 Author Share 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 Link to comment
t3wz Posted August 9, 2015 Share 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 Link to comment
S3Nn4oXx Posted August 10, 2015 Author Share 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 ? Link to comment
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