LukiS - 2008-05-17 13:11:07

Macie problem bo na waszym ots jest dużo aż za dużo noobów to wklejcie to:
data/npc/Guard.xml


Kod:

<?xml version="1.0"?>

<npc name="Guard" script="data/npc/scripts/guard.lua" access="3" lookdir="2" autowalk="25">
	<mana now="800" max="800"/>
	<health now="200" max="200"/>
<look type="131" head="95" body="95" legs="95" feet="95" corpse="3128"/>
</npc>

data/npc/scripts/guard.lua


Kod:

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('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) < 4 then
 		selfSay('Elo ' .. creatureGetName(cid) .. '! Pilnuje, zeby nie krecily sie tu [nooby].')
 		focus = cid
 		talk_start = os.clock()

	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Sorry, ' .. creatureGetName(cid) .. '! Pogadam z toba za minute.')

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

		if msgcontains(msg, 'nooby') or msgcontains(msg, 'noobs') then
			selfSay('Jestes noobem?')
			talk_state = 1


		elseif talk_state == 1 then
			if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
				doPlayerAddHealth(cid,- ( getPlayerHealth(cid) ) ) 
				selfSay('Gin noobie!')
			focus = 0
  			talk_start = 0

			elseif msgcontains(msg, 'nie') or msgcontains(msg, 'no') then
                                doPlayerAddItem(cid, 2674, 5)
				selfSay('To dobrze! Masz tu cos ode mnie.')
			talk_state = 0
                        end


  		elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
  			selfSay('Nara, ' .. 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('Spadaj.')
 			focus = 0
 		end
 	end
end

Mam nadzieję, że skrypt się przydał.
Fragment Rozmowy.
Ty:Hi
Guard:Elo Ty. Pilnuje, zeby nie krecily sie tu nooby.
Ty: nooby
Guard: Jesteś noobem?
Ty: yes
Guard: Gin noobie
albo
Ty:Hi
Guard:Elo Ty. Pilnuje, zeby nie krecily sie tu [nooby].
Ty: nooby
Guard: Jesteś noobem?
Ty: no
Guard: To dobrze,trzymaj cos ode mnie!
Ty: bye
Guard: Bye, Ty.

:d

www.tirrok1.pun.pl www.dianne-forum.pun.pl www.robaki.pun.pl www.haxball.pun.pl www.shahrukh-juhi.pun.pl