Ir para conteúdo

Featured Replies

Postado

Galera, depois de ter executado algumas funções na database alguns player bugaram e começou a dar o seguinte erro:

Spoiler

[Error - CreatureScript Interface] 
data/creaturescripts/scripts/firstitems.lua:onLogin
Description: 
data/creaturescripts/scripts/firstitems.lua:56: bad argument #1 to 'maxn' (table expected, got nil)
stack traceback:
[C]: in function 'maxn'
 data/creaturescripts/scripts/firstitems.lua:56: in function <data/creaturescripts/scripts/firstitems.lua:54>

O player tenta logar e em seguida é deslogado. E também o health parou de funcionar, a magia é executada mas a mana/vida não heala. ALguem sabe o que pode ter acontecido e o que fazer para resolver?

  • Respostas 9
  • Visualizações 721
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Bom, me parece tudo ok, mas provavelmente isso solucione o erro:    local firstItems = {} firstItems[0] = { 2173, 12605, 7424, 2124, 12606, 12604, 12607 } firstItems[1] = { 2173, 126

Posted Images

Postado
  • Autor

firstitems.lua:

Spoiler

local firstItems = {}
firstItems[0] =
{
2173,
12605,
7424,
2124,
12606,
12604,
12607
}
firstItems[1] =
{
2173,
12605,
7424,
2124,
12606,
12604,
12607
}
firstItems[2] =
{
2173,
12605,
7424,
2124,
12606,
12604,
12607
}
firstItems[3] =
{
2173,
12605,
7367,
2124,
12606,
12604,
12607
}
firstItems[4] =
{
2173,
12605,
7417,
2124,
12606,
12604,
12607
}

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, 12603, 1)
else
doPlayerAddItem(cid, 12603, 1)
end
local bag = doPlayerAddItem(cid, 10518, 1)
doAddContainerItem(bag, 2160, 100)
doAddContainerItem(bag, 2554, 1)
doAddContainerItem(bag, 2120, 1)
doAddContainerItem(bag, 9693, 2)
doAddContainerItem(bag, 8926, 1)
setPlayerStorageValue(cid, 30001, 1)
end
return TRUE
end

Versão: TFS 0.4

Porém eu acredito que o problema não esta no script e sim na database depois que eu executei alguns comandos nela. Mas o script esta ai!

Postado

@The Ripper 

usa esse mods.

 

 

firstitems_voc.xml

<?xml version="1.0" encoding="UTF-8"?>
<mod name="First Items" version="1.0" author="slawkens - edited by: mattyx14" contact="[email protected]" enabled="yes">
	<description><![CDATA[
		Custom First Items
	]]></description>
	<config name="firstitems_config"><![CDATA[
		config = {
			storage = 40046,
			items = {}
		}
	]]></config>
	<event type="login" name="FirstItems" event="buffer"><![CDATA[
		domodlib('firstitems_config')
		if(getPlayerStorageValue(cid, config.storage) > 0) then
			return
		end
		for _, id in ipairs(config.items) do
			doPlayerAddItem(cid, id, 1)
		end
		-- All Vocation
			-- BackPack -- Rope -- in Backpack
			doAddContainerItem(doPlayerAddItem(cid, 1988, 1), 2120, 1)
			-- Brass Armor -- Body
			doPlayerAddItem(cid, 2465, 1)
			-- Steel Helmet -- Head
			doPlayerAddItem(cid, 2457, 1)
			-- Bonelord Shield -- Right Hand
			doPlayerAddItem(cid, 2518, 1)
		-- Sorcerer (Weapon) -- Hand
		if isSorcerer(cid) then
			doPlayerAddItem(cid, 2190, 1) -- Wand of Vortex -- Left Hand
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT," "..getPlayerName(cid).." now have the first items of "..getPlayerVocationName(cid)..".")
		-- Druid (Weapon) -- Hand
		elseif isDruid(cid) then
			doPlayerAddItem(cid, 2182, 1) -- Snake Bite Rod -- Left Hand
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT," "..getPlayerName(cid).." now have the first items of "..getPlayerVocationName(cid)..".")
		-- Paladin - Warrior (Weapon) -- Hand
		elseif isPaladin(cid) then
			doPlayerAddItem(cid, 2389, 20) -- Spear -- Left Hand
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT," "..getPlayerName(cid).." now have the first items of "..getPlayerVocationName(cid)..".")
		-- Knight (Weapon) -- Hand
		elseif isKnight(cid) then
			doPlayerAddItem(cid, 8602, 1) -- Jagged Sword -- Left Hand
			doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT," "..getPlayerName(cid).." now have the first items of "..getPlayerVocationName(cid)..".")
		end
		-- All Vocation
			-- Brass Legs -- in Feet
			doPlayerAddItem(cid, 2478, 1)
			-- Leather Boots -- in Boots
			doPlayerAddItem(cid, 2643, 1)
			-- Scarf -- in Necklacke
			doPlayerAddItem(cid, 2661, 1)
			-- Platinum Coin -- in Arrows
			doPlayerAddItem(cid, 2152, 1)
			-- Health Potion -- in Backpack
			doPlayerAddItem(cid, 7618, 10)
			-- Shovel -- in Backpack
			doPlayerAddItem(cid, 2554, 1)
			-- Crystal Ring -- in Ring
			doPlayerAddItem(cid, 2124, 1)
			-- Mana Potion -- in Backpack
			doPlayerAddItem(cid, 7620, 15)
		-- Knight (Weapon) -- in Backpack
		if isKnight(cid) then
			doPlayerAddItem(cid, 8601, 1) -- Steel Axe
			doPlayerAddItem(cid, 2439, 1) -- Daramanian mace
		end
	setPlayerStorageValue(cid, config.storage, 1)
	]]></event>
</mod>

 

Editado por Celulose (veja o histórico de edições)

Postado

verifique a vocação dos players. Na sua tabela de configuração só vejo suporte a vocações de 0 a 4, lembrando que existem vocações como Royal Paladin, Elite Knight etc, que vão de 5 a 8.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo