UP !
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Bom, vamos lá. Vá em data/npc/scripts, crie um arquivo chamado promo2.lua e adicione isso dentro:
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, '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) >= 50 and getPlayerPromotionLevel(cid) < 2) then
if(doPlayerRemoveMoney(cid, price) == TRUE) then
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!.', cid)
else
selfSay('You do not have 80000000 gold coins to be promoted vip, good bye.', cid)
end
else
selfSay('You are already promoted, or not have level and promotion needed.', 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())
Para configurar, aonde eu selecionei de vermelho são: preço e lvl necessário!
Agora em data/npc, crie um arquivo chamado Promo Sell.xml e adicione isso dentro:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Promo Seller" script="promo2.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>
Espero que funcione ^^
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

ow valeu ! funfo tudo certinho REP +, só que como fasso pra promotion vip (segunda promotion) só ser adiquirida se eu tiver a member promotion (primeira promotion) ?
dou + outro REP + amanhã se ajudar ai vlw ![]()
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Só substituir
)
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, '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) >= 50 and getPlayerPromotionLevel(cid) < 2) then
if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!.', cid)
else
selfSay('You do not have 80000000 gold coins to be promoted vip, good bye.', cid)
end
else
selfSay('You are already promoted, or not have level and promotion needed.', 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())
Dúvida sanada?
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

deu esse erro :
[27/02/2013 21:27:51] [Error - LuaScriptInterface::loadFile] data/npc/scripts/vip promotion seller.lua:32: ')' expected near 't'
[27/02/2013 21:27:51] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/vip promotion seller.lua
[27/02/2013 21:27:51] data/npc/scripts/vip promotion seller.lua:32: ')' expected near 't'
tentei procura o parenteses errado mais n achei todos tavão completos mas talvez algum esteja em um local errado (dai não sei ver) :x
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Ve 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, '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) >= 50 and getPlayerPromotionLevel(cid) < 2) then
if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!', cid)
else
selfSay('You do not have 80000000 gold coins to be promoted vip, good bye', cid)
end
else
selfSay('You are already promoted, or not have level and promotion needed', 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())
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

lol mudei o nome do npc tava tudo okey mais tbm não era isso que estranho o.0 vou passar o que eu modifiquei :
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, '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 and getPlayerPromotionLevel(cid) < 2) then
if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!', cid)
else
selfSay('You do not have 80000000 gold coins to be promoted vip, good bye...', cid)
end
else
selfSay('You are already promoted vip, or not have level 750, or don't have the member promotion, 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())
e o .xml :
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Vip Promotion Seller" script="data/npc/scripts/Vip Promotion Seller.lua" walkinterval="2000" floorchange="0">
<mana now="100" max="100"/>
<health now="99" max="100"/>
<look type="332" head="0" body="0" legs="0" feet="0"/>
</npc>
Editado Fevereiro 27 por sergionilo
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Funcionou sua modificação?
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

não :x
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Ah cara, mals, esqueci de colocar uma coisa, tenta ae:
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 and getPlayerPromotionLevel(cid) < 2) then
if(doPlayerRemoveMoney(cid, price) == TRUE) and getPlayerPromotionLevel(cid,1) == TRUE then
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!', cid)
else
selfSay('You do not have 80000000 gold coins to be promoted vip, good bye...', cid)
end
else
selfSay("You are already promoted vip, or not have level 750, or don't have the member promotion, 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 Fevereiro 28 por Roksas
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

agora o npc ta aparecendo mais quando vc compra a promotion e não tem a primera promotion ele dis q vc n tem 80000000 moedas e dai ele pega tuas moedas :x, mas quando o cara não tem level, ou ja tem a promotion vip ele fala certinho é só quando o cara não tem a primera promotion, tipo ele não ta disendo que o cara não tem a primera promotion ele ja pergunta se tu tem dinhero e tu dis sim e ele pega tens 80kk
Editado Fevereiro 28 por sergionilo
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Experimenta cara:
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 do not have 80000000 gold coins to be promoted vip, good bye...', cid)
end
else
selfSay("You are already promoted vip, or not have level 750, or don't have the member promotion, 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())
info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino

agora ele não pega o dinheiro mais ainda fala que não tenho 80000000 moedas em ves de diser :
You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...
no caso ele devia diser a frase acima pois eu n tenho a primeira vocation, mas eu tenho money.
Editado Março 3 por sergionilo
info
Grupo: Herói
Registrado: 14/12/10
Posts: 3.6k
Reputação: +846
Gênero: Masculino

Experimenta cara:
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 and getPlayerLevel(cid) >= 750 then
if getPlayerPromotionLevel(cid) <= 1 then
if doPlayerRemoveMoney(cid, price) == TRUE then
setPlayerPromotionLevel(cid, 2)
selfSay('Congratulations! You were promoted vip! good bye!', cid)
else
selfSay('You are already promoted vip, or not have level 750, or don't have the member promotion, good bye...', cid)
end
else
selfSay("You are already promoted vip, or not have level 750, or don't have the member promotion, 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
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())


info
Grupo: Campones
Registrado: 04/01/09
Posts: 57
Reputação: +1
Gênero: Masculino
bom até pouco tempo eu estive usando um script de promotion criado pelo Roksas, muito bom alias, mas eu tava pensando em criar uma vip só para promotions dai eu presisaria de 2 npcs para q o da vip seja em uma quest e o outro deja de graça :
ot tem 2 promotion a primeira é para quem não é vip por exemplo um elite knight vira member knight, e a segunda é só pra quem é vip, então eu estava querendo um script de npc.lua para estas funções :
vender promotion só se tiver a 1ª promotion
vender só se tiver level
vender só se tiver money para comprar
falas :
player : hi
npc: Welcome, Usuario! I have been expecting you!
player : promotion / vip promotion
npc :
You want to be promoted vip for 80000000 gold coins?
ou
You are already promoted, good bye... (npc sai da conversa)
player : yes
npc :
you don't have 80000000 gold coins to be promoted vip, good bye... (npc sai da conversa)
ou
Sorry, you need to have the first promotion to be promoted vip, good bye... (npc sai da conversa)
ou
Congratulations! You were promoted vip! good bye! (npc sai da conversa)
+++REP pra quem ajudar ai galera ! valeu !
Editado Fevereiro 20 por sergionilo