Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local commonItems = {
- {itemid=8707, count=1, useMessage=true}, -- a book (or whatever) with a message
- {itemid=2789, count=10, inContainer = true}, -- 10 brown mushrooms
- {itemid=2152, count=10, inContainer = true}, -- 10 platinum coins
- {itemid=2200, count=100, useSlot=true, slotType=CONST_SLOT_NECKLACE}, -- protection amulet
- {itemid=2643} -- leather boots
- }
- local firstItems = {
- { -- Sorcerer
- {itemid=1988}, -- backpack
- {itemid=2175}, -- spellbook
- {itemid=2190}, -- wand of vortex
- {itemid=8819}, -- magician's robe
- {itemid=8820}, -- mage hat
- {itemid=2468}, -- studded legs
- {itemid=7620, count=3, inContainer=true}, -- mana potion
- {useRunes=true, container=1988, runeId=2268, charges=3}
- },
- { -- Druid
- {itemid=1988}, -- backpack
- {itemid=2175}, -- spellbook
- {itemid=2182}, -- snakebite rod
- {itemid=8819}, -- magician's robe
- {itemid=8820}, -- mage hat
- {itemid=2468}, -- studded legs
- {itemid=7620, count=3, inContainer=true}, -- mana potion
- {useRunes=true, container=1988, runeId=2268, charges=3}
- },
- { -- Paladin
- {itemid=1988}, -- backpack
- {itemid=2456, count=1, useSlot=true, slotType=CONST_SLOT_LEFT}, -- bow
- {itemid=2544, count=100, useSlot=true, slotType=CONST_SLOT_LAST}, -- 100 arrow's
- {itemid=2660}, -- ranger's cloak
- {itemid=2481}, -- soldier helmet
- {itemid=8923}, -- ranger legs
- {itemid=7618, count=1, inContainer=true}, -- health potion
- {itemid=7620, count=2, inContainer=true}, -- mana potion
- {useRunes=false, container=1988, runeId=2268, charges=3}
- },
- { -- Knight
- {itemid=1988}, -- backpack
- {itemid=2509}, -- steel shield
- {itemid=8602}, -- jagged sword
- {itemid=8601, inContainer=true}, -- steel axe
- {itemid=2439, inContainer=true}, -- daramanian mace
- {itemid=2465}, -- brass armor
- {itemid=2481}, -- soldier helmet
- {itemid=2478}, -- brass legs
- {itemid=7618, count=3, inContainer=true}, -- health potion
- {useRunes=false, container=1988, runeId=2268, charges=3}
- }
- }
- function onLogin(cid)
- for _, items in ipairs(firstItems) do
- for _, item in ipairs(commonItems) do
- table.insert(items, item)
- end
- end
- if(getPlayerAccess(cid) < 3 and (getPlayerLastLoginSaved(cid) < 1) and firstItems[getPlayerVocation(cid)]) then
- for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
- if isItemContainer(v.itemid) then
- backpack = doPlayerAddItem(cid, v.itemid, 1, false)
- elseif v.inContainer then
- doAddContainerItem(backpack, v.itemid, v.count or 1)
- elseif v.useSlot then
- local id = doCreateItemEx(v.itemid, v.count or 1)
- doPlayerAddItemEx(cid, id, false, v.slotType)
- elseif v.useMessage then
- local t, k = {
- writer = "Server Staff", date = os.time(),
- text = "Welcome to " .. getConfigValue('serverName') .. ", " .. getCreatureName(cid) .. ".\n\nIf you need help with anything, please refer to the help channel and our staff will gladly assist you. Please remember to report any errors, bugs, or abuse to the Gamemasters."
- }, doPlayerAddItem(cid, v.itemid, v.count or 1, false)
- doSetItemText(k, t.text, t.writer, t.date)
- elseif v.useRunes then
- local weight = getItemWeightById(v.runeId, tonumber(getItemInfo(v.container).maxItems)) + getItemWeightById(v.container, 1)
- if(getPlayerFreeCap(cid) >= weight) then
- local bp = doCreateItemEx(cid, v.container, 1)
- if(doPlayerAddItemEx(cid, bp) ~= RETURNVALUE_NOERROR) then
- return false
- else
- for i = 1, tonumber(getItemInfo(v.container).maxItems) do
- doAddContainerItem(bp, v.runeId, v.charges or 1)
- end
- end
- end
- else
- doPlayerAddItem(cid, v.itemid, v.count or 1)
- end
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement