• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Levels chest.

Wazzap

Killing Elite
Joined
Jun 15, 2010
Messages
124
Reaction score
4
Location
London / Poland
Data/Actions/Scripts/levelchest.lua

local config = {
rewards = { -- rewards (nagrody)
[1] = {level = 15,[1] = {itemid = 2460, count = 1},[2] = {itemid = 2160, count = 2}},
},
storageid = 4679 -- using storage (uzywany storage)
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local str = ""
closestid = getPlayerStorageValue(cid,config.storageid) + 1
if closestid == 0 then closestid = 1 end
if closestid <= #config.rewards then
if getPlayerLevel(cid) >= config.rewards[closestid].level then
str = str .. "You opened the level chest for level " .. config.rewards[closestid].level .. " and you have gained "
for i = 1, #config.rewards[closestid] do
doPlayerAddItem(cid,config.rewards[closestid].itemid,config.rewards[closestid].count)
if config.rewards[closestid].count > 1 then before = "" .. config.rewards[closestid].count .. "" name = "" .. getItemPluralNameById(config.rewards[closestid].itemid) .. ""
else before = "" .. getItemArticleById(config.rewards[closestid].itemid) .. "" name = "" .. getItemNameById(config.rewards[closestid].itemid) .. "" end
str = str .. "" .. before .. " " .. name .. ""
if i < #config.rewards[closestid] then str = str .. ", " end
end
str = str .. "."
effect = math.random(28,30)
doSendMagicEffect(getPlayerPosition(cid),effect)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT,str)
setPlayerStorageValue(cid,config.storageid,closestid)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have to be at least level " .. config.rewards[closestid].level .. " to get your rewards now.")
return true
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT,"You have already get all your rewards.")
return true
end
return true
end


Data/Actions/actions.xml

<action uniqueid="8733" event="script" value="levelchest.lua"/>


8733 - change this to UniqueID yours

Thx
 
I made a short version instead of all that piece of code, haven't tested it and keep in mind I was very tired while doing it.

Lua:
local config = {
storageid = 4679,
level = 100,
reward = Demon Armor 
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) >= config.level and getPlayerStorageValue(cid,config.storageid) + 0 then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have found a ..config.reward..") and
	doPlayerSetStorageValue(uid, config.storageid, newValue) + 1
end

if getPlayerStorageValue(uid, config.storageid) + 1 then
	doPlayerSendCancel(cid, "You have already done this quest")
	elseif getPlayerLevel(cid) = { < = 100, <= = 100, ~= =100 and == = 100 } then
	doPlayerSendCancel(cid, "You don't have enough level do this quest.")
end
return true
end
end
 
Last edited:
this is useless
who makes a level chest in a quest when the player has to get there hardly?
we use level doors instead for quests ;|
 
I made a short version instead of all that piece of code, haven't tested it and keep in mind I was very tired while doing it.

Lua:
local config = {
storageid = 4679,
level = 100,
reward = Demon Armor 
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) >= config.level and getPlayerStorageValue(cid,config.storageid) + 0 then
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have found a ..config.reward..") and
	doPlayerSetStorageValue(uid, config.storageid, newValue) + 1
end

if getPlayerStorageValue(uid, config.storageid) + 1 then
	doPlayerSendCancel(cid, "You have already done this quest")
	elseif getPlayerLevel(cid) = { < = 100, <= = 100, ~= =100 and == = 100 } then
	doPlayerSendCancel(cid, "You don't have enough level do this quest.")
end
return true
end
end

wont work,
Code:
	elseif getPlayerLevel(cid) = { < = 100, <= = 100, ~= =100 and == = 100 } then
wtf is this
 
wont work,
Code:
	elseif getPlayerLevel(cid) = { < = 100, <= = 100, ~= =100 and == = 100 } then
wtf is this

I was just testing something new! I already knew from the beginning that it wouldn't work in a way xD..
 
Back
Top