LO
pedido

[Bug] Player Compra Promotion 2 No Npc E Quando Desloga Ela Acaba

Por lorenzoh20, 30 de jul. de 2012 em Scripts

promotion acaba qndo desloga
promotion
promotion2
bug
23
3.6k
lorenzoh20L
30 de julho de 2012 às 18:56

@Vodkart - Seguinte maninho, simplesmente quando o player paga a promotion, funciona de boa, dae quando ele desloga ele volta a ser master sorcerer, elder druid, etc

 

@tchubaka

 

vou tentar isso mais provavelmente não vai dar certo, não deu antes.

VodkartV
30 de julho de 2012 às 19:20

eu sei

eu to perguntando se a promote é essa que eu falei

 

5,6,7 e 8 vao pra 9,10,11 e 12!

lorenzoh20L
30 de julho de 2012 às 19:30

sim.

VodkartV
30 de julho de 2012 às 19:41

npc

 

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
msg = string.lower(msg)
local config = {
price = 1000,
promo = 1, -- n mexa pq sao voc 5,6,7,8 aki
level = 100
}
if isInArray({"promote","second promote","promover"}, msg) then
selfSay('Você quer ser promovido por '..config.price..' gps? {yes} ', cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if getPlayerPromotionLevel(cid) == config.promo then
if getPlayerLevel(cid) >= config.level then
if doPlayerRemoveMoney(cid,config.price) == TRUE then
local new = (getPlayerPromotionLevel(cid)+1)
setPlayerPromotionLevel(cid, new)
setPlayerStorageValue(cid, 878974, new)
selfSay('Parabens! Voce tem sua segunda promocao. ', cid)
talkState[talkUser] = 0
else
selfSay('Você não tem ' .. config.price .. ' gps para ser promovido', cid)
talkState[talkUser] = 0
end
else
selfSay('Desculpe, você precisa ter level '.. config.level .. ' ou mais para se promover!', cid)
talkState[talkUser] = 0
end
else
selfSay('Desculpe, mais você não possui a '..config.promo..'° promotion.', cid)
talkState[talkUser] = 0
end
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Then not", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

em data/creaturescript/script/login.lua adc isso antes do último return true

if getPlayerStorageValue(cid, 878974) ~= -1 then
setPlayerPromotionLevel(cid, getPlayerStorageValue(cid, 887979))
end

lorenzoh20L
30 de julho de 2012 às 19:57

vo tentar aki e te dar rep + mano

 

cara , o executavel do meu ot começou a falar assim

 

[Warning - Vocations::getvocation] Vocation 4294967295 not found.

 

sem parar ficu aparecendo sem parar

VodkartV
30 de julho de 2012 às 20:10

então remove os script q te passei e tenta assim:

 

npc

 

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
msg = string.lower(msg)
local price = 1
local vocations = {5,6,7,8}
local level = 100
if isInArray({"promote","second promote","promover"}, msg) then
selfSay('Você quer ser promovido por '..price..' gps? {yes} ', cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if isInArray(vocations, getPlayerVocation(cid)) then
if getPlayerLevel(cid) >= level then
if doPlayerRemoveMoney(cid,price) == TRUE then
local new = (getPlayerVocation(cid)+4)
doPlayerSetVocation(cid, new)
setPlayerStorageValue(cid, 878975, new)
selfSay('Parabens! Voce tem sua segunda promocao. ', cid)
talkState[talkUser] = 0
else
selfSay('Você não tem ' .. price .. ' gps para ser promovido', cid)
talkState[talkUser] = 0
end
else
selfSay('Desculpe, você precisa ter level '.. level .. ' ou mais para se promover!', cid)
talkState[talkUser] = 0
end
else
selfSay('Desculpe, mais você não possui a primeira promotion.', cid)
talkState[talkUser] = 0
end
elseif msg == "no" and talkState[talkUser] >= 1 then
selfSay("Then not", cid)
talkState[talkUser] = 0
npcHandler:releaseFocus(cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

em data/creaturescript/script/login.lua adc isso antes do último return true

 

 

if getPlayerStorageValue(cid, 878975) ~= -1 then
doPlayerSetVocation(cid, getPlayerStorageValue(cid, 878975))
end

 

 

SE BUGAR DE NOVO É PQ O ERRO É EM VOCATIONS.XML

lorenzoh20L
30 de julho de 2012 às 21:10

MANO, FUNCIONOU, VALEU! VOU TE DA REP+ , só q uma pergunta antes, voce saberia fazer ficar o nome da vocation vip no site,

exemplo: -Soul Druid-

 

pq mesmo sendo promotion 2 , está elder druid

VodkartV
30 de julho de 2012 às 21:52

n sei mexer cm site

desculpa