Ogłoszenie

Oglaszam Konkurs Kto napisze 50 postow dostaje moderatora do rozdania sa 2 moderatory

#1 2008-08-16 15:53:32

BoczeQ

http://i26.tinypic.com/2ez0183.png

Skąd: Za śmietnikiem pukać w rynne
Zarejestrowany: 2008-08-16
Posty: 16
Punktów :   
Nick: Belator
Server: Candia
Level: 2

[8.1][NPC]Prison Guard

Uwaga Skrypt nie mój

Na sam początek tworzymy
w data/npc/scripts plik prison.lua

Wklejamy tam to:

Spoiler:

focus = 0
talk_start = 0
target = 0
following = false
attacking = false

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
          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) < 15 then
        if isPremium(cid) then
            selfSay('Hello ' .. creatureGetName(cid) .. ' , Pay me 100k to get out of prison, say pay to get out.')
            focus = cid
            talk_start = os.clock()
        else
            selfSay('Only Premium players can get out of prison.')
            focus = 0
            talk_start = 0
        end

      elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
          selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

      elseif focus == cid then
        talk_start = os.clock()

        if msgcontains(msg, 'pay') then
            if pay(cid,100000) then
                selfSay('Let\'s go!')
                selfSay('/send ' .. creatureGetName(cid) .. ', 1000 1000 7')
                focus = 0
                talk_start = 0
            else
                selfSay('Ha, you dont have enough money, you filthy thif!')
            end

        elseif msgcontains(msg, 'out') then
            if pay(cid,450) then
                selfSay('Let\'s go!')
                selfSay('/send ' .. creatureGetName(cid) .. ', 1000,1000,7 ')
                focus = 0
                talk_start = 0
            else
                selfSay('Ha, you dont have enough money, you filthy thif!')
            end

        elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
            selfSay('Good bye, ' .. creatureGetName(cid) .. ' Lets hope we dont see you again.')
            focus = 0
            talk_start = 0
        end
    end
end


function onCreatureChangeOutfit(creature)

end


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

Następnie tworzymy w data/npc plik Prison Guard.xml

Spoiler:

<?xml version="1.0"?>

<npc name="Prison Guard" script="data/npc/scripts/prison.lua" access="3">
    <health now="1" max="1"/>
    <look type="131" head="95" body="95" legs="95" feet="95" corpse="3128"/>
</npc>


It is no use saying "We are doing our best."
You have got to succeed in doing what is necessary.

Kolejne NEO
http://tibiaimage.com/char/6/Belator.png

Offline

 
Oglaszam Konkurs Kto napisze 50 postow dostaje moderatora do rozdania sa 2 moderatory

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.logistyka-wscil.pun.pl www.p-metin2.pun.pl www.dmc.pun.pl www.enwu.pun.pl www.przygody-w-berk.pun.pl