Ir para conteúdo

Featured Replies

Postado
  • Autor
  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())

 

 

 

Infelizmente ainda persiste o erro =/

Editado por admelite
errei a escrita (veja o histórico de edições)

  • Respostas 15
  • Visualizações 883
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @admelite  local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) n

  • local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCre

  • @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},

Posted Images

Postado
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

 

Postado

@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

Postado

@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

 

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo