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


info
Grupo: Visconde
Registrado: 22/09/10
Posts: 474
Reputação: +47
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 endquem puder ajudar
ganha meu +Rep