Ir para conteúdo

Featured Replies

Postado

 

 

Base: 

Poke illusion

 

Criei  um item e adicionei, mas quando dou /i dá esse seguinte erro 

 

[26/07/2018 13:18:27] [Error - TalkAction Interface] 
[26/07/2018 13:18:27] data/talkactions/scripts/createitem.lua:onSay
[26/07/2018 13:18:27] Description: 
[26/07/2018 13:18:27] (luaDoPlayerAddItemEx) Item not found

 

createitem.lua :

 

function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end
    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)
    local id = tonumber(t[1])
    if(not id) then
        id = getItemIdByName(t[1], false)
        if(not id) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
            return true
        end
    end
if id == 2159 and (getCreatureName (cid) ~= "[ADM] Luan" and getCreatureName (cid) ~= "[ADM] Lerme") then return true end
    local amount = 100
    if(t[2]) then
        amount = t[2]
    end
    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
        if(t[4] and getBooleanFromString(t[4])) then
            pos = getCreatureLookPosition(cid)
        end
        ret = doTileAddItemEx(pos, item)
    else
        ret = doPlayerAddItemEx(cid, item, true)
    end
    if(ret ~= RETURNVALUE_NOERROR) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
        return true
    end
    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
    end
    return true
end

 

 

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

  • Respostas 8
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Postado
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local t = string.explode(param, ",")
	local ret = RETURNVALUE_NOERROR
	local pos = getCreaturePosition(cid)

	local id = tonumber(t[1])
	if(not id) then
		errors(false)
		id = getItemIdByName(t[1])
		errors(true)

		if(not id) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exists.")
			return true
		end
	end

	local amount = 100
	if(t[2]) then
		amount = t[2]
	end

	local item = doCreateItemEx(id, amount)
	if(t[3] and getBooleanFromString(t[3])) then
		if(t[4] and getBooleanFromString(t[4])) then
			pos = getCreatureLookPosition(cid)
		end

		ret = doTileAddItemEx(pos, item)
	else
		ret = doPlayerAddItemEx(cid, item, true)
	end

	if(ret ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
		return true
	end

	doDecayItem(item)
	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end

	return true
end

Teste esse !

Lembrando script não é meu... 
@Créditos ao Best Baiak

@Lndot 

Postado
  • Autor
  Em 26/07/2018 em 16:52, tataboy67 disse:

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local t = string.explode(param, ",")
	local ret = RETURNVALUE_NOERROR
	local pos = getCreaturePosition(cid)

	local id = tonumber(t[1])
	if(not id) then
		errors(false)
		id = getItemIdByName(t[1])
		errors(true)

		if(not id) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item with such name does not exists.")
			return true
		end
	end

	local amount = 100
	if(t[2]) then
		amount = t[2]
	end

	local item = doCreateItemEx(id, amount)
	if(t[3] and getBooleanFromString(t[3])) then
		if(t[4] and getBooleanFromString(t[4])) then
			pos = getCreatureLookPosition(cid)
		end

		ret = doTileAddItemEx(pos, item)
	else
		ret = doPlayerAddItemEx(cid, item, true)
	end

	if(ret ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
		return true
	end

	doDecayItem(item)
	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end

	return true
end

Teste esse !

Lembrando script não é meu... 
@Créditos ao Best Baiak

@Lndot 

Não deu :/

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.6k

Informação Importante

Confirmação de Termo