SE
pedido

PEDIDO : NPC PROMOTION

Por sergionilo, 20 de fev. de 2013 em Scripts

resolvido
tibia
script
otserv
40
3.6k
sergioniloS
03 de março de 2013 às 20:33

ow fico assim :

 

 

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then

if getPlayerPromotionLevel(cid,1) == TRUE then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You don't have the member promotion, or you don't have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

mais o npc n aparece denovo quando eu tento summona ele com o god e aparece essa mensagem no exe :

 

 

 

[03/03/2013 20:32:51] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Vip Promotion Seller.lua:32: ')' expected near 't'

[03/03/2013 20:32:51] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Vip Promotion Seller.lua

[03/03/2013 20:32:51] data/npc/scripts/Vip Promotion Seller.lua:32: ')' expected near 't'

GearsG
03 de março de 2013 às 20:35

Try this...

 

 

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 price = 80000000

if msgcontains(msg, 'hi') then
selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)
elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then
selfSay('You want to be promoted vip for 80000000 gold coins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then
if getPlayerPromotionLevel(cid,1) == TRUE then
doPlayerRemoveMoney(cid, price)
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!', cid)
else
selfSay('You don't have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...', cid)
end
else
selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Good bye.', cid)
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

RoksasR
03 de março de 2013 às 20:43

Desculpa, erro, bobo de mais meu ahha:

 

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then

if getPlayerPromotionLevel(cid,1) == TRUE then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You dont have the member promotion, or you don't have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

sergioniloS
03 de março de 2013 às 21:00

estranho é q quando tentamo conserta isso ele funfo, mas depois que tentamo aruma aquele erro do dinheiro e as mensagem ta ainda assim :

 

 

[03/03/2013 21:00:19] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Vip Promotion Seller.lua:32: ')' expected near 't'

[03/03/2013 21:00:20] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Vip Promotion Seller.lua

[03/03/2013 21:00:20] data/npc/scripts/Vip Promotion Seller.lua:32: ')' expected near 't'

Editado Março 3 por sergionilo

RoksasR
03 de março de 2013 às 21:07

Desculpe cara, é que são palavras com apóstrofe, exemplo

don't

you're

Não pode ter isso rsrs, ai interage com o script ;s

Tenta ai:

 

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then

if getPlayerPromotionLevel(cid,1) == TRUE then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('You dont have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

sergioniloS
03 de março de 2013 às 21:23

ae agora ele apareceu mas tipo ele não da a promotion, acho que pode ser porque ta para ele dar a primeira promotion sendo que essa script é pra ele dar a segunda promotion se voce tiver a primeira :

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if (getPlayerPromotionLevel(cid) < 2 and getPlayerLevel(cid)) >= 750 then

if getPlayerPromotionLevel(cid,1) == TRUE then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('Sorry, You dont have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editado Março 3 por sergionilo

RoksasR
03 de março de 2013 às 21:27

AQUI TEM QUE TER A PRIMEIRA PROMOTION PRA SER PROMOVIDO, VE:

 

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerLevel(cid) >= 750 then

if getPlayerPromotionLevel(cid) == 1 then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

Editado Março 3 por Roksas

sergioniloS
03 de março de 2013 às 21:33

não po é tipo, eu falo hi, dps promotion, dps yes, dai como eu tenho 80kk level 750 e member promotion era pra ele me dar a vip promotion mas dai ele fala :

 

Sorry, You dont have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...

 

é ta dando esse erro :x

Editado Março 3 por sergionilo

RoksasR
03 de março de 2013 às 21:41

Editei meu post acima, tenta ae :D

sergioniloS
03 de março de 2013 às 21:49

agora ele ta dando a vip promotion de graça tendo os requisitos '-', voltei vou postar como ta o script

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerLevel(cid) >= 750 then

if getPlayerPromotionLevel(cid) == 1 then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

selfSay('Sorry, You dont have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Editado Março 4 por sergionilo

RoksasR
04 de março de 2013 às 18:02

Acho que estamos chegando perto hhaha, tente:

 

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerLevel(cid) >= 750 then

if getPlayerPromotionLevel(cid) == 1 then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

setPlayerPromotionLevel(cid, 2)

doPlayerRemoveMoney(cid, price)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

sergioniloS
04 de março de 2013 às 21:35

mas e se ele n tiver dinheiro e nem a primeira vocation? onde fica essa mensagem :

 

 

'Sorry, You dont have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...'
?

 

e pq tem 2 :

 

 

'Congratulations! You were promoted vip! good bye!'
?

Editado Março 4 por sergionilo

RoksasR
04 de março de 2013 às 21:53

 

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 price = 80000000

 

if msgcontains(msg, 'hi') then

selfSay("You want to be promoted? Say 'promotion' or 'vip promotion'?", cid)

elseif msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion') then

selfSay('You want to be promoted vip for 80000000 gold coins?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if getPlayerLevel(cid) >= 750 then

if getPlayerPromotionLevel(cid) == 1 then

doPlayerRemoveMoney(cid, price)

setPlayerPromotionLevel(cid, 2)

selfSay('Congratulations! You were promoted vip! good bye!', cid)

else

setPlayerPromotionLevel(cid, 2)

doPlayerRemoveMoney(cid, price)

selfSay('Sorry, You dont have the member promotion, or you dont have 80000000 gold coins to be promoted vip, good bye...', cid)

end

else

selfSay("You are already promoted vip, or not have level 750 to be promoted vip, good bye...", cid)

end

talkState[talkUser] = 0

elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then

talkState[talkUser] = 0

selfSay('Good bye.', cid)

end

 

return true

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

sergioniloS
04 de março de 2013 às 21:55

lol ainda ta dando de graça

Editado Março 4 por sergionilo

sergioniloS
07 de março de 2013 às 20:28

U.P !