Bom dia a todos;
seguinte,
meu otserv sempre dá ao player 1 item quando ele inicia no jogo:
para quem quiser, aí está o meu firstitems.xml (Note que os players recebem os mesmos itens neste):
<?xml version="1.0" encoding="UTF-8"?><mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
<config name="firstitems_config">
<![CDATA[ config = {
storage = 30001,
items = {2120, 1987, 1988, 2376, 2580, 2564, 2529}
}
]]>
</config>
<event type="login" name="FirstItems" event="script">
<![CDATA[
domodlib('firstitems_config')
function onLogin(cid)
if(getPlayerStorageValue(cid, config.storage) > 0) then
return true
end
for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end
if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
doPlayerAddItem(cid, 2550, 1)
doPlayerAddItem(cid, 2147, 6)
doPlayerAddItem(cid, 2152, 100)
doPlayerAddItem(cid, 7886, 1)
else
doPlayerAddItem(cid, 2550, 1)
doPlayerAddItem(cid, 2147, 6)
doPlayerAddItem(cid, 2152, 100)
doPlayerAddItem(cid, 7886, 1)
end
setPlayerStorageValue(cid, config.storage, 1)
return true
end
]]></event>
</mod>
Mas eu queria que quando o playes escolhesse sua vocação (ele escolhe via site), o sistema desse algo específico de cada vocation, tipo: vocation 1 = item 2210, vocation 2 = item 2211, vocation 3 = item 2213.
arrumei esse código, alguém pode ajudar?
local firstItems = {}firstItems[0] =
{
2173,
2525,
3965,
2124,
2457,
2647,
2643
}
firstItems[1] =
{
2173,
2525,
2190,
2124,
2457,
2647,
2643
}
firstItems[2] =
{
2173,
2525,
2182,
2124,
2457,
2647,
2643
}
firstItems[3] =
{
2173,
2525,
2389,
2124,
2457,
2647,
2643
}
firstItems[4] =
{
2173,
2525,
2428,
2124,
2457,
2647,
2643
}
function onLogin(cid)
if getPlayerStorageValue(cid, 30001) == -1 then
for i = 1, table.maxn(firstItems[getPlayerVocation(cid)]) do
doPlayerAddItem(cid, firstItems[getPlayerVocation(cid)], 1)
end
if getPlayerSex(cid) == 0 then
doPlayerAddItem(cid, 2463, 1)
else
doPlayerAddItem(cid, 2463, 1)
end
local bag = doPlayerAddItem(cid, 10521, 1)
doAddContainerItem(bag, 2160, 2)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 7618, 1)
setPlayerStorageValue(cid, 30001, 1)
end
return TRUE
end
Gostaria apenas de fazer com que cada vocation desse um item diferente ao player no inicio do game.
Aí manolos, resolvi meu problem.
Aí está o script para quem quiser...
<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="The Forgotten Server" contact="otland.net" enabled="yes">
<config name="firstitems_config"><![CDATA[
config = {
storage = 30001,
items = {2120, 1987, 1988, 2376, 2580, 2564, 2529}
}
]]></config>
<event type="login" name="FirstItems" event="script"><![CDATA[
domodlib('firstitems_config')
function onLogin(cid)
if(getPlayerStorageValue(cid, config.storage) > 0) then
return true
end
for _, id in ipairs(config.items) do
doPlayerAddItem(cid, id, 1)
end
if (getPlayerVocation(cid) == 1) then
doPlayerAddItem(cid, 2550, 1)
doPlayerAddItem(cid, 2147, 6)
doPlayerAddItem(cid, 2152, 100)
doPlayerAddItem(cid, 7886, 1)
elseif (getPlayerVocation(cid) == 2) then
doPlayerAddItem(cid, 2550, 1)
doPlayerAddItem(cid, 2147, 6)
doPlayerAddItem(cid, 2152, 100)
doPlayerAddItem(cid, 7887, 1)
elseif (getPlayerVocation(cid) == 3) then
doPlayerAddItem(cid, 2550, 1)
doPlayerAddItem(cid, 2147, 6)
doPlayerAddItem(cid, 2152, 100)
doPlayerAddItem(cid, 7888, 1)
end
setPlayerStorageValue(cid, config.storage, 1)
return true
end
]]></event>
</mod>