CharlesHudson
Just alive, or just breathing...
- Joined
- Oct 25, 2011
- Messages
- 98
- Reaction score
- 14
HELLO everybody i come here becouse i need help with 2 script i'm testing, but nothing that i do works
The scripts is thinking for work as rewards
When is your first time completing the quest, u will receive the main reward (CUSTOM ITEM)
But you have to wait 24 hours to receive another reward
When you complete 24 hours you are able to get another reward but this time
is one with random chance to get
This are my 2 scripts im using TFS 1.0
Plx HELPPP
That is for a single chest
Multiple Chest
THANKS IN ADVANCE
I wait for you help plx
The scripts is thinking for work as rewards
When is your first time completing the quest, u will receive the main reward (CUSTOM ITEM)
But you have to wait 24 hours to receive another reward
When you complete 24 hours you are able to get another reward but this time
is one with random chance to get
This are my 2 scripts im using TFS 1.0
Plx HELPPP
Code:
local items = {{8882, 1}, {16015, 1}, {22398, 1}, {18511, 1}, {2160, 50}}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(21696) < 0 then
player:setStorageValue(21696, 1)
player:addItem(21696, 1)
player:setStorageValue(21696, os.time())
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found the Legendary Bow.")
elseif player:getStorageValue(21696 > os.time() + 24* 60 * 60 )
then
local index = math.random(#items)
player:addItem(items[index][1], math.random(items[index][2]), true)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get a .')
player:setStorageValue(21696, os.time())
else
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait a full 24 hours before another reward can be obtained.')
end
return true
end
Code:
local items = {{8881, 5}, {16007, 5}, {22422, 10}, {9933, 10}, {2160, 50}}
local chests = {
[25918] = {itemid = 25958, count = 1},
[25958] = {itemid = 25918, count = 1},
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if player:getStorageValue(25918) < 0 and player:getStorageValue(25958) < 0 then
local chest = chests[item.uid]
local itemType = ItemType(chest.itemid)
if itemType then
local article = itemType:getArticle()
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. (#article > 0 and article .. ' ' or '') .. itemType:getName() .. '.')
end
player:addItem(chest.itemid, chest.count)
player:setStorageValue(25918, 1)
player:setStorageValue(25958, 1)
player:setStorageValue(60501, os.time())
elseif player:getStorageValue(60501 > os.time() + 24 * 60 * 60)
then
local index = math.random(#items)
player:addItem(cid, items[index][1], math.random(items[index][2]), true)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You get a .')
player:setStorageValue(60501, os.time())
else
player:getPosition():sendMagicEffect(CONST_ME_POFF)
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You must wait a full 24 hours before another reward can be obtained.')
end
return true
end
THANKS IN ADVANCE
I wait for you help plx