- Joined
- Dec 11, 2007
- Messages
- 3,666
- Solutions
- 1
- Reaction score
- 125
- Location
- Warsaw, Poland
- GitHub
- tayandenga
- Twitch
- tayandenga
Had it on store
Good for beginers ;p
Code:
local config = {
storage = 5019,
experience = 400,
axe = 2429,
club = 2394,
sword = 2409
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE) then
return TRUE
end
if(getPlayerStorageValue(cid, config.storage) ~= -1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
return TRUE
end
local club = getPlayerSkill(cid, 1)
local sword = getPlayerSkill(cid, 2)
local axe = getPlayerSkill(cid, 3)
local reward = 0
if(axe > sword and axe > club) then
reward = doCreateItemEx(config.axe, 1)
elseif(club > sword and club > axe) then
reward = doCreateItemEx(config.club, 1)
elseif(sword > club and sword > axe) then
reward = doCreateItemEx(config.sword, 1)
end
if(reward == 0) then
doPlayerSendCancel(cid, "Sorry, you have to choose a weapon type first.")
elseif(doPlayerAddItemEx(cid, reward, FALSE) ~= RETURNVALUE_NOERROR) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a reward weighing " .. getItemWeight(reward) .. " oz. It is too heavy or you have not enough space.")
else
local tmp = getItemDescriptions(reward)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. tmp.article .. " " .. tmp.name .. ".")
setPlayerStorageValue(cid, config.storage, 1)
doPlayerAddExp(cid, config.experience)
doSendAnimatedText(getCreaturePosition(cid), config.experience, TEXTCOLOR_WHITE_EXP)
end
return TRUE
end
Good for beginers ;p