Ir para conteúdo
  • Cadastre-se

(Resolvido)Erro Onsay


Ir para solução Resolvido por Vodkart,

Posts Recomendados

Bom gente to com esse sistema de crew. quando um player esta nas costa de alguem e falar crew sai uma animaçao nos personagem.

 

o que eu quero é que quando nao tem niguem em sua frente e fala crew. alem de o nome subir nomalmente igual uma palavra qualquer, aparece esse ERRO na distro.

[Error - TalkAction Interface]

data/talkactions/scripts/crew.lua:onSay

Description:

<luaGetCreatureLookDirection> Creature not found

 

Com o player na frente esta funcionando nomalmente.

 

Spoiler

function onSay(cid, words, param)

local config =
 {
  seconds = 5,
  storage = 19,
  msg = "Você não consegue fazer na velocidade 5.",
}

local function useAgain(cid)
 setPlayerStorageValue(cid, config.storage, 2)
 return TRUE
end

local playerPos = getCreaturePosition(cid)

   if getPlayerLookDir(cid) == 0 then
            position = {x = playerPos.x, y = playerPos.y-1, z = playerPos.z, stackpos = 253}
   elseif getPlayerLookDir(cid) == 1 then
            position = {x = playerPos.x+1, y = playerPos.y, z = playerPos.z, stackpos = 253}
   elseif getPlayerLookDir(cid) == 2 then
            position = {x = playerPos.x, y = playerPos.y+1, z = playerPos.z, stackpos = 253}
   elseif getPlayerLookDir(cid) == 3 then
            position = {x = playerPos.x-1, y = playerPos.y, z = playerPos.z, stackpos = 253}
   end

   local alvo = getThingfromPos(position)
   local direcalvo = getPlayerLookDir(alvo.uid)
   local direcself = getPlayerLookDir(cid)

   if isCreature(alvo.uid) == TRUE then
            if isPlayer(alvo.uid) == TRUE then
                        if direcself == direcalvo then
                                    if getPlayerStorageValue(cid, config.storage) == -1 then
                                    setPlayerStorageValue(cid, config.storage, os.time()-config.seconds)
                                    end
                                    if config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)) > 0 then
                                    doPlayerSendCancel(cid, string.format(config.msg, config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage))))
                                    return TRUE
                                    end
                                    setPlayerStorageValue(cid, config.storage, os.time())
                                    doSendAnimatedText(getPlayerPosition(cid), "CREEEU!", TEXTCOLOR_RED)
                                    doSendAnimatedText(getPlayerPosition(alvo.uid), "AII!", TEXTCOLOR_ORANGE)
                                    return TRUE
                        else
                                    doPlayerSendCancel(cid, "Precisa estar de costas para você.")
                        end
            else
                        doPlayerSendCancel(cid, "Isso não é um player õO'.")
            end
   else
       doPlayerSendCancel(cid, "Não tem ninguém na sua frente.")
   end

return TRUE
end

 

Uso tfs 0.4,8.60

Editado por Admnwso (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

vc está chamando a função de pegar a posição do jogador mesmo sem saber se ele está lá...

 

function onSay(cid, words, param)
	local config = {
		seconds = 5,
		storage = 19,
		msg = "Você não consegue fazer na velocidade 5."
	}
	function useAgain(cid)
		return setPlayerStorageValue(cid, config.storage, 2)
	end
	local playerPos = getCreaturePosition(cid)
	if getPlayerLookDir(cid) == 0 then
		position = {x = playerPos.x, y = playerPos.y-1, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 1 then
		position = {x = playerPos.x+1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 2 then
		position = {x = playerPos.x, y = playerPos.y+1, z = playerPos.z, stackpos = 253}
	elseif getPlayerLookDir(cid) == 3 then
		position = {x = playerPos.x-1, y = playerPos.y, z = playerPos.z, stackpos = 253}
	end
	local alvo = getThingfromPos(position)
	local direcself = getPlayerLookDir(cid)
	if isPlayer(alvo.uid) then
		local direcalvo = getPlayerLookDir(alvo.uid)
		if direcself == direcalvo then
			if getPlayerStorageValue(cid, config.storage) == -1 then
				setPlayerStorageValue(cid, config.storage, os.time()-config.seconds)
			end
			if config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)) > 0 then
				doPlayerSendCancel(cid, string.format(config.msg, config.seconds-(os.time()-getPlayerStorageValue(cid, config.storage)))) return true
			end
			setPlayerStorageValue(cid, config.storage, os.time())
			doSendAnimatedText(getPlayerPosition(cid), "CREEEU!", TEXTCOLOR_RED)
			doSendAnimatedText(getPlayerPosition(alvo.uid), "AII!", TEXTCOLOR_ORANGE) return true
		else
			doPlayerSendCancel(cid, "Precisa estar de costas para você.") return true
		end
	else
		doPlayerSendCancel(cid, "Não tem nenhum player na sua frente.") return true
	end
	return true
end

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

Obrigado amigo, por um minunto pensei que os grande scripter daqui nao esta mas on. Vlw msm

 

Tem como ajuda aki.

 

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo