O
Ozzwelito
Invitado
Hola buen dia, alguien tiene algun codigo para dar los primeros items del juego a los nuevos players? he intentado con algunos pero ninguno me funciona, los players puede elegir su vocacion en la pagina y la ciudad a donde quieren aparecer, este es el codigo que estaba usando pero no me funciona:
si me pudieran apoyar por favor
Código:
local config = {
[1] = { -- sorcerer
items = {
{2525}, -- dwarven shield
{2190}, -- wand of vortex
{8819}, -- magician's robe
{8820}, -- mage hat
{2478}, -- brass legs
{2643}, -- leather boots
},
backpack = {
{7620, 15}, -- mana potion
{2120}, -- rope
}
},
[2] = { -- druid
items = {
{2525}, -- dwarven shield
{2182}, -- snakebite rod
{8819}, -- magician's robe
{8820}, -- mage hat
{2478}, -- brass legs
{2643}, -- leather boots
},
backpack = {
{7620, 15}, -- mana potion
{2120}, -- rope
}
},
[3] = { -- paladin
items = {
{2525}, -- dwarven shield
{2389, 5}, -- spear
{2660}, -- ranger's cloak
{8923}, -- ranger legs
{2643}, -- leather boots
{2121}, -- wedding ring
{2460}, -- brass helmet
},
backpack = {
{7618, 10}, -- health potion
{7620, 10}, -- mana potion
{2120}, -- rope
}
},
[4] = { -- knight
items = {
{2525}, -- dwarven shield
{8602}, -- jagged sword
{2465}, -- brass armor
{2460}, -- brass helmet
{2478}, -- brass legs
{2643}, -- leather boots
},
backpack = {
{8601}, -- steel axe
{2439}, -- daramian mace
{7618, 5}, -- health potion
{7620, 5}, -- mana potion
{2120}, -- rope
}
}
}
function onLogin(player)
player:registerEvent("firstItems")
local targetVocation = config[player:getVocation():getId()]
if not targetVocation then
return true
end
if player:getLastLoginSaved() ~= 0 then
return true
end
if player:getSlotItem(CONST_SLOT_LEFT) then
return true
end
for i = 1, #targetVocation.items do
player:addItem(targetVocation.items[i][1], targetVocation.items[i][2] or 1)
end
local demonBackpack = player:addItem(10518) -- demon backpack
if not demonBackpack then
return true
end
for i = 1, #targetVocation.backpack do
demonBackpack:addItem(targetVocation.backpack[i][1], targetVocation.backpack[i][2] or 1, false)
end
return true
end
si me pudieran apoyar por favor