Skrypty & Kody Pomocy NPC

Status
Zamknięty.

Creative Robs

Active User
Zarejestrowany
Dołączył
Marzec 6, 2010
Posty
111
Liczba reakcji
3
M?j NPC m?wi w default zamiast w zak?adce NPC ;/
Nie pytajcie dlaczego chce go mie? na serwerze bo i tak b?d? zmienia? t? rozmow? ale nie chc? by gada? w default bo robi si? spam
Oto skrypt:

regulamin.lua
Kod:
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) < 4 then
  		selfSay('Czesc Twoim zadaniem jest przeczytanie krotkiego regulaminu wpisz "ok" aby przeczytac.')
  		focus = cid
  		talk_start = os.clock()

  	elseif msgcontains(msg, 'Hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Przepraszam, ! Poczekaj kilka minut.')

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


if msgcontains(msg, 'ok') and focus == cid then
  		selfSay('Nie podawaj sie za innych graczy"')
  		focus = cid
  		talk_start = os.clock()

		end

if msgcontains(msg, 'drugi punkt') and focus == cid then
  		selfSay('Zabrania sie uzywana nazw postaci przyjetych za wulgarne wpisz "trzeci punkt"')
  		focus = cid
  		talk_start = os.clock()

		end

if msgcontains(msg, 'trzeci punkt') and focus == cid then
  		selfSay('Szanuj innych graczy a oni beda szanowac ciebie wpisz "czwarty punkt"')
  		focus = cid
  		talk_start = os.clock()

		end

if msgcontains(msg, 'czwarty punkt') and focus == cid then
  		selfSay('Na tym serwerze zabrania sie uzywania wulgarnych slow wpisz "piaty punkt"')
  		focus = cid
  		talk_start = os.clock()

		end

if msgcontains(msg, 'piaty punkt') and focus == cid then
  		selfSay('Jesli widzisz jakis bug zglos to koniecznie na forum wpisz "koniec"')
  		focus = cid
  		talk_start = os.clock()

		end

if msgcontains(msg, 'koniec') and focus == cid then
  		selfSay('To juz wszystko drogi  Dziekujemy ze przeczytales regulamin. Zyczymy milej gry.')




		elseif msgcontains(msg, 'narazie') and getDistanceToCreature(cid) < 4 then
			selfSay('narazie, !')
			focus = 0
			talk_start = 0
		end
  	end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
  	if (os.clock() - talk_start) > 60 then
  		if focus > 0 then
  			selfSay('Nastepny prosze...')
  		end
 		focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Do widzenia.')
 			focus = 0
 		end
 	end
end

Prosz? o pomoc
 
Odp: Pomocy NPC

Tam gdzie masz wsz?dzie "selfSay" i tekst dalej to musisz po przecinku doda? "cid" o tak:

[LUA]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(cid, '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(cid, 'Czesc Twoim zadaniem jest przeczytanie krotkiego regulaminu wpisz "ok" aby przeczytac.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'Hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay(cid, 'Przepraszam, ! Poczekaj kilka minut.')

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


if msgcontains(msg, 'ok') and focus == cid then
selfSay(cid, 'Nie podawaj sie za innych graczy')
focus = cid
talk_start = os.clock()

end

if msgcontains(msg, 'drugi punkt') and focus == cid then
selfSay(cid, 'Zabrania sie uzywana nazw postaci przyjetych za wulgarne wpisz "trzeci punkt"')
focus = cid
talk_start = os.clock()

end

if msgcontains(msg, 'trzeci punkt') and focus == cid then
selfSay(cid, 'Szanuj innych graczy a oni beda szanowac ciebie wpisz "czwarty punkt"')
focus = cid
talk_start = os.clock()

end

if msgcontains(msg, 'czwarty punkt') and focus == cid then
selfSay(cid, 'Na tym serwerze zabrania sie uzywania wulgarnych slow wpisz "piaty punkt"')
focus = cid
talk_start = os.clock()

end

if msgcontains(msg, 'piaty punkt') and focus == cid then
selfSay(cid, 'Jesli widzisz jakis bug zglos to koniecznie na forum wpisz "koniec"')
focus = cid
talk_start = os.clock()

end

if msgcontains(msg, 'koniec') and focus == cid then
selfSay(cid, 'To juz wszystko drogi Dziekujemy ze przeczytales regulamin. Zyczymy milej gry.')




elseif msgcontains(msg, 'narazie') and getDistanceToCreature(cid) < 4 then
selfSay(cid, 'narazie, !')
focus = 0
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 60 then
if focus > 0 then
selfSay(cid, 'Nastepny prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay(cid, 'Do widzenia.')
focus = 0
end
end
end[/LUA]
 
Status
Zamknięty.
Back
Do góry