Ir para conteúdo
  • 0

..::: Npc Promotion :::..


TiagoBordin1988

Pergunta

Então estava querendo um NPC que so vende-se promotion, e o player tinha que ter premium pra vender, tenho um aqui mas ele ta vendendo pra quem nao é premium só que o player so perde o dinheiro pq não é adicionado a promotion pois ele não é premium.

 

 

NPC

<?xml version="1.0" encoding="UTF-8"?>

<npc name="Johnny" script="data/npc/scripts/promotion.lua" walkinterval="2000" floorchange="0">

<mana now="800" max="800"/>

<health now="200" max="200"/>

<look type="133" head="114" body="119" legs="132" feet="114"/>

</npc>

 

SCRIP

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())

 

OBS: O número de QUOTES aberto não combina com o número de QUOTES fechados. coloco certo e da este erro ¬¬

Editado por TiagoBordin1988
Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

teste este aki

 

local keywordHandler = KeywordHandler:new()

 

local days = 10 --Quantos dias tenque ter pra comprar a promotion

 

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

if getPlayerPremiumDays(cid) >= days then

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())

 

 

creio que este script funcione

ate

Link para o comentário
Compartilhar em outros sites

  • 0

SE NAO DER CERTO TENTE ESSE

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
local msg = string.lower(msg)
local promote = {
["promote"] = {level = 20, price = 20000, promotion = 1, premium = false},
["vip"] = {level = 20, price = 50000, promotion = 2, premium = true}
}
if promote[msg] then
if promote[msg].premium == true and not isPremium(cid) then
npcHandler:say('You need a premium account in order to get promoted', cid)
return true
end
if getPlayerPromotionLevel(cid) < promote[msg].promotion then
if getPlayerLevel(cid) >= promote[msg].level then
if doPlayerRemoveMoney(cid, promote[msg].price) then
setPlayerPromotionLevel(cid, promote[msg].promotion)
npcHandler:say('Congratulations! You are now promoted!', cid)
else
npcHandler:say('You need '..promote[msg].price..' gps to buy this promotion.', cid)
end
else
npcHandler:say('I am sorry, but I can only promote you once you have reached level '..promote[msg].level, cid)
end
else
npcHandler:say('You are already promoted!', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

SCRIPT 100% CRIADO PELO VODKART

Link para o comentário
Compartilhar em outros sites

  • 0

teste este aki

 

local keywordHandler = KeywordHandler:new()

 

local days = 10 --Quantos dias tenque ter pra comprar a promotion

 

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

if getPlayerPremiumDays(cid) >= days then

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

npcHandler:addModule(FocusModule:new())

 

 

creio que este script funcione

ate

 

este de cima deu um erro

[05/05/2012 18:19:15] [Error - Npc interface]

[05/05/2012 18:19:15] (Unknown script file)

[05/05/2012 18:19:15] Description:

[05/05/2012 18:19:15] attempt to call a nil value

[05/05/2012 18:19:15] stack traceback:

 

SE NAO DER CERTO TENTE ESSE

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
local msg = string.lower(msg)
local promote = {
["promote"] = {level = 20, price = 20000, promotion = 1, premium = false},
["vip"] = {level = 20, price = 50000, promotion = 2, premium = true}
}
if promote[msg] then
if promote[msg].premium == true and not isPremium(cid) then
npcHandler:say('You need a premium account in order to get promoted', cid)
return true
end
if getPlayerPromotionLevel(cid) < promote[msg].promotion then
if getPlayerLevel(cid) >= promote[msg].level then
if doPlayerRemoveMoney(cid, promote[msg].price) then
setPlayerPromotionLevel(cid, promote[msg].promotion)
npcHandler:say('Congratulations! You are now promoted!', cid)
else
npcHandler:say('You need '..promote[msg].price..' gps to buy this promotion.', cid)
end
else
npcHandler:say('I am sorry, but I can only promote you once you have reached level '..promote[msg].level, cid)
end
else
npcHandler:say('You are already promoted!', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

SCRIPT 100% CRIADO PELO VODKART

 

e este ele retira o dinheiro do player free account e fala 18:27 Johnny: You are already promoted!.

Link para o comentário
Compartilhar em outros sites

  • 0

Tenta esse. Se nao der certo, onde tiver return 0, mude pra return 1 pra ver se funciona.

 

 

 

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
local msg = string.lower(msg)
local promote = {
["promote"] = {level = 20, price = 20000, promotion = 1, premium = false},
["vip"] = {level = 20, price = 50000, promotion = 2, premium = true}
}
if promote[msg] then
if promote[msg].premium == true and not isPremium(cid) then
npcHandler:say('You need a premium account in order to get promoted', cid)
return 0
end
if not isPremium(cid) then
if getPlayerPromotionLevel(cid) < promote[msg].promotion then
if getPlayerLevel(cid) >= promote[msg].level then
if doPlayerRemoveMoney(cid, promote[msg].price) then
setPlayerPromotionLevel(cid, promote[msg].promotion)
npcHandler:say('Congratulations! You are now promoted!', cid)
npcHandler:say('You need a premium account in order to get promoted', cid)
return 1
end
else
npcHandler:say('You need '..promote[msg].price..' gps to buy this promotion.', cid)
end
else
npcHandler:say('I am sorry, but I can only promote you once you have reached level '..promote[msg].level, cid)
end
else
npcHandler:say('You are already promoted!', cid)
end
end
return 1
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

  • 0

achei um do vodkart aki testa ai

local keywordHandler = KeywordHandler:new()

 

premium = true -- se precisa ser premium True significa sim e false e nao

 

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

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

local travelNode = keywordHandler:addKeyword({'enigma city'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to travel to Enigma City for 50 gold coins?'})

travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1000, cost = 50, destination = {x=942, y=978, z=6} })

travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'})

keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to \'Enigma City\' for just a small fee.'})

npcHandler:addModule(FocusModule:new())

 

ate

 

se ajudei + rep

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...