local config = {
[1] = {
--equipment
{{2175, 1}, {2190, 1}, {8819, 1}, {8820, 1}},
--container
{{2120, 1}, {2554, 1}, {7620, 1}}
},
[2] = {
--equipment
{{2175, 1}, {2182, 1}, {8819, 1}, {8820, 1}},
--container
{{2120, 1}, {2554, 1}, {7620, 1}}
},
[3] = {
--equipment
{{2389, 5}, {2660, 1}, {8923, 1}, {2456, 1}, {2544, 50}},
--container
{{2120, 1}, {2554, 1}, {7618, 1}}
},
[4] = {
--equipment
{{2509, 1}, {2465, 1}, {2481, 1}, {2478, 1}},
--container
{{8601, 1}, {8602, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 1}}
}
}
function onLogin(cid)
local player = Player(cid)
local targetVocation = config[player:getVocation():getId()]
if not targetVocation then
return true
end
if player:getLastLoginSaved() == 0 then
for i = 1, #targetVocation[1] do
player:addItem(targetVocation[1][i][1], targetVocation[1][i][2])
end
local backpack = player:addItem(1988)
for i = 1, #targetVocation[2] do
backpack:addItem(targetVocation[2][i][1], targetVocation[2][i][2])
end
end
return true
end
Where am I supposed to add it?Code:local config = { [1] = { --equipment {{2175, 1}, {2190, 1}, {8819, 1}, {8820, 1}}, --container {{2120, 1}, {2554, 1}, {7620, 1}} }, [2] = { --equipment {{2175, 1}, {2182, 1}, {8819, 1}, {8820, 1}}, --container {{2120, 1}, {2554, 1}, {7620, 1}} }, [3] = { --equipment {{2389, 5}, {2660, 1}, {8923, 1}, {2456, 1}, {2544, 50}}, --container {{2120, 1}, {2554, 1}, {7618, 1}} }, [4] = { --equipment {{2509, 1}, {2465, 1}, {2481, 1}, {2478, 1}}, --container {{8601, 1}, {8602, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 1}} } } function onLogin(cid) local player = Player(cid) local targetVocation = config[player:getVocation():getId()] if not targetVocation then return true end if player:getLastLoginSaved() == 0 then for i = 1, #targetVocation[1] do player:addItem(targetVocation[1][i][1], targetVocation[1][i][2]) end local backpack = player:addItem(1988) for i = 1, #targetVocation[2] do backpack:addItem(targetVocation[2][i][1], targetVocation[2][i][2]) end end return true end
firstitems.lua in the creaturescripts directory.Where am I supposed to add it?![]()
What line should I write in the creaturescripts.xml file?firstitems.lua in the creaturescripts directory.
Thanx!Code:<event type="login" name="FirstItems" script="firstitems.lua"/>