kamilcioo
Veteran OT User
- Joined
- Jul 25, 2008
- Messages
- 979
- Solutions
- 1
- Reaction score
- 291
Hey, im using this script
The problem is that I don't have druid voc on my server and when I log as knight(voc3) I get paladin(voc2) items. I tried to delete druid code from script but it stops working when I do this.
Anyone could rewrite this to make it work for mage(voc1), paladin(voc2), knight(voc3)?
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="2.0" author="J.Dre" contact="[email protected]" enabled="yes">
<config name="firstitems_config"><![CDATA[
commonItems = {
{itemid=6103, 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}, -- protection amulet
{itemid=7620, count=10, inContainer=true}, -- mana potion
{itemid=7618, count=10, inContainer=true}, -- hp potion
{itemid=2649},
{itemid=2461},
{itemid=2467},
{itemid=2643}
}
firstItems = {
{ -- Mage
{itemid=1988}, -- backpack
{itemid=2175}, -- spellbook
{itemid=2152, inContainer=true} -- wand
},
{ -- Druid
{itemid=1988}, -- backpack
{itemid=2175}, -- spellbook
{itemid=2152, inContainer=true} -- wand
},
{ -- 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=2509} -- steel shield
},
{ -- Knight
{itemid=1988}, -- backpack
{itemid=2509}, -- steel shield
{itemid=2395},
{itemid=2398, inContainer=true},
{itemid=2388, inContainer=true}
}
}
]]></config>
<event type="login" name="FirstItems" event="script"><![CDATA[
domodlib('firstitems_config')
for _, items in ipairs(firstItems) do
for _, item in ipairs(commonItems) do
table.insert(items, item)
end
end
local backpack
local storage = 30001
function onLogin(cid)
if((getPlayerAccess(cid) < 3 and getCreatureStorage(cid, storage) < 0) and firstItems[getPlayerVocation(cid)]) then
for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
if isItemContainer(v.itemid) then
backpack = doPlayerAddItem(cid, v.itemid, 1)
elseif v.inContainer then
doAddContainerItem(backpack, v.itemid, v.count or 1)
elseif v.useSlot then
doPlayerAddItem(cid, v.itemid, v.count, false, v.slotType)
elseif v.useMessage then
local t, k = {
writer = "Server Staff", date = os.time(),
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!"
}, doPlayerAddItem(cid, v.itemid, v.count or 1, false)
doSetItemText(k, t.text, t.writer, t.date)
else
doPlayerAddItem(cid, v.itemid, v.count or 1)
end
doCreatureSetStorage(cid, storage, 1)
end
end
return true
end
]]></event>
</mod>
The problem is that I don't have druid voc on my server and when I log as knight(voc3) I get paladin(voc2) items. I tried to delete druid code from script but it stops working when I do this.
Anyone could rewrite this to make it work for mage(voc1), paladin(voc2), knight(voc3)?