• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Its possible? Isnt request !

Vrotz

Member
Joined
Apr 7, 2011
Messages
1,071
Reaction score
7
Location
Brazil
Hello,

I've a doubt.

The player bought an item by the ShopSystem. Its possible configure the Shop system and/or Globalevents, for that the even withdraws the item after 30 days? If yes, as it does that?

They are able to teach me?
 
Last edited:
As it went a "VIP", the player buys our item by the site and after 30 days the item is deleted automatically ... and i dont use translator, lol
 
I thought of putting a duration in the items.Xml, however, they alone would go to run the time when the player was online. There is another one way?
 
I thought of putting a duration in the items.Xml, however, they alone would go to run the time when the player was online. There is another one way?

wut?

Please explain better, what you mean and want.
 
I want that an item have duration. By example, the player buys an item in the Shop and this item has duration of 30 days. After these 30 days the item is deleted automatically. U understood now?

I want to know as is that does that.
 
I haven't found a way. Items.xml will only let you set a duration to 22~ days or so iirc.
Also if players place the item in their depot the duration stops again.

Red
 
You want the duration not stop, or you want it stop?
Ex. if he dont wear it, should it stop?
Or if he wear it once, it should continue
 
As this isn't request I can tell you how to do but won't make it.
Add attribute "expires" to the item and when loading the item check if the item is expired, if so don't load the item or destroy it. (Source edit)
 
Using or not the time of the item should finish.

...I added to "duration" in the item but there alone counted when was online.

I want that the time contains from the moment that the item this "in-gamel"
 
Yes, it's possible, just add an attribute to the item like

Lua:
local time = 30 * 24 * 60 * 60 --seconds in 30 days?
doItemSetAttribute(uid, "boughtdate", os.time() + time)

Later, add an script to the login.lua, with a function that scan all items in player (You can use function scanContainer by Jano, just need a 2-3 line edit) and then use something like
Lua:
if getItemAttribute(uid, "boughtdate") and os.time() >= getItemAttribute(uid, "boughtdate") then
	doRemoveItem(uid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The time for " .. getItemName(uid) .. " has ended.")
end
 
Back
Top Bottom