Ir para conteúdo
  • Cadastre-se

(Resolvido)[Erro] NPC ajudem please!!


Ir para solução Resolvido por Vodkart,

Posts Recomendados

  Em 26/07/2018 em 20:16, Vodkart disse:
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower()
	local tabble = {
		["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}},
		["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}}
	}

		if not tabble[msg] then
			npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true
		end
		local t = tabble[msg]
  if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then
   	if getPlayerLevel(cid) >= t.level then
    		if getPlayerMoney(cid) >= t.money then
			npcHandler:say('Você foi teleportado para '..msg..'!', cid)
     			doTeleportThing(cid, t.pos)
     			doPlayerRemoveMoney(cid, t.money) return true
		else
			npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid)
		end
	else
			npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid)
	end
else
	npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid)
end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Expand   Mostrar mais  

 

 

Infelizmente ainda persiste o erro =/

Editado por admelite
errei a escrita (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Respostas 15
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

@admelite  local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHan

local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)

@admelite  local t = { ["local1"] = {{x=96, y=119, z=5}, 5000}, -- ["O que o player terá que digitar"] = {onde será levado, custo de money} ["local2"] = {{x=96, y=119, z=7}, 5000}, } function onSay(cid, words, param, channel) local exaust = 1 -- Minutos para usar o comando novamente local storage = 435569 local teleport = t[param] if os.time() - getPlayerStorageValue(cid, storage) <= exaust * 60 then doPlayerSendTextMessage(cid, ME

Posted Images

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
	local talkUser,msg = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid, msg:lower()
	local tabble = {
		["carlin"] = {item = {2160,1}, money = 1, level = 30, pos = {x = 1054, y = 1058, z = 7}},
		["thais"] = {item = {2190, 1}, money = 2000, level = 60, pos = {x = 168, y = 58, z = 7}}
	}

		if not tabble[msg] then
			npcHandler:say('somente posso te levar para {carlin} ou {thais}...', cid) return true
		end
		local t = tabble[msg]
  if getPlayerItemCount(cid, t.item[1]) >= t.item[2] then
   	if getPlayerLevel(cid) >= t.level then
    		if getPlayerMoney(cid) >= t.money then
			npcHandler:say('Você foi teleportado para '..msg..'!', cid)
     			doTeleportThing(cid, t.pos)
     			doPlayerRemoveMoney(cid, t.money) return true
		else
			npcHandler:say('Você precisa de '..t.money..' gold coins para viajar para '..msg..'.', cid)
		end
	else
			npcHandler:say('Você precisa ter '..t.level..' level ou mais para viajar para '..msg..'.', cid)
	end
else
	npcHandler:say('Você precisa de '..t.item[2]..' '..getItemNameById(t.item[1])..' para viajar para '..msg..'.', cid)
end
	return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

testado.

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

@admelite cara faz assim, abre seu arquivo que está dando erro como Notepad e vai linha por linha procurando algum caractere no final da linha e apaga eles, os possíveis caractere que faz com que esse erro te atrapalhe sao: - ? eu sei disso por que sempre que eu pego um script do TK e tento executar no meu servidor da esse erro e para não acontecer mais isso, tentar apertar só uma vez o comando CTRL +C e CTRL + V

Link para o post
Compartilhar em outros sites

@Emanueldk entendo vou tentarm obrigado a todos que tentaram ajudar ai

nao tem nenhum script de comando ex: !teleport tal lugar que cobra "x" valor para usar o comando?

Link para o post
Compartilhar em outros sites

@admelite 

local t = {
    
    ["local1"] = {{x=96, y=119, z=5}, 5000}, -- ["O que o player terá que digitar"] = {onde será levado, custo de money}
    ["local2"] = {{x=96, y=119, z=7}, 5000},
    
}

function onSay(cid, words, param, channel)
    
    local exaust = 1 -- Minutos para usar o comando novamente
    local storage = 435569
    
    local teleport = t[param]
    
    if os.time() - getPlayerStorageValue(cid, storage) <= exaust * 60 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O Comando está em exaustão")
        return true
    end
    
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Digite o nome da quest que você quer")
        return true
    end

    if not teleport then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Local não encontrado.")
        return true
    end
    
    if getCreatureCondition(cid, CONDITION_INFIGHT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não pode estar em Battle")
        return true
    end
    
    if doPlayerRemoveMoney(cid, teleport[2]) then
        doPlayerSendTextMessage(cid, 25, "Teleportado")
        doTeleportThing(cid, teleport[1])
        doSendMagicEffect(getCreaturePosition(cid), 2)
        setPlayerStorageValue(cid, storage, os.time())
    	return true
    else
        doPlayerSendTextMessage(cid, 27, "Voce nao tem dinheiro suficiente")
        doSendMagicEffect(getCreaturePosition(cid), 2)
    end
    return true
end

 

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.

  • Estatísticas dos Fóruns

    96845
    Tópicos
    519604
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo