Hello guys.
I have a problem with this xml. When the user creates a normal account and character the xml works well.
There's an option where the player can get all the players promoted as son as there are created. For example, instead of a normal "Sorcerer, Druid, Paladin, Knight" from the start the character is "Master sorcerer, Elder Druid, Royal Paladin, Knight..."
The problem is when they get the first items. Because the weapons (I think) are only given to first promotions and I want all the promotions to get them as soon as they login.
Here's the mod firstitems.xml
Thanks!
I have a problem with this xml. When the user creates a normal account and character the xml works well.
There's an option where the player can get all the players promoted as son as there are created. For example, instead of a normal "Sorcerer, Druid, Paladin, Knight" from the start the character is "Master sorcerer, Elder Druid, Royal Paladin, Knight..."
The problem is when they get the first items. Because the weapons (I think) are only given to first promotions and I want all the promotions to get them as soon as they login.
Here's the mod firstitems.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" enabled="yes">
<config name="firstitems_config"><![CDATA[
config = {
storage = 30001,
items = {2050, 2382}
}
]]></config>
<event type="login" name="FirstItems" event="script"> <![CDATA[
domodlib('firstitems_config')
function onLogin(cid)
local config = {
voc_items = {
{ --
{2190} -- Wand of vortex
},
{ --
{2182} -- Snakebit Rod
},
{ --
{2389, 5} -- Spears
},
{ --
{2383} -- Spike Sword
}
},
all_items = {
{2511}, --
{2460}, --
{2478}, --
{2465}, --
{2643} --
},
extra_items = {
{2152, 5}, --
{2789, 30}, --
{7620, 5}, --
{7618, 5}, --
{2120}, --
{2554} --
},
knight_weapons = {
{2428}, --
{2417} --
},
paladin_weapons = {
{2456}, --
{1294, 5} --
}
}
if getPlayerGroupId(cid) < 3 then
if getPlayerStorageValue(cid, storage) == -1 then
local common = config.voc_items[getPlayerVocation(cid)]
if common ~= nil then
for _, v in ipairs(common) do
doPlayerAddItem(cid, v[1], v[2] or 1)
end
end
local all = config.all_items
if all ~= nil then
for _, v in ipairs(all) do
doPlayerAddItem(cid, v[1], v[2] or 1)
end
end
local extra = config.extra_items
local bp = doPlayerAddItem(cid, 1988, 1)
if extra ~= nil then
for _, v in ipairs(extra) do
doAddContainerItem(bp, v[1], v[2] or 1)
end
end
local weapons = config.knight_weapons
if weapons ~= nil then
for _, w in ipairs(weapons) do
if isKnight(cid) then
doAddContainerItem(bp, w[1], w[2] or 1)
end
end
end
local weapons2 = config.paladin_weapons
if weapons2 ~= nil then
for _, w in ipairs(weapons2) do
if isPaladin(cid) then
doAddContainerItem(bp, w[1], w[2] or 1)
end
end
end
setPlayerStorageValue(cid, storage, 1)
end
end
return true
end
]]></event>
</mod>
Thanks!