Ir para conteúdo
  • Cadastre-se

(Resolvido)[ FAST HELP ] Coloca Nivel em um Teleport por NPC !


Ir para solução Resolvido por Adriano SwaTT,

Posts Recomendados

Bom seguinte, tenho um NPC que cobra 10kk + 500 white pearls e queria coloca-lo tbm para somente player nivel 2k+ posso utiliza-lõ para se teletransportado, Segue a baixo a script do NPC:

 

  Citar

 

local tab = {

pos = {x = 275, y = 73, z = 7}, -- posição x, y, z do local a teleportar o player
item = {2143, 500}, -- {itemID, count}
price = 1000 -- quantidade em crystal coins
}
 
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 = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if (msgcontains(msg, 'teleport')) then
talkState[talkUser] = 1
selfSay('Are you sure?', cid)
selfSay('Remember..you need '..tab.item[2]..' '..getItemNameById(tab.item[1])..' and '..tab.price..' crystal coins to be teleported.', cid)
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then 
doTeleportThing(cid, tab.pos)
doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
            doPlayerRemoveMoney(cid, tab.price * 10000)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
selfSay('Have a good trip.', cid)
else
talkState[talkUser] = 0
selfSay('I can not teleport you. You do not have the required items.', cid)
end
elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
talkState[talkUser] = 0
selfSay('Okay, maybe another time.', cid)
end
 
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Expand   Mostrar mais  

 

Link para o post
Compartilhar em outros sites
  • Solução

Boa noite.

Teste assim.

 

local tab = {
pos = {x = 275, y = 73, z = 7}, -- posição x, y, z do local a teleportar o player
item = {2143, 500}, -- {itemID, count}
level = 2000, -- level mínimo
price = 1000 -- quantidade em crystal coins
}
 
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 = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
if (msgcontains(msg, 'teleport')) then
talkState[talkUser] = 1
selfSay('Are you sure?', cid)
selfSay('Remember..you need '..tab.item[2]..' '..getItemNameById(tab.item[1])..' and '..tab.price..' crystal coins to be teleported.', cid)
elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if getPlayerLevel(cid) >= tab.level then
if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then
doTeleportThing(cid, tab.pos)
doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
            doPlayerRemoveMoney(cid, tab.price * 10000)
doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
selfSay('Have a good trip.', cid)
else
talkState[talkUser] = 0
selfSay('I can not teleport you. You do not have the required items.', cid)
end
else
    selfSay('You need level '..tab.level..' to be teleported.', cid)
end
elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
talkState[talkUser] = 0
selfSay('Okay, maybe another time.', cid)
end
 
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Boa sorte.

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

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Link para o post
Compartilhar em outros sites
local tab = {
pos = {x = 275, y = 73, z = 7}, -- posição x, y, z do local a teleportar o player
item = {2143, 500}, -- {itemID, count}
price = 1000, -- quantidade em crystal coins
level = 2000 -- level necessario
}
 
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 = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid
	if (msgcontains(msg, 'teleport')) then
		talkState[talkUser] = 1
		selfSay('Are you sure?', cid)
		selfSay('Remember..you need '..tab.item[2]..' '..getItemNameById(tab.item[1])..' and '..tab.price..' crystal coins to be teleported.', cid)
	elseif (msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
		if getPlayerLevel(cid) >= tab.level then
			if (getPlayerItemCount(cid, tab.item[1]) >= tab.item[2] and doPlayerRemoveMoney(cid, tab.price * 10000)) then 
				doTeleportThing(cid, tab.pos)
				doPlayerRemoveItem(cid, tab.item[1], tab.item[2])
				doPlayerRemoveMoney(cid, tab.price * 10000)
				doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
				selfSay('Have a good trip.', cid)
			else
				talkState[talkUser] = 0
				selfSay('I can not teleport you. You do not have the required items.', cid)
			end
		else
			selfSay('Sorry you dont has level necessary.', cid)
			talkState[talkUser] = 0
		end
	elseif (msgcontains(msg, 'no') and talkState[talkUser] == 1) then
		talkState[talkUser] = 0
		selfSay('Okay, maybe another time.', cid)
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Editado por fywell (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Por nada.

Faça bom aproveito do script.

 

Abraços.

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Link para o post
Compartilhar em outros sites

O tópico foi movido para a área correta, preste mais atenção da próxima vez!

Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680

Este tópico foi movido:

De: "OTServSuporte OTServSuporte de Spriting"

Para: "OTServSuporte OTServSuporte de Scripts"

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

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

    96831
    Tópicos
    519564
    Posts
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo