Jump to content
Tera

Auto Random Online Item Scripts

Recommended Posts

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

 

 

 

Share this post


Link to post
Share on other sites
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".

  • Like 1

Share this post


Link to post
Share on other sites
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. :(

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

 

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 by Ximboliex

xbx3.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...