kimokimo
Kimo
can anyone creat quest chest that give reward each 100 lvls +REP
{ --[[
Made by Shawak Edited by Maladiec
]] --
config =
items = { -- id,count
item_1 = {2494,1}, -- Demon Armor
item_2 = {2400,1}, -- Magic Sword
item_3 = {2431,1}, -- Stonecutter Axe
item_4 = {2494,1}, -- Demon Armor
item_5 = {2400,1}, -- Magic Sword
item_6 = {2431,1}, -- Stonecutter Axe
item_7 = {2494,1}, -- Demon Armor
item_8 = {2400,1}, -- Magic Sword
item_9 = {2431,1}, -- Stonecutter Axe
item_10 = {2421,1} -- Thunder Hammer
},
level = {
min=100, -- minimum level which can take reward
change=100, -- change between levels atm 100 it means (0,100,200,300..)
max=1000 -- Max level to reach (100,200,300..600,700,800,900,1000 will get rewards)
}
}
function onUse(cid, item, frompos, item2, topos)
local nowstorage = getPlayerStorageValue(cid, 17523)
needlevel = nowstorage * config.level.change + config.level.min -- DONT CHANGE
-- MSG CONFIG
msgempty="The chest is empty." -- Chest is empty.
msgnocap="Low cap." -- You have too low cap.
msgnoneededlevel = "Your level is too low to take the reward. Level "..needlevel.." is needed to get a reward." -- You have too low level to get reward.
-- MSG CONFIGS END
if getPlayerLevel(cid) >= needlevel and getPlayerStorageValue(cid, 17523) < 10 then
pass=1
else
pass=0
end
if getPlayerStorageValue(cid, 17522) == 0 then
if item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 0 then
newItem = config.items.item_1[1]
count = config.items.item_1[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 1 then
newItem = config.items.item_2[1]
count = config.items.item_2[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 2 then
newItem = config.items.item_3[1]
count = config.items.item_3[2]
count = config.items.item_2[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 3 then
newItem = config.items.item_4[1]
count = config.items.item_4[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 4 then
newItem = config.items.item_5[1]
count = config.items.item_5[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 5 then
newItem = config.items.item_6[1]
count = config.items.item_6[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 6 then
newItem = config.items.item_7[1]
count = config.items.item_7[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 7 then
newItem = config.items.item_8[1]
count = config.items.item_8[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 8 then
newItem = config.items.item_9[1]
count = config.items.item_9[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) == 9 then
newItem = config.items.item_10[1]
count = config.items.item_10[2]
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) > 9 then
doPlayerSendTextMessage(cid,21,msgempty)
end
-- MSG CONFIGS
msgitem = "You have found "..getItemArticleById(newItem).." "..getItemNameById(newItem).." level needed to take this reward is " ..needlevel.."." -- Change this if you know what are you doing.
-- msg config end
if getPlayerFreeCap(cid) >= getItemWeightById(newItem,count) and pass == 1 then
setPlayerStorageValue(cid, 17523,nowstorage+1)
doPlayerAddItem(cid,newItem,count)
doPlayerSendTextMessage(cid,21,msgitem)
elseif item.uid == 17522 and getPlayerStorageValue(cid, 17523) <= 9 then
doPlayerSendTextMessage(cid,21,msgnoneededlevel)
elseif getPlayerFreeCap(cid) <= getItemWeightById(newItem,count) then
doPlayerSendTextMessage(cid,21,msgnocap)
end
end
return true
end
<action uniqueid="17522" script="ChestQuest.lua" />
items =
{
[1] = {itemid, count},
[2] = {itemid, count},
[3] = {itemid, count},
[4] = {itemid, count},
[5] = {itemid, count},
[6] = {itemid, count},
[7] = {itemid, count},
[8] = {itemid, count},
[9] = {itemid, count},
[10] = {itemid, count}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storageValue = 20000 -- only change this
local storage = 1 -- do not edit this one!
if getPlayerStorageValue(cid, storageValue) == #items then
doPlayerSendCancel(cid, "You already took the last reward of the chest.")
return false
end
if getPlayerStorageValue(cid, storageValue) ~= -1 then
storage = getPlayerStorageValue(cid, storageValue) + 1
end
if getPlayerLevel(cid) >= storage*100 then
if doPlayerAddItem(cid, items[storage][1], items[storage][2]) then
setPlayerStorageValue(cid, storageValue, storage)
doPlayerSendTextMessage(cid, 21, "You have found ".. getItemInfo(items[storage][1]).article .." ".. getItemInfo(items[storage][1]).name ..".")
else
doPlayerSendCancel(cid, "You do not have enough space or cap to receive your reward.")
end
else
doPlayerSendCancel(cid, "You do not have the required level to take the reward.")
end
return true
end
Nice one, thanks for this, Goin to study all code ;Puse this, just edit the items table and the storageValue nothing more.
LUA:items = { [1] = {itemid, count}, [2] = {itemid, count}, [3] = {itemid, count}, [4] = {itemid, count}, [5] = {itemid, count}, [6] = {itemid, count}, [7] = {itemid, count}, [8] = {itemid, count}, [9] = {itemid, count}, [10] = {itemid, count} } function onUse(cid, item, fromPosition, itemEx, toPosition) local storageValue = 20000 -- only change this local storage = 1 -- do not edit this one! if getPlayerStorageValue(cid, storageValue) == #items then doPlayerSendCancel(cid, "You already took the last reward of the chest.") return false end if getPlayerStorageValue(cid, storageValue) ~= -1 then storage = getPlayerStorageValue(cid, storageValue) + 1 end if getPlayerLevel(cid) >= storage*100 then if doPlayerAddItem(cid, items[storage].itemid, items[storage].count) then setPlayerStorageValue(cid, storageValue, storage) doPlayerSendTextMessage(cid, 21, "You have found ".. getItemInfo(items[storage].itemid).article .." ".. getItemInfo(items[storage].itemid).name ..".") else doPlayerSendCancel(cid, "You do not have enough space or cap to receive your reward.") end else doPlayerSendCancel(cid, "You do not have the required level to take the reward.") end return true end
kind regards, Evil Hero.