Ir para conteúdo
  • 0

Bug Promotion, Quando Desloga Perde Ela


eduardo190696

Pergunta

Bom o Título já diz tudo... o player compra a promotion e quando desloga perde ela u.u, ja olhei no login.lua e n achei nada que tirasse a promotion quando loga.

 

segue ai o npc promotion para caso seja algo com ele


local focus = 0
local talkStart = 0
local target = 0

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
  if focus == cid then
	  selfSay('Good bye then.')
	  focus = 0
	  talkStart = 0
  end
end


function onCreatureTurn(creature)

end


function msgcontains(txt, str)
  return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end


function onCreatureSay(cid, type, msg)
  msg = string.lower(msg)

  if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
 selfSay('Hello ' .. getCreatureName(cid) .. '! I sell promotions, if you need to buy just say {promotion}.', cid)
 focus = cid
 talkStart = os.clock()

  elseif focus == cid then
talkStart = os.clock()
if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
 if getPlayerVocation(cid) > 4 then
 selfSay('Sorry, you are already promoted.', cid)
 talkState = 0
elseif not isPremium(cid) then
selfSay('Sorry, you must be premium to buy promotion.', cid)
talkState = 0
else
selfSay('Do you want to buy promotion for 20k?', cid)
talkState = 1
end

elseif talkState == 1 then
if msgcontains(msg, 'yes') then
if doPlayerRemoveMoney(cid, 20000) == TRUE then
doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
selfSay('You are now promoted!', cid)
else
selfSay('Sorry, you do not have enough money.', cid)
end
 end
talkState = 0

  elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
  selfSay('Good bye, ' .. getCreatureName(cid) .. '!', cid)
  focus = 0
  talkStart = 0
  end
  end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
doNpcSetCreatureFocus(focus)
  if (os.clock() - talkStart) > 30 then
  if focus > 0 then
  selfSay('Next Please...')
  end
  focus = 0
  end
 if focus ~= 0 then
 if getDistanceToCreature(focus) > 5 then
 selfSay('Good bye then.')
 focus = 0
 end
 end
end

 

quem puder ajudar :D ganha meu +Rep

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

 

 

 

local focus = 0

local talkStart = 0

local target = 0

 

function onThingMove(creature, thing, oldpos, oldstackpos)

 

end

 

 

function onCreatureAppear(creature)

 

end

 

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

focus = 0

talkStart = 0

end

end

 

 

function onCreatureTurn(creature)

 

end

 

 

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

 

 

function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

 

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. getCreatureName(cid) .. '! I sell promotions, if you need to buy just say {promotion}.', cid)

focus = cid

talkStart = os.clock()

 

elseif focus == cid then

talkStart = os.clock()

if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then

if getPlayerVocation(cid) > 4 then

selfSay('Sorry, you are already promoted.', cid)

talkState = 0

elseif not isPremium(cid) then

selfSay('Sorry, you must be premium to buy promotion.', cid)

talkState = 0

else

selfSay('Do you want to buy promotion for 20k?', cid)

talkState = 1

end

 

elseif talkState == 1 then

if msgcontains(msg, 'yes') then

if doPlayerRemoveMoney(cid, 20000) == TRUE then

setPlayerPromotionLevel(cid, 1)

selfSay('You are now promoted!', cid)

else

selfSay('Sorry, you do not have enough money.', cid)

end

end

talkState = 0

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '!', cid)

focus = 0

talkStart = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talkStart) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

Link para o comentário
Compartilhar em outros sites

  • 0

Very Thx man, Reputado.

 

Ultima duvida, eu criei novas vocations elas são

 

 

<!-- Vip Vocation -->

<vocation id="9" clientId="8" name="Summoner" description="an sumoner" needpremium="1" gaincap="15" gainhp="10" gainmana="35" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="1700" soulmax="300" gainsoulticks="15" fromvoc="5" lessloss="15">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="10" clientId="16" name="Medicaster" description="an medicaster" needpremium="1" gaincap="15" gainhp="10" gainmana="35" gainhpticks="12" gainhpamount="1" gainmanaticks="2" gainmanaamount="2" manamultiplier="1.1" attackspeed="1700" soulmax="300" gainsoulticks="15" fromvoc="6" lessloss="15">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="11" clientId="4" name="Royal Archer" description="a royal archer" needpremium="1" gaincap="25" gainhp="15" gainmana="20" gainhpticks="6" gainhpamount="1" gainmanaticks="3" gainmanaamount="2" manamultiplier="1.4" attackspeed="1700" soulmax="300" gainsoulticks="15" fromvoc="7" lessloss="15">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="12" clientId="2" name="Warrior" description="an warrior" needpremium="1" gaincap="30" gainhp="20" gainmana="10" gainhpticks="4" gainhpamount="1" gainmanaticks="6" gainmanaamount="2" manamultiplier="3.0" attackspeed="1700" soulmax="300" gainsoulticks="15" fromvoc="8" lessloss="15">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<!-- Close Vip Vocation -->

 

 

 

e fiz um npc vip promotion :

 

 

 

local focus = 0

local talkStart = 0

local target = 0

 

function onThingMove(creature, thing, oldpos, oldstackpos)

 

end

 

 

function onCreatureAppear(creature)

 

end

 

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

focus = 0

talkStart = 0

end

end

 

 

function onCreatureTurn(creature)

 

end

 

 

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

 

 

function onCreatureSay(cid, type, msg)

msg = string.lower(msg)

 

if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then

selfSay('Hello ' .. getCreatureName(cid) .. '! I sell promotions, if you need to buy just say {vip promotion}.', cid)

focus = cid

talkStart = os.clock()

 

elseif focus == cid then

talkStart = os.clock()

if msgcontains(msg, 'vip promotion') or msgcontains(msg, 'vip promote') then

if getPlayerVocation(cid) > 8 then

selfSay('Sorry, you are already vip promoted.', cid)

talkState = 0

elseif getPlayerVocation(cid) < 4 then

selfSay('Sorry, you no have promotion.', cid)

talkState = 0

elseif not isPremium(cid) then

selfSay('Sorry, you must be premium to buy vip promotion.', cid)

talkState = 0

else

selfSay('Do you want to buy vip promotion for 40k?', cid)

talkState = 1

end

 

elseif talkState == 1 then

if msgcontains(msg, 'yes') then

if doPlayerRemoveMoney(cid, 40000) == TRUE then

setPlayerPromotionLevel(cid, 1)

selfSay('You are now have vip promotion!', cid)

else

selfSay('Sorry, you do not have enough money.', cid)

end

end

talkState = 0

 

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '!', cid)

focus = 0

talkStart = 0

end

end

end

 

 

function onCreatureChangeOutfit(creature)

 

end

 

 

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talkStart) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

 

qual dos 2 esta errado pois mesmo comprando ele não adc a vocation D;

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

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