Odp: poszukuje skrypta
[xml]<?xml version="1.0" encoding="UTF-8"?>
<npc name="Summoner" script="summoner.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type="130" head="0" body="0" legs="0" feet="0" addons="0" corpse="2212"/>
</npc>
[/xml]
[lua]local focuses = {}
local function isFocused(cid)
for i, v in pairs(focuses) do
if(v == cid) then
return true
end
end
return false
end
local function addFocus(cid)
if(not isFocused(cid)) then
table.insert(focuses, cid)
end
end
local function removeFocus(cid)
for i, v in pairs(focuses) do
if(v == cid) then
table.remove(focuses, i)
break
end
end
end
local function lookAtFocus()
for i, v in pairs(focuses) do
if(isPlayer(v)) then
doNpcSetCreatureFocus(v)
return
end
end
doNpcSetCreatureFocus(0)
end
function onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
if(isFocused(cid)) then
selfSay("Hmph!")
removeFocus(cid)
end
end
function onCreatureSay(cid, type, msg)
local YourPos = getPlayerPosition(cid)
local exhaustionInSeconds = 60*10
local minutes = exhaustionInSeconds/60
local storage = 3001
if((msg == "hi" or msg == "hello") and not (isFocused(cid))) then
selfSay("Welcome, ".. getCreatureName(cid) ..". I summoned monsters for money.", cid, true)
addFocus(cid)
elseif((isFocused(cid)) and (msg == "monsters")) then
selfSay("Dragon 1k; Dragon Lord 2k; Grim Reaper 6k; Demon 10k; What monster you want summon?", cid, true)
---------------------DRAG--------------------
elseif((isFocused(cid)) and (msg == "dragon")) then
if(exhaustion.check(cid, storage) == true) then
selfSay("You may summon next monster for "..minutes.." minutes!")
removeFocus(cid)
else
if getPlayerMoney(cid) >= 1000 then
doCreateMonster("Dragon", getThingPos(cid))
doPlayerRemoveMoney(cid, 1000)
removeFocus(cid)
selfSay("Here you are!", cid, true)
exhaustion.set(cid, storage, exhaustionInSeconds)
else
selfSay("You dont have money!", cid, true)
end
end
------------------DRAG_END----------------------------
-------------------DL-------------------------------
elseif((isFocused(cid)) and (msg == "dragon lord")) then
if(exhaustion.check(cid, storage) == true) then
selfSay("You may summon next monster for "..minutes.." minutes!")
removeFocus(cid)
else
if getPlayerMoney(cid) >= 2000 then
doCreateMonster("Dragon Lord", getThingPos(cid))
doPlayerRemoveMoney(cid, 2000)
removeFocus(cid)
selfSay("Here you are!", cid, true)
exhaustion.set(cid, storage, exhaustionInSeconds)
else
selfSay("You dont have money!", cid, true)
end
end
-------------------DL_END-------------------------------
------------------GR-----------------------------------
elseif((isFocused(cid)) and (msg == "grim reaper")) then
if(exhaustion.check(cid, storage) == true) then
selfSay("You may summon next monster for "..minutes.." minutes!")
removeFocus(cid)
else
if getPlayerMoney(cid) >= 6000 then
doCreateMonster("Grim Reaper", getThingPos(cid))
doPlayerRemoveMoney(cid, 6000)
removeFocus(cid)
selfSay("Here you are!", cid, true)
exhaustion.set(cid, storage, exhaustionInSeconds)
else
selfSay("You dont have money!", cid, true)
end
end
------------------GR_END-----------------------------------
--------------------DEM--------------------------------------
elseif((isFocused(cid)) and (msg == "demon")) then
if(exhaustion.check(cid, storage) == true) then
selfSay("You may summon next monster for "..minutes.." minutes!")
removeFocus(cid)
else
if getPlayerMoney(cid) >= 10000 then
doCreateMonster("Demon", getThingPos(cid))
doPlayerRemoveMoney(cid, 10000)
removeFocus(cid)
selfSay("Here you are!", cid, true)
exhaustion.set(cid, storage, exhaustionInSeconds)
else
selfSay("You dont have money!", cid, true)
end
end
-------------------------------DEM_END---------------------------
elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
selfSay("Goodbye!", cid, true)
removeFocus(cid)
end
end
function onThink()
for i, focus in pairs(focuses) do
if(not isCreature(focus)) then
removeFocus(focus)
else
local distance = getDistanceTo(focus) or -1
if((distance > 4) or (distance == -1)) then
selfSay("Hmph!")
removeFocus(focus)
end
end
end
lookAtFocus()
end[/lua]
Mam wra?enie, ?e mo?na by go jako? ulepszy?

u?atwi? konfiguracj? i chyba przyda?by si? tutaj tablice

jakie? wskaz?wki od bardziej do?wiadczonych skrypter?w?
