What's new

NPC NPC Kicker

Status
Not open for further replies.

Hakeq

Banned
Joined
Mar 23, 2013
Messages
103
Reaction score
6
Autor: hihelo
Przedstawiam npc kt?ry daje kicka.



Code:
<?xml version="1.0"?>
<npc name="Kicker" script="data/npc/scripts/kick.lua" access="3">
 	<look type="131" head="0" body="114" legs="0" feet="114"/>
</npc>

Code:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0

function onThingMove(creature, thing, oldpos, oldstackpos)

end


function onCreatureAppear(creature)

end


function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Dozobaczenia.')
          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('Hello ' .. creatureGetName(cid) .. '! Daje kicka. Napisz (Kick me).')
 		focus = cid
 		talk_start = os.clock()
	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Sorry, ' .. creatureGetName(cid) .. '! Porozmawiamy za minute.')

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

		if msgcontains(msg, 'kick me') then
			selfSay('/kick ' .. creatureGetName(cid))
			
	

  		elseif msgcontains(msg, 'bye')  and getDistanceToCreature(cid) < 4 then
  			selfSay('Trzymaj sie, ' .. creatureGetName(cid) .. '!')
  			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('Nastempny...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Dozobaczenia.')
 			focus = 0
 		end
 	end
end

W tym skrypcie kicker za wywalenie z gry nie bierze op?aty.
Je?eli chcecie aby zabiera? np 1cc pod tym kodem:
Code:
if msgcontains(msg, 'kick me') then
dodajecie:
Code:
if pay(cid,10000) then

Pozdrawiam,
Hakeq.
 
Status
Not open for further replies.
Top