Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getItemSlots(uid, findslot) -- return all slots in table, even if its empty, findslot is option and return only slot by number.
- local mytable = {}
- for i = 1, 5 do
- local slot = getItemAttribute(uid, "slot" .. i)
- local empty = "[] - Empty"
- if not slot or slot == empty then
- slot = empty
- else
- slot = "[slot #" .. i .. "] - " .. slot
- end
- if findslot and findslot == i then
- return slot
- end
- table.insert(mytable, slot)
- end
- return mytable
- end
- function findSlotWith(uid, value) -- return the number of a free slot
- local slots = getItemSlots(uid)
- local slotNumber = 0
- for i = 1, #slots do
- if string.find(slots[i], value) then
- print("found" .. value)
- slotNumber = i
- break
- end
- end
- return slotNumber
- end
- function onLogin(cid)
- local rate = 1.20 -- 30%
- local config = {
- vip = "Você tem "..((rate - 1)*100).."% de exp a mais agora!",
- notvip = "Tornesse vip e ganhe "..((rate - 1)*100).."% a mais de experiencia!",
- }
- if vip.hasVip(cid) == FALSE then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.notvip)
- else
- doPlayerSetExperienceRate(cid, rate)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.vip)
- end
- local config = {
- {"bonusexp"},
- {"bonusaxe"},
- {"bonussword"},
- {"bonusclub"},
- {"bonusml"}
- }
- local newTable = {}
- for i = 1, 9 do
- addItem = getPlayerSlotItem(cid, i)
- if addItem then
- if not getItemWeaponType(addItem.uid) or getItemWeaponType(addItem.uid) > 5
- or getItemWeaponType(addItem.uid) == 0 and not isArmor(addItem)
- or addItem.itemid == 0 or addItem.type > 1 or isItemStackable(addItem.uid) then
- return true
- end
- table.insert(newTable, addItem)
- end
- end
- for i = 1, #newTable do
- local itemUid = newTable[i].uid
- local findBonus = getItemSlots(itemUid)
- if string.find(findBonus, "bonusexp") then
- doPlayerSetExperienceRate(cid, 2.0)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "more exp.")
- return true
- elseif string.find(findBonus, "bonusaxe") then
- doItemSetAttribute(itemUid, "skillAxe", 20)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "more axe.")
- return true
- elseif string.find(findBonus, "bonussword") then
- doItemSetAttribute(itemUid, "skillSword", 20)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "more sword.")
- return true
- elseif string.find(findBonus, "bonusclub") then
- doItemSetAttribute(itemUid, "skillClub", 20)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "more club.")
- return true
- elseif string.find(findBonus, "bonusml") then
- doItemSetAttribute(itemUid, "magicPoints", 20)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "more ml.")
- return true
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement