Ir para conteúdo

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

Featured Replies

Postado

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:

 

 

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())

 

Resolvido por Adriano SwaTT

Ir para solução
  • Respostas 5
  • Visualizações 410
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • 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 pric

Postado
  • 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

Postado
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)

Postado

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

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

Informação Importante

Confirmação de Termo