Tera 26 Report post Posted December 24, 2016 For those who seek a reward online and see the other complicated: D in fuction> cha_timer ----------------------Reward Online--------------------------------------------- function cha_timer(role, freq, time) if math.mod(now_tick, 86400) == 0 and now_tick > 0 then -- Means 24 hours , 1440 In mins! (!) local cha = TurnToCha ( role ) local rad = math.random ( 1, 4 ) if rad == 1 then BickerNotice ( cha , "You've been Online for 24 Hours. Redeemed OOOOOO") GiveItem ( cha , 0 , xxxx , yy , 0 ) elseif rad == 2 then BickerNotice ( cha , "You've been Online for 24 Hours. Redeem OOOOO!") GiveItem ( cha , 0 , xxxx , yy , 0 ) elseif rad == 3 then BickerNotice ( cha , "You've been Online for 24 Hours. Redeemed OOOOO") GiveItem ( cha , 0 , xxxx , yy , 0 ) elseif rad == 4 then BickerNotice ( cha , "You've been Online for 24 Hours. Redeemed OOOOO") GiveItem ( cha , 0 , xxxx , yy , 0 ) end end end ------------------------------------------------------------------------------------------------------------ xxxx: Id item yy:number of item OOOOOO: Name of item 86400: number in minutes = 24 Horas Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted December 24, 2016 OnlineItemEvent(role, now_tick) function OnlineItemEvent(Player, Tick) local Minutes = 0 local Hours = 1 local Time = (Minutes * 60) + (Hours * 60 * 60) local EventItems = {} EventItems[1] = {ID = 0, Quantity = 1} if math.mod(Tick, Time) == 0 and Tick > 0 then local Random = math.random(1, table.getn(EventItems)) GiveItem(Player, 0, EventItems[Random].ID, EventItems[Random].Quantity, 4) BickerNotice(Player, "Congratulations, for being online "..Hours.." hours and "..Minutes.." minutes, you've received "..EventItems[Random].Quantity.."x "..GetItemName(EventItems[Random].ID)..", enjoy!") end end By the way, I don't think this should go here, maybe in "Releases". 1 Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 24, 2016 13 minutes ago, Angelix said: OnlineItemEvent(role, now_tick) function OnlineItemEvent(Player, Tick) local Minutes = 0 local Hours = 1 local Time = (Minutes * 60) + (Hours * 60 * 60) local EventItems = {} EventItems[1] = {ID = 0, Quantity = 1} if math.mod(Tick, Time) == 0 and Tick > 0 then local Random = math.random(1, table.getn(EventItems)) GiveItem(Player, 0, EventItems[Random].ID, EventItems[Random].Quantity, 4) BickerNotice(Player, "Congratulations, for being online "..Hours.." hours and "..Minutes.." minutes, you've received "..EventItems[Random].Quantity.."x "..GetItemName(EventItems[Random].ID)..", enjoy!") end end By the way, I don't think this should go here, maybe in "Releases". Sorry, I do not know much English and I do not know where everything should go, besides that function that you put to me, I never know where to put the functions that I put, I feel that it's easier. Quote Share this post Link to post Share on other sites
Angelix 374 Report post Posted December 24, 2016 Just now, Tera said: Sorry, I do not know much English and I do not know where everything should go, besides that function that you put to me, I never know where to put the functions that I put, I feel that it's easier. That's why I placed two separate code tags, first goes within cha_timer and the other can go anywhere. The main function can be easily modified to adjust minutes/hours and the amount of items and their quantity without making a much more messy code like the one you posted. Quote Share this post Link to post Share on other sites
Tera 26 Report post Posted December 24, 2016 7 minutes ago, Angelix said: Es por eso coloqué dos etiquetas de código separados, primero va dentro cha_timer y el otro puede ir a ninguna parte. La función principal se puede modificar fácilmente para ajustar minutos / horas y la cantidad de artículos y su cantidad sin hacer un código mucho más desordenado como el que has publicado. 41 minutes ago, Angelix said: Es por eso coloqué dos etiquetas de código separados, primero va dentro cha_timer y el otro puede ir a ninguna parte. La función principal se puede modificar fácilmente para ajustar minutos / horas y la cantidad de artículos y su cantidad sin hacer un código mucho más desordenado como el que has publicado. @Angelix But the two codes go inside of function? Quote Share this post Link to post Share on other sites
Ximboliex 85 Report post Posted December 24, 2016 (edited) Put only this function into cha_timer: OnlineItemEvent(role, now_tick) And this function at end the function.lua: function OnlineItemEvent(Player, Tick) local Minutes = 0 local Hours = 1 local Time = (Minutes * 60) + (Hours * 60 * 60) local EventItems = {} EventItems[1] = {ID = 0, Quantity = 1} if math.mod(Tick, Time) == 0 and Tick > 0 then local Random = math.random(1, table.getn(EventItems)) GiveItem(Player, 0, EventItems[Random].ID, EventItems[Random].Quantity, 4) BickerNotice(Player, "Congratulations, for being online "..Hours.." hours and "..Minutes.." minutes, you've received "..EventItems[Random].Quantity.."x "..GetItemName(EventItems[Random].ID)..", enjoy!") end end Edited December 24, 2016 by Ximboliex Quote Share this post Link to post Share on other sites