Hello,
I 'am here again, today i have other script i have one doubt about the function os.time , can someone recommend for me a website to i study this functions?
I create this script thinking on world change like tibia.com..
If 30 mounts hunted in one day, anything can rented more on this day, and mount is removed on one day..You can use this mount on one day.
Follow my bad script rs..
NPC...
Now CreatureScript to check time and remove Mount..
I 'am here again, today i have other script i have one doubt about the function os.time , can someone recommend for me a website to i study this functions?
I create this script thinking on world change like tibia.com..
If 30 mounts hunted in one day, anything can rented more on this day, and mount is removed on one day..You can use this mount on one day.
Follow my bad script rs..
NPC...
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local days = 1 * 24 * 60 * 60
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function horse(cid, message, keywords,parameters,node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getGlobalStorageValue(15906) == 30 then
if getGlobalStorageValue(15906) > 30 then
doPlayerAddMount(cid, 10)
npcHandler:say('Now you have a rented horse for the next 24hours..', cid)
time = os.time() + days
setGlobalStorageValue(15905, time)
setGlobalStorageValue(15906, 1)
else
doPlayerSendCancel(cid, "All mounts is rented on this moment.Try Tomorrow.")
end
end
end
local node1 = keywordHandler:addKeyword({'mount'}, horse, {npcHandler = npcHandler, onlyFocus = true, reset = true})
Now CreatureScript to check time and remove Mount..
LUA:
function onLogin(cid)
if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
doPlayerRemoveMount(cid ,10)
doPlayerSendTextMessage(cid, 21, "You Rented Horse Mount finish.")
end
end