Npc reklamer !

Status
Zamknięty.

Bubcio

Advanced User
Zarejestrowany
Dołączył
Grudzień 22, 2008
Posty
202
Liczba reakcji
12
Poszukuje reklamera ! kt?ry co jakie? 5 minut by pisa? wiadomo?? do wszystkich obecnych graczy na serverze ! to musi by? npc !! bardzo prosze o szybko odpowiedz bedzie reput !
 
Odp: Npc reklamer !

To pod 7.6 a ja potrzebuje pod 8.42 a po drugie nie o to chodzi ! zeby gracz wysylal wiadomosc tylko zeby sama sie wysylala do graczy !
 
Odp: Npc reklamer !

To Nie M?j ;) Tylko z Silnika skopiowa?em.

Zobacz Tego:
data\npc Robisz Broadcaster.xml
Kod:
<?xml version="1.0"?>
<npc name="Broadcaster" script="data/npc/scripts/Broadcaster.lua" access="3">
	<look type="141" head="87" body="94" legs="113" feet="0" addons="3"/>
</npc>


data\npc\scripts Robisz Broadcaster.lua
Kod:
-- NPC Broadcaster by Alreth, v1.37, 2006-07-25 18:15 CET
-- Idea by souhlen (Anel)

focus = 0
next_focus = 0
talk_start = 0
msgHi = 'Heylo! Would you like to broadcast anything?'
msgBye = 'See you another time!'
price = 10000
inConvo = 0
broadcast = ''
cast = ''
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(msgBye)
			focus = next_focus
			next_focus = 0
		distFocus = getDistanceToCreature(next_focus)
		if (distFocus ~= nil and distFocus < 4) then
			selfSay(msgHi)
			talk_start = os.clock()
			focus = next_focus
			next_focus = 0
			inConvo = 1
		else
			focus = 0
			talk_start = 0
			inConvo = 0
		end
 	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)
    msg2 = msg
	msg = string.lower(msg)
	if (cast ~= '') then
	    selfSay('does nothing')
	-- do nothing, wait until message has been broadcasted and npc has replied
	elseif (getDistanceToCreature(cid) >= 4 and focus == cid) then
	    selfSay('Please come closer, '..creatureGetName(cid)..'. I can\'t hear what you are saying from over there.')
	    
	elseif (type == 1) then
	 	if ((string.find(msg, '(%a*)hi(%a*)') or string.find(msg, '(%a*)hello(%a*)') or string.find(msg, '(%a*)heylo(%a*)') or string.find(msg, '(%a*)greetings(%a*)')) and (focus == 0) and getDistanceToCreature(cid) < 4) then
			selfSay(msgHi)
			focus = cid
			talk_start = os.clock()
			inConvo = 1

		elseif ((string.find(msg, '(%a*)hi(%a*)') or string.find(msg, '(%a*)hello(%a*)') or string.find(msg, '(%a*)heylo(%a*)') or string.find(msg, '(%a*)greetings(%a*)')) and (focus ~= cid) and getDistanceToCreature(cid) < 4)  then
 			if (next_focus > 0 and getDistanceToCreature(next_focus) < 4) then
	 			selfSay('Take a nap while I help the ones before you, ' .. creatureGetName(cid) .. '.')
 			else
	 			selfSay('I\'ll soon come to you, ' .. creatureGetName(cid) .. '.')
 				next_focus = cid
 			end

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

			if ((msgcontains(msg, 'broadcast') or msgcontains(msg, 'say')) and inConvo == 0) then
				if (getPlayerLevel(creatureGetName(cid)) >= 30) then
			    	selfSay('Do you want me to broadcast anything for you?')
			    	inConvo = 1
				else
				    selfSay('Come back when you\'re older!')
				end

			elseif (msgcontains(msg, 'yes') and inConvo == 1) then
				selfSay('Tell me what you want me to broadcast.')
				inConvo = 2

			elseif (msgcontains(msg, 'no') and inConvo == 1) then
				selfSay('Perhaps tomorrow then..')
		        if (next_focus > 0 and getDistanceToCreature(next_focus) < 4) then
	    			selfSay(msgHi)
    				talk_start = os.clock()
    				focus = next_focus
    				next_focus = 0
    				inConvo = 1
    			else
	    			focus = 0
    				talk_start = 0
    				inConvo = 0
    			end
    		    broadcast = ''

			elseif (inConvo == 2 and (msg ~= 'stop')) then
				if (string.len(msg) > 90) then
					selfSay('I am sorry, but your message can not be longer than 90 letters, including spaces and other characters. Say a new message or say STOP to end.')
				else
				    broadcast = msg2
					selfSay('Do you want to pay '..price..' gold for me to broadcast this message? "'..broadcast..'"')
					inConvo = 3
			    end

			elseif (msgcontains(msg, 'yes') and inConvo == 3) then
			    if (pay(cid, price)) then
			        selfSay('/B '..creatureGetName(cid)..' says: '..broadcast)
			        saycast = os.clock()
			        inConvo = 1
			        
                    io.output(io.open("broadcast.log", "a"))
                    io.write("["..os.date("%y.%m.%d %X").."] <"..creatureGetName(cid).."> "..broadcast.."\n")
                    io.close()
        		    cast = broadcast
			    else
			        selfSay('You can not afford this service. Please come back another time when you have more money!')
            		if (next_focus > 0) then
                		distFocus = getDistanceToCreature(next_focus)
                		if (distFocus ~= nil and distFocus < 4) then
        	    			selfSay(msgHi)
            				talk_start = os.clock()
            				focus = next_focus
            				next_focus = 0
            				inConvo = 1
            			else
        	    			focus = 0
            				talk_start = 0
            				inConvo = 0
            			end
            		    broadcast = ''
    			    end
			    end

			elseif (msgcontains(msg, 'no') and inConvo == 3) then
				selfSay('Ok then.')
				inConvo = 0
        		broadcast = ''

			elseif (string.find(msg, '(%a*)job(%a*)')) then
				selfSay('Oh, I am just sitting around here and gamble now and then.')
				inConvo = 0

 			elseif (string.find(msg, '(%a*)bye(%a*)')) then
	    		selfSay(msgBye)
        		if (next_focus > 0) then
            		distFocus = getDistanceToCreature(next_focus)
            		if (distFocus ~= nil and distFocus < 4) then
    	    			selfSay(msgHi)
        				talk_start = os.clock()
        				focus = next_focus
        				next_focus = 0
        				inConvo = 1
        			else
    	    			focus = 0
        				talk_start = 0
        				inConvo = 0
        			end
            		broadcast = ''
     			end
     	    end
 		end
 	end
end


function onCreatureChangeOutfit(creature)
end

function onThink()
    if (cast ~= '' and (os.clock() - saycast) > 1) then
        selfSay('Do you want to broadcast anything else?')
        cast = ''
    elseif (os.clock() - talk_start) > 30 then
        if (focus > 0) then	
    		selfSay(msgBye)
    		if (next_focus > 0) then
        		distFocus = getDistanceToCreature(next_focus)
        		if (distFocus ~= nil and distFocus < 4) then
        			selfSay(msgHi)
        			talk_start = os.clock()
        			focus = next_focus
        			next_focus = 0
        			inConvo = 1
		        else
        			focus = 0
        			talk_start = 0
        			inConvo = 0
    			end
    		else
    			focus = 0
    			talk_start = 0
    			inConvo = 0
    		end
        	broadcast = ''
    	end
 	elseif (focus ~= 0) then
 	    distFocus = getDistanceToCreature(focus)
		if (distFocus ~= nil and distFocus > 5) then
    		selfSay(msgBye)
    		if (next_focus > 0) then
        		distFocus = getDistanceToCreature(next_focus)
        		if (distFocus ~= nil and distFocus < 4) then
        			selfSay(msgHi)
        			talk_start = os.clock()
        			focus = next_focus
        			next_focus = 0
        			inConvo = 1
        		else
        			focus = 0
        			talk_start = 0
        			inConvo = 0
        		end
    		end
        	broadcast = ''
		end
	end
end

To pisze co jaki? czas. Kiedy? mia?em npc og?oszenia. Ale Tu ju? nie ma ;/
Na Tego te? trzeba pisa? ?eby co? on pisa? ale to dzia?a na 8.1 ale nie wiem czy wy?ej te? ;d

a jak nie to bd szuka? dalej mo?e znajd? ;)
 
Odp: Npc reklamer !

@up
da?e? npc kt?ry pisze jak si? mu zap?aci i napiszesz co ma gada? on takiego nie chcia?..

data\npc Robisz Message.xml

Wklejasz to
<?xml version="1.0" encoding="UTF-8" ?>
- <npc name="Message" script="data/npc/scripts/message.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100" />
<look type="134" head="78" body="88" legs="0" feet="88" addons="3" />
</npc>

data\npc\scripts Robisz Message.xml

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
lastSay = 0
local message = "Przypominamy iz na stronie www istnieje reklama dzieki ktorej mozesz pom?c naszemu Ots WYSTARCZY TYLKO ZE NA NIA KLIKNIESZ - Zapraszamy!"
local typ = MESSAGE_STATUS_WARNING
local coIleSekund = 900
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
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)
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.time() >= lastSay) then
lastSay = os.time()+coIleSekund
local gracze = getOnlinePlayers()
for i, pid in ipairs(gracze) do
local aktualny = getPlayerByName(pid)
if (isPlayer(aktualny) == TRUE) then
doPlayerSendTextMessage(aktualny,typ,message)
else
print('Kreatura '.. pid ..' nie jest graczem, a powinna.')
end
end
end
end

Co ile sekund ma by? wy?wietlana wiadomo??
Co ma si? wy?wietla?
 
Ostatnia edycja:
Status
Zamknięty.
Back
Do góry