Advertisement
Guest User

Firstitems.lua

a guest
Nov 30th, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.26 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.     <mod name="First Items" version="2.0" author="J.Dre" contact="" enabled="yes">
  3.     <config name="firstitems_config"><![CDATA[
  4.         commonItems = {
  5.             {itemid=6103, count=1, useMessage=true}, -- a book (or whatever) with a message
  6.             {itemid=2789, count=10, inContainer = true}, -- 10 brown mushrooms
  7.             {itemid=2152, count=10, inContainer = true}, -- 10 platinum coins
  8.             {itemid=2200, count=100}, -- protection amulet
  9.             {itemid=2643} -- leather boots
  10.         }
  11.         firstItems = {
  12.             { -- Sorcerer
  13.                 {itemid=1988}, -- backpack
  14.                 {itemid=2175}, -- spellbook
  15.                 {itemid=2190}, -- wand of vortex
  16.                 {itemid=8819}, -- magician's robe
  17.                 {itemid=8820}, -- mage hat
  18.                 {itemid=2468}, -- studded legs
  19.                 {itemid=7620, count=3, inContainer=true} -- mana potion
  20.             },
  21.             { -- Druid
  22.                 {itemid=1988}, -- backpack
  23.                 {itemid=2175}, -- spellbook
  24.                 {itemid=2182}, -- snakebite rod
  25.                 {itemid=8819}, -- magician's robe
  26.                 {itemid=8820}, -- mage hat
  27.                 {itemid=2468}, -- studded legs
  28.                 {itemid=7620, count=3, inContainer=true} -- mana potion
  29.             },
  30.             { -- Paladin
  31.                 {itemid=1988}, -- backpack
  32.                 {itemid=2456, count=1, useSlot=true, slotType=CONST_SLOT_LEFT}, -- bow
  33.                 {itemid=2544, count=100, useSlot=true, slotType=CONST_SLOT_LAST}, -- 100 arrow's
  34.                 {itemid=2660}, -- ranger's cloak
  35.                 {itemid=2481}, -- soldier helmet
  36.                 {itemid=8923}, -- ranger legs
  37.                 {itemid=7618, count=1, inContainer=true}, -- health potion
  38.                 {itemid=7620, count=2, inContainer=true} -- mana potion
  39.             },
  40.             { -- Knight
  41.                 {itemid=1988}, -- backpack
  42.                 {itemid=2509}, -- steel shield
  43.                 {itemid=8602}, -- jagged sword
  44.                 {itemid=8601, inContainer=true}, -- steel axe
  45.                 {itemid=2439, inContainer=true}, -- daramanian mace
  46.                 {itemid=2465}, -- brass armor
  47.                 {itemid=2481}, -- soldier helmet
  48.                 {itemid=2478}, -- brass legs
  49.                 {itemid=7618, count=3, inContainer=true} -- health potion
  50.             }
  51.         }
  52.     ]]></config>
  53.     <event type="login" name="FirstItems" event="script"><![CDATA[
  54.     domodlib('firstitems_config')
  55.  
  56.     for _, items in ipairs(firstItems) do
  57.         for _, item in ipairs(commonItems) do
  58.             table.insert(items, item)
  59.         end
  60.     end
  61.  
  62.     local backpack
  63.     local storage = 30001
  64.     function onLogin(cid)
  65.         if((getPlayerAccess(cid) < 3 and getCreatureStorage(cid, storage) < 0) and firstItems[getPlayerVocation(cid)]) then
  66.             for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
  67.                 if isItemContainer(v.itemid) then
  68.                     backpack = doPlayerAddItem(cid, v.itemid, 1)
  69.                 elseif v.inContainer then
  70.                     doAddContainerItem(backpack, v.itemid, v.count or 1)
  71.                 elseif v.useSlot then
  72.                     doPlayerAddItem(cid, v.itemid, v.count, false, v.slotType)
  73.                 elseif v.useMessage then
  74.                     local t, k = {
  75.                         writer = "Server Staff", date = os.time(),
  76.                         text = "Welcome " .. getCreatureName(cid) .. ".\n\nOur community would like to welcome you to " .. getConfigValue('serverName') .. ". If you need help with anything, please refer to the help channel.\n\nEnjoy your time!"
  77.                     }, doPlayerAddItem(cid, v.itemid, v.count or 1, false)
  78.                     doSetItemText(k, t.text, t.writer, t.date)
  79.                 else
  80.                     doPlayerAddItem(cid, v.itemid, v.count or 1)
  81.                 end
  82.                 doCreatureSetStorage(cid, storage, 1)
  83.             end
  84.         end
  85.         return true
  86.     end
  87.     ]]></event>
  88. </mod>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement