What's new

Problem Npc Dajacy lvl

webeq

User
Joined
Sep 25, 2010
Messages
11
Reaction score
0
Siema mam ots wodbo i chcialbym zrobic npc ktory odbugowuje lvl. Probowalem go zrobic ale nie dziala. oto skrypt jaki posiadam w tej chwili
Code:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Zegnaj, Nastepny.')
          focus = 0
          talk_start = 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('Witaj ' .. creatureGetName(cid) .. '! Odbugowuje Lvl.')
         focus = cid
         talk_start = os.clock()
    elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Rozmawiam juz z toba minute.')
      elseif focus == cid then
        talk_start = os.clock()
        if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
             if getPlayerVocation(cid) > 4 then
                 selfSay('Sorry, masz juz promotion.')
                 talk_state = 0
             elseif getPlayerLevel(cid) < 8 then
                selfSay('Sorry, musisz miec 8lvl by kupic promotion.')
                talk_state = 0
            elseif not isPremium(cid) then
                selfSay('Sorry, musisz miec premium by kupic promotion.')
                talk_state = 0
            else
                selfSay('chcesz kupic promotion za 20k?')
                talk_state = 1
            end
        elseif msgcontains(msg, 'lvl') or msgcontains(msg, 'level') then
            selfSay('chcesz kupic level za 400g?')
            talk_state = 2
        elseif talk_state == 1 then
            if msgcontains(msg, 'yes') then
                if pay(cid,20000) then
                    doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
                    selfSay('Dostales promotion!')
                else
                    selfSay('Sorry, Nie masz tyle kasy.')
                end
             end
            talk_state = 0
        elseif talk_state == 2 then
            if msgcontains(msg, 'yes') then
                if pay(cid,4000000) then
                    selfSay('/xaddexp '.. creatureGetName(cid) ..'')
                    selfSay('Dostales 1 level!')
                else
                    selfSay('Sorry, nie masz tyle kaski.')
                end
            end
            talk_state = 0
          elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
              selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!')
              focus = 0
              talk_start = 0
          end
      end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
    doNpcSetCreatureFocus(focus)
      if (os.clock() - talk_start) > 30 then
          if focus > 0 then
              selfSay('Nastepny...')
          end
              focus = 0
      end
     if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Zegnaj, Nastepny.')
             focus = 0
         end
     end
end
 

Retard

User
Joined
May 29, 2010
Messages
46
Reaction score
5
Age
29
Odp: Problem Npc Dajacy lvl

Jesli sie nie myle to komenda na dodanie exp'a jest dopiero od tibii ~8.4 albo jakos tak, a wodbo jest chyba 7.6 tak? Wlasnie to moze byc problemem :p

Mam nadzieje, ze pomoglem :D

Pozdrawiam,
Retard
 

andy1995

Senior User
Joined
Apr 12, 2009
Messages
602
Reaction score
100
Odp: Problem Npc Dajacy lvl

PHP:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
      if focus == cid then
          selfSay('Zegnaj, Nastepny.')
          focus = 0
          talk_start = 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('Witaj ' .. creatureGetName(cid) .. '! Odbugowuje Lvl.')
         focus = cid
         talk_start = os.clock()
    elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Rozmawiam juz z toba minute.')
      elseif focus == cid then
        talk_start = os.clock()
        if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
             if getPlayerVocation(cid) > 4 then
                 selfSay('Sorry, masz juz promotion.')
                 talk_state = 0
             elseif getPlayerLevel(cid) < 8 then
                selfSay('Sorry, musisz miec 8lvl by kupic promotion.')
                talk_state = 0
            elseif not isPremium(cid) then
                selfSay('Sorry, musisz miec premium by kupic promotion.')
                talk_state = 0
            else
                selfSay('chcesz kupic promotion za 20k?')
                talk_state = 1
            end
        elseif msgcontains(msg, 'lvl') or msgcontains(msg, 'level') then
            selfSay('chcesz kupic level za 400g?')
            talk_state = 2
        elseif talk_state == 1 then
            if msgcontains(msg, 'yes') then
                if pay(cid,20000) then
                    doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
                    selfSay('Dostales promotion!')
                else
                    selfSay('Sorry, Nie masz tyle kasy.')
                end
             end
            talk_state = 0
        elseif talk_state == 2 then
            if msgcontains(msg, 'yes') then
                if pay(cid,4000000) then
					doPlayerAddLevel(cid, 1)
                    selfSay('Dostales 1 level!')
                else
                    selfSay('Sorry, nie masz tyle kaski.')
                end
            end
            talk_state = 0
          elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
              selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!')
              focus = 0
              talk_start = 0
          end
      end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
    doNpcSetCreatureFocus(focus)
      if (os.clock() - talk_start) > 30 then
          if focus > 0 then
              selfSay('Nastepny...')
          end
              focus = 0
      end
     if focus ~= 0 then
         if getDistanceToCreature(focus) > 5 then
             selfSay('Zegnaj, Nastepny.')
             focus = 0
         end
     end
 

webeq

User
Joined
Sep 25, 2010
Messages
11
Reaction score
0
Odp: Problem Npc Dajacy lvl

Wyskakuje mi blad tresci : buglvl.lua:101 : 'end' expecter <to close 'function at line 77> near '<eof>
 

Yoxino

Advanced User
Joined
Aug 12, 2009
Messages
478
Reaction score
51
Odp: Problem Npc Dajacy lvl

PHP:
local focus = 0 
local talk_start = 0 
local target = 0 
local days = 0 
function onThingMove(creature, thing, oldpos, oldstackpos) 
end 
function onCreatureAppear(creature) 
end 
function onCreatureDisappear(cid, pos) 
      if focus == cid then 
          selfSay('Zegnaj, Nastepny.') 
          focus = 0 
          talk_start = 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('Witaj ' .. creatureGetName(cid) .. '! Odbugowuje Lvl.') 
         focus = cid 
         talk_start = os.clock() 
    elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then 
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Rozmawiam juz z toba minute.') 
      elseif focus == cid then 
        talk_start = os.clock() 
        if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then 
             if getPlayerVocation(cid) > 4 then 
                 selfSay('Sorry, masz juz promotion.') 
                 talk_state = 0 
             elseif getPlayerLevel(cid) < 8 then 
                selfSay('Sorry, musisz miec 8lvl by kupic promotion.') 
                talk_state = 0 
            elseif not isPremium(cid) then 
                selfSay('Sorry, musisz miec premium by kupic promotion.') 
                talk_state = 0 
            else 
                selfSay('chcesz kupic promotion za 20k?') 
                talk_state = 1 
            end 
        elseif msgcontains(msg, 'lvl') or msgcontains(msg, 'level') then 
            selfSay('chcesz kupic level za 400g?') 
            talk_state = 2 
        elseif talk_state == 1 then 
            if msgcontains(msg, 'yes') then 
                if pay(cid,20000) then 
                    doPlayerSetVocation(cid, getPlayerVocation(cid)+4) 
                    selfSay('Dostales promotion!') 
                else 
                    selfSay('Sorry, Nie masz tyle kasy.') 
                end 
             end 
            talk_state = 0 
        elseif talk_state == 2 then 
            if msgcontains(msg, 'yes') then 
                if pay(cid,4000000) then 
                    doPlayerAddLevel(cid, 1) 
                    selfSay('Dostales 1 level!') 
                else 
                    selfSay('Sorry, nie masz tyle kaski.') 
                end 
            end 
            talk_state = 0 
          elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then 
              selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!') 
              focus = 0 
              talk_start = 0 
          end 
      end 
end 
function onCreatureChangeOutfit(creature) 
end 
function onThink() 
    doNpcSetCreatureFocus(focus) 
      if (os.clock() - talk_start) > 30 then 
          if focus > 0 then 
              selfSay('Nastepny...') 
          end 
              focus = 0 
      end 
     if focus ~= 0 then 
         if getDistanceToCreature(focus) > 5 then 
             selfSay('Zegnaj, Nastepny.') 
             focus = 0 
         end 
     end 
end

Prosz? ;)

Pozdrawiam!
Yoxino
 

webeq

User
Joined
Sep 25, 2010
Messages
11
Reaction score
0
Odp: Problem Npc Dajacy lvl

B?ad nie wyskakuje :p ALE npc nie daje lvl ;////
 

andy1995

Senior User
Joined
Apr 12, 2009
Messages
602
Reaction score
100
Odp: Problem Npc Dajacy lvl

PHP:
local focus = 0  
local talk_start = 0  
local target = 0  
local days = 0  
function onThingMove(creature, thing, oldpos, oldstackpos)  
end  
function onCreatureAppear(creature)  
end  
function onCreatureDisappear(cid, pos)  
      if focus == cid then  
          selfSay('Zegnaj, Nastepny.')  
          focus = 0  
          talk_start = 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('Witaj ' .. creatureGetName(cid) .. '! Odbugowuje Lvl.')  
         focus = cid  
         talk_start = os.clock()  
    elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then  
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! Rozmawiam juz z toba minute.')  
      elseif focus == cid then  
        talk_start = os.clock()  
        if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then  
             if getPlayerVocation(cid) > 4 then  
                 selfSay('Sorry, masz juz promotion.')  
                 talk_state = 0  
             elseif getPlayerLevel(cid) < 8 then  
                selfSay('Sorry, musisz miec 8lvl by kupic promotion.')  
                talk_state = 0  
            elseif not isPremium(cid) then  
                selfSay('Sorry, musisz miec premium by kupic promotion.')  
                talk_state = 0  
            else  
                selfSay('chcesz kupic promotion za 20k?')  
                talk_state = 1  
            end  
        elseif msgcontains(msg, 'lvl') or msgcontains(msg, 'level') then  
            selfSay('chcesz kupic level za 400g?')  
            talk_state = 2  
        elseif talk_state == 1 then  
            if msgcontains(msg, 'yes') then  
                if pay(cid,20000) then  
                    doPlayerSetVocation(cid, getPlayerVocation(cid)+4)  
                    selfSay('Dostales promotion!')  
                else  
                    selfSay('Sorry, Nie masz tyle kasy.')  
                end  
             end  
            talk_state = 0  
        elseif talk_state == 2 then  
            if msgcontains(msg, 'yes') then  
                if pay(cid,4000000) then  
					doPlayerAddExperience(cid, getPlayerExperience(cid)-getPlayerLevel(cid)+1)
                    selfSay('Dostales 1 level!')  
                else  
                    selfSay('Sorry, nie masz tyle kaski.')  
                end  
            end  
            talk_state = 0  
          elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then  
              selfSay('Zegnaj, ' .. creatureGetName(cid) .. '!')  
              focus = 0  
              talk_start = 0  
          end  
      end  
end  
function onCreatureChangeOutfit(creature)  
end  
function onThink()  
    doNpcSetCreatureFocus(focus)  
      if (os.clock() - talk_start) > 30 then  
          if focus > 0 then  
              selfSay('Nastepny...')  
          end  
              focus = 0  
      end  
     if focus ~= 0 then  
         if getDistanceToCreature(focus) > 5 then  
             selfSay('Zegnaj, Nastepny.')  
             focus = 0  
         end  
     end  
end
 

webeq

User
Joined
Sep 25, 2010
Messages
11
Reaction score
0
Odp: Problem Npc Dajacy lvl

kurde w dalszym ciagu nie daje nie wiem co sie dzieje, zabiera kase ale lvl nic nie daje
 
Top