• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

Support Scripts - tworzymy/naprawiamy

Status
Zamknięty.
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Actions
Opis: po lewej stronie spisuje 10 pozycji i po prawej, beda ona zamieszczone w skrypcie,
(poniewaz bd chcial zastosowac ten skrypt jeszcze np na 30vs30)
po przesuniaciu wajchy skrypt sprawdza czy na
newno wszyscy stoja na odpowiednich pozycjach i
czy wszyscy maja wiekszy lvl niz 250.
Jezeli tak, to tych po lewej tp w pozycje np. x333, y444, z7,
a tych po prawej na x555, y666, z7, nie musza utrzymywac szyku,
mog? l?dowac na 1sqm.
pozdrawiam.
screen do z0obrazowania:
20vs20.png
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Actions?
Opis: Chodzi mi o cos takiego jesli wpisze godem komende /wiezien nick gracza teleportuje go do wiezienia pozycja xxx po godzinie siedzienia w wiezieniu, musi byc zalogowany 1h teleportuje go do temple.
Dodatkowe:
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Actions?
Opis: Chodzi mi o cos takiego jesli wpisze godem komende /wiezien nick gracza teleportuje go do wiezienia pozycja xxx po godzinie siedzienia w wiezieniu, musi byc zalogowany 1h teleportuje go do temple.
Dodatkowe:
Znalaz?em jaki? taki. Wejd? w data/talkactions/scripts/ i utw?rz plik o nazwie jailsytem.lua a w nim:
PHP:
-- [( Edited by DoidinMapper )] --
default_jail = 3600
grouprequired = 3
jailedstoragevalue_time = 1338
jailedstoragevalue_bool = 1339
jailpos = {x=1000, y=1000, z=8} -- pozycja wiezienia
unjailpos = {x=1000, y=1000, z =7} -- pozycja temple
jail_list = {}
jail_list_work = 0
function checkJailList(param)
addEvent(checkJailList, 1000, {})
for targetID,player in ipairs(jail_list) do
if isPlayer(player) == TRUE then
if getPlayerStorageValue(player, jailedstoragevalue_time) < os.time() then
doTeleportThing(player, unjailpos, TRUE)
setPlayerStorageValue(player, jailedstoragevalue_time, 0)
setPlayerStorageValue(player, jailedstoragevalue_bool, 0)
table.remove(jail_list,targetID)
doPlayerSendTextMessage(player,MESSAGE_STATUS_CONSOLE_ORANGE,'You were kicked from jail! See you later ')
end
else
table.remove(jail_list,targetID)
end
end
end
function onSay(cid, words, param)
if jail_list_work == 0 then
jail_list_work = addEvent(checkJailList, 1000, {})
end
if param == '' and (words == '!unjail' or words == '/unjail') then
if getPlayerStorageValue(cid, jailedstoragevalue_time) > os.time() then
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are jailed until ' .. os.date("%H:%M:%S", getPlayerStorageValue(cid, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').')
else
if getPlayerStorageValue(cid, jailedstoragevalue_bool) == 1 then
table.insert(jail_list,cid)
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You will be kicked from jail in one second.')
else
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You are not jailed.')
end
end
return TRUE
end
local jail_time = -1
for word in string.gmatch(tostring(param), "(%w+)") do
if tostring(tonumber(word)) == word then
jail_time = tonumber(word)
end
end
local isplayer = getPlayerByName(param)
if isPlayer(isplayer) ~= TRUE then
isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+1))
if isPlayer(isplayer) ~= TRUE then
isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+2))
if isPlayer(isplayer) ~= TRUE then
isplayer = getPlayerByName(string.sub(param, string.len(jail_time)+3))
end
end
end
if jail_time ~= -1 then
jail_time = jail_time * 60
else
jail_time = default_jail
end
if words == '!jail' or words == '/jail' then
if getPlayerGroupId ( cid ) >= grouprequired then
if isPlayer(isplayer) == TRUE then
doTeleportThing(isplayer, jailpos, TRUE)
setPlayerStorageValue(isplayer, jailedstoragevalue_time, os.time()+jail_time)
setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 1)
table.insert(jail_list,isplayer)
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You jailed '.. getCreatureName(isplayer) ..' until ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').')
doPlayerSendTextMessage ( isplayer, MESSAGE_INFO_DESCR, 'You have been jailed by '.. getCreatureName(cid) ..' until ' .. os.date("%H:%M:%S", getPlayerStorageValue(isplayer, jailedstoragevalue_time)) .. ' (now is: ' .. os.date("%H:%M:%S", os.time()) .. ').')
return TRUE
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with this name doesn\'t exist or is offline.")
return FALSE
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have access to unjail other players.")
return FALSE
end
elseif words == '!unjail' or words == '/unjail' then
if getPlayerGroupId ( cid ) >= grouprequired then
if isPlayer(isplayer) == TRUE then
doTeleportThing(isplayer, unjailpos, TRUE)
setPlayerStorageValue(isplayer, jailedstoragevalue_time, 0)
setPlayerStorageValue(isplayer, jailedstoragevalue_bool, 0)
table.remove(jail_list,targetID)
doPlayerSendTextMessage(isplayer,MESSAGE_STATUS_CONSOLE_ORANGE,getCreatureName(cid) .. ' let you go out from jail! See you later')
doPlayerSendTextMessage ( cid, MESSAGE_INFO_DESCR, 'You unjailed '.. getCreatureName(isplayer) ..'.')
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player with this name doesn\'t exist or is offline.")
return FALSE
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have access to unjail other players.")
return FALSE
end
end
return FALSE
end
Nast?pnie w /data/talkactions/tallkactions.xml dodaj linijk?:
PHP:
	<talkaction log="yes" words="!jail;/jail" event="script" value="jailsystem.lua"/>
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Talkactions
Opis: Po nacisnieciu na przedmiot o xxx uid daje mi
-aol
-bless
cos takiego:

przy blesach zolty napis i zolte nutki.
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

PHP:
local config = {
				bless = 5, --ilosc blessow, ktore gracz otrzyma (od 0 do 5)
				cost = 5000, --cena JEDNEGO blessa
				aol_price = 10000 --cena jednego AoLa
				}
local bless_uid, aol_uid = 1000, 1001
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid == bless_uid then
	if doPlayerRemoveMoney(cid, config.bless * config.cost) then
		doSendAnimatedText(fromPosition, 'BLESS', COLOR_DARKYELLOW)
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
		for i = 1, config.bless do
			doPlayerAddBlessing(cid, i)
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need more than '..config.bless * config.cost..' Gold Coins.')
	end
elseif item.uid == aol_uid then
	if doPlayerRemoveMoney(cid, config.aol_price) then
		doPlayerAddItem(cid, 2173, 1)
		doSendAnimatedText(fromPosition, 'AOL', COLOR_RED)
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_RED)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You need more than '..config.aol_price..' Gold Coins.')
	end
end
return true
end
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Brak
Opis: K?adziemy 3 itemes o id xxx w jednym miejscu x,y,z ci?gniemy za dzwignie itemes znikaj? a w miejscu x,y,z pojawia si? tp :)
 
Odp: Support Scripts - tworzymy/naprawiamy

#up
Mam nadziej?, ?e ten spos?b bardziej Ci si? spodoba:
W data/movements/scripts zr?b plik i wklej:
PHP:
local config = {
				[11652] = {x = {11653,11654}},
				[11653] = {x = {11652,11654}},
				[11654] = {x = {11653,11652}}
				}
local pos = {x=1000,y=1000,z=7}

function onAddItem(moveItem, tileItem, pos, cid)
if getTileThingByPos(pos).uid ~= 1111 then
return false
end
local item = config[moveItem.itemid]
if item then
	subtype = 0
	for i = 1, 254 do
		local getpos = getThingFromPos({x=pos.x,y=pos.y,z=pos.z,stackpos=i})
		if isInArray({item.x[1], item.x[2]}, getpos.itemid) then
			subtype = subtype + 1
		end
	end
	if subtype == 2 then
		for i = 1, subtype do
			for i = 1, 254 do
				local getposs = getThingFromPos({x=pos.x,y=pos.y,z=pos.z,stackpos=i})
				if isInArray(item.x, getposs.itemid) then
					doRemoveItem(getposs.uid)
				end
			end
		end
		doSendMagicEffect(pos, CONST_ME_FIREWORK_BLUE)
		doCreateTeleport(1387, pos, getThingPos(moveItem.uid))
		doRemoveItem(moveItem.uid)
	end
end
return true
end
Do movements.xml wklej:
PHP:
<movevent type="AddItem" fromid="11652" toid="11654" event="script" value="nazwa.lua"/>

PHP:
local config = {
				[11652] = {x = {11653,11654}},
				[11653] = {x = {11652,11654}},
				[11654] = {x = {11653,11652}}
				}
Jako index daj itemid itemu, a w {} pozosta?e id item?w.
PHP:
local pos = {x=1000,y=1000,z=7}
Pozycja gdzie teleport b?dzie nas teleportowa?.
PHP:
fromid="11652" toid="11654"
Itemid od do.
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Brak
Opis: Na quescie w jednej sali znajduje sie monster gdy go zabijemy pojawia sie tp ! taki skrypty mi potrzeba lub gdy go zabijamy przci?gniemy cia?o na kratke x,y,z i np poci?gniemy za dzwignie i pojawi sie tp.
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: Brak
Opis: Na quescie w jednej sali znajduje sie monster gdy go zabijemy pojawia sie tp ! taki skrypty mi potrzeba lub gdy go zabijamy przci?gniemy cia?o na kratke x,y,z i np poci?gniemy za dzwignie i pojawi sie tp.
Kod:
--Script by ErMex
local cfg = { 
                id_zabitego_potwora = 2886, -- id dead monster
				gdzie_potwor = {x=1022, y=985, z=5, stackpos=255}, -- pozycja gdzie kladziemy cialo
                createtp = {x=1023, y=986, z=5}, -- gdzie ma sie pojawic teleport
                gdzie_tp = {x=1000, y=1000, z=7} -- gdzie teleport ma nas przenosic
                } 

function onUse(cid, item, fromPosition, itemEx, toPosition) 
	if getThingFromPos(cfg.gdzie_potwor).itemid == cfg.id_zabitego_potwora then
		doPlayerSendTextMessage(cid, 25, \"Zostal stworzony teleport...\")
		doCreateTeleport(1387, cfg.gdzie_tp, cfg.createtp)
		doCreatureSay(cid, \"Utworzyl sie teleport!\" ,TALKTYPE_ORANGE_1)
	else
	doPlayerSendTextMessage(cid, 25, \"Musisz postawic cialo na odpowiednie miejsce!\")
	end  
return false
end
Ja bym doda? do tego czas po jakim ma znika? teleport ale jak chcesz.
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

@ErMex
"Ja bym doda? do tego czas po jakim ma znika? teleport ale jak chcesz. "

Nie pomy?la?em o tym ;/ je?li masz czas to dodaj ;P tak ze znika po minucie :)
 
Odp: Support Scripts - tworzymy/naprawiamy

Witam nie mam, gdzie tego napisa? :( je?li nie tu to przrosze o usuni?cie postu.

Sprawa jest taka, ?e posiadam skrypt Upgrade kt?ry ulepsza przedmioty na LVL itd... problem w tym, ?e potrzebowa?bym teraz skryptu, kt?ry Upgraduje Item daj?c mu dopisek np: Dragon Slayer (Niebianski +1) i dawa? by naprzyk?ad + 2 obra?enia od Lodu. A i gdyby by?o to mo?liwe, by da?o si? Upgradnac tylko itemy o danym ID, prosi?bym to wyr??nic tak, bym m?g? to zmieni?. Tak wi?c oto dane:

Opis: WY?EJ ^
Silnik: 8.54 TFS
Typ: Actions (na ID itemu)

Je?eli czego? brakuje prosz? o upomnienie

Oto skrypt, kt?ry m?g?by by? zedytowany, tak by dawa? + obra?enia od Lodu, etc... i je?li to mo?liwe zrobienie go tak by dzia?a? na dany item:
Kod:
local conf = {}

conf["level"] = {
-- [item_level] = {successParcent=PARCENT FOR UPGRADING SUCCESS, downrageLevel = IF UPGRADING FAIL - ITEM WAS DECRASED TO LEVEL HERE}
 [1] = {successParcent = 85, downrageLevel = 0},
 [2] = {successParcent = 80, downrageLevel = 1},
 [3] = {successParcent = 75, downrageLevel = 2},
 [4] = {successParcent = 70, downrageLevel = 3},
 [5] = {successParcent = 65, downrageLevel = 4},
 [6] = {successParcent = 60, downrageLevel = 5},
 [7] = {successParcent = 55, downrageLevel = 6},
 [8] = {successParcent = 50, downrageLevel = 7},
 [9] = {successParcent = 45, downrageLevel = 8}
}
conf["upgrade"] = { -- how many parcent attributes are rised?
    attack = 5, -- attack %
    extraAttack = 10, -- extra Attack %
    defense = 5, -- defence %
    extraDefense = 10, -- extra defence %
    armor = 5, -- armor %
    hitChance = 5, -- hit chance %
}

-- // do not touch // -- 
-- Upgrading system v.3.1 by Azi [Ersiu] Edited by Captain2009 --
local upgrading = {
    upValue = function (value, level, parcent)
        if(not(value>0))then return 0 end 
        for i=1,level do
            value = math.ceil(((value/100)*parcent)+value)+1
        end
        return (value > 0) and value or 0
    end,

    getLevel = function (item)
        local name = string.explode(getItemName(item), '+')
        return (#name == 1) and 0 or math.abs(name[2])
    end,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local getItem = getItemInfo(itemEx.itemid)
    if((getItem.weaponType > 0 or getItem.armor > 0) and not isItemStackable(itemEx.itemid))then
        local level = upgrading.getLevel(itemEx.uid)
        if(level < #conf["level"])then
            local nLevel = (conf["level"][(level+1)].successParcent >= math.random(1,100)) and (level+1) or conf["level"][level].downrageLevel
            if(nLevel > level)then
                doSendMagicEffect(toPosition, 30)
                doPlayerSendTextMessage(cid, 22, "Udalo sie! Przedmiot zyskal na mocy")
            else
                doSendMagicEffect(toPosition, 2)
                doPlayerSendTextMessage(cid, 22, "Cholera, nie udalo sie... przedmiot stracil troche mocy!")
            end
            doItemSetAttribute(itemEx.uid, "name", getItem.name..((nLevel>0) and " +"..nLevel or "")) 
            doItemSetAttribute(itemEx.uid, "attack",  upgrading.upValue(getItem.attack, nLevel, conf["upgrade"].attack))
            doItemSetAttribute(itemEx.uid, "extraattack", upgrading.upValue(getItem.extraAttack, nLevel, conf["upgrade"].extraAttack))
            doItemSetAttribute(itemEx.uid, "defense", upgrading.upValue(getItem.defense,nLevel, conf["upgrade"].defense))
            doItemSetAttribute(itemEx.uid, "extradefense", upgrading.upValue(getItem.extraDefense, nLevel, conf["upgrade"].extraDefense))
            doItemSetAttribute(itemEx.uid, "armor", upgrading.upValue(getItem.armor, nLevel, conf["upgrade"].armor))
            doItemSetAttribute(itemEx.uid, "hitChance", upgrading.upValue(getItem.hitChance,nLevel, conf["upgrade"].hitChance))
            doRemoveItem(item.uid, 1)
        else
            doPlayerSendTextMessage(cid, 19, "Przykro mi ten item ma juz max level.")
        end
    else
        doPlayerSendTextMessage(cid, 19, "Tego itemu nie da sie ulepszyc.")
    end
end

@3 Down
Spoko dzi?ki ;) poczekam je?li trzeba ;D
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

Typ: talkactions
Opis: Skrypt ma na sta?e zmieni? profesje i je?li to mo?liwe outfit.
Dodatkowe: Dodam, ?e ma dzia?a? na silniku tfs pod 8.11. Z g?ry dzi?ki ;)
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ: actions
Opis: pobralem castle war z otlandu brakuje tam tylko jednego skryptu kt?ry ma za zadanie sprawdzi? czy gidia gracza kt?ry chce wej?? na dana kratk? ma odpowiednie unique id , je?li niema to nie b?dzie m?g? wej?? na t? kratk?.(tak jest je?li dobrze zrozumia?em ten system)

edit
moze teraz zrozumiesz
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

Typ: talkactions
Opis: Skrypt ma na sta?e zmieni? profesje i je?li to mo?liwe outfit.
Dodatkowe: Dodam, ?e ma dzia?a? na silniku tfs pod 8.11. Z g?ry dzi?ki ;)
W data/creaturescripts/scripts stw?rz plik o nazwie out.lua i wklej:
PHP:
local storage = 4135
function onOutfit(cid, old, current)
    if getPlayerStorageValue(cid, storage) == 1 then
        doPlayerSendCancel(cid, "Sorry, not possible.")
        return false
    end
    return true
end
Do creaturescripts.xml wklej:
PHP:
<event type="outfit" name="Ot" event="script" value="out.lua"/>
Do login.lua wklej:
PHP:
if getPlayerStorageValue(cid, storage) == 1 then
	doCreatureChangeOutfit(cid, {lookType = 120, lookBody = 0, lookHead = 0, lookLegs = 0, lookFeet = 0})
end
registerCreatureEvent(cid, 'Ot')
Id? teraz do data/talkactions/scripts i stw?rz plik o nazwie ot.lua i wklej:
PHP:
local storage = 4135
local cfg = { 
            new_voc = 6,
            outfit = {lookType = 120, lookBody = 0, lookHead = 0, lookLegs = 0, lookFeet = 0}
            }
function onSay(cid, words, param) 
if param == '' then
	if getPlayerVocation(cid) ~= cfg.new_voc and getPlayerStorageValue(cid, storage) ~= 1 then
		doPlayerSetVocation(cid, 5)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_YELLOW)
		doCreatureChangeOutfit(cid, cfg.outfit)
		setPlayerStorageValue(cid, storage, 1)
	else
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
	end
end 
return true 
end
Do talkactions.xml wklej:
PHP:
<talkaction words="!Ieo" script="ot.lua"/>
Teraz id? do data/XML/vocation.xml i przy wszystkich profesjach ustaw fromvoc na takie jaki numer ma dana profesja. Dla knighta 4, palla 3 itd.


#3up
Mo?liwe do wykonania, ale zajmie mi to mn?stwo czasu. Musisz poczeka?.

#up
Nic z tego nie zrozumia?em... Plus link uszkodzony.
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

Typ: talkactions chyba ;)
Opis: Teleportuje nas losowo dwie kratki w prz?d, ty? albo bok. NIE mo?e teleportowa? do domk?w graczy i jak si? da to niech nie teleportuje na wod? ;)
Dodatkowe: Bardzo dzi?kuj? za ostatni skrypt, teraz prosz? o ten i z g?ry dzi?kuj? ^^
(silnik 0.2.13.866 pod tibie 8.11 - nie wiem czy to ma jakie? znaczenie, ale napisa?em dla pewno?ci)


@down
Dzi?kuje mistrzu ! ;D nie spodziewa?em si? ?e to takie kr?tkie O.o
a da?oby rade zrobi? tak, ze w miejscu z ktorego nas teleportowa?o pojawia si? jaki? efekt, np. 19?
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

PHP:
function onSay(cid, words, param)
local pos, poss = getCreaturePosition(cid), getCreaturePosition(cid)
local rands = {-2,2}
if math.random(0,1) == 0 then
	pos.x = pos.x + rands[math.random(1,#rands)]
else
	pos.y = pos.y + rands[math.random(1,#rands)]
end
if param == '' then
	doSendMagicEffect(poss, 19)
	local fer = getClosestFreeTile(cid, pos, false, false)
	doTeleportThing(cid, fer)
end 
return true 
end
 
Ostatnia edycja:
Odp: Support Scripts - tworzymy/naprawiamy

Typ - Chyba CreatureEvent
Opis - Chodzi mi o to, ?e gdy zabijemy danego potwora to nie zostaje dead tylko w bp pojawia sie dany item, i ?eby by?o lepiej to aby ten item tylko raz wylatywa?.
Dodatkowe - Co? w stylu "MonsterQuest"
 
Odp: Support Scripts - tworzymy/naprawiamy

W data/creaturescripts/scripts zr?b plik i wklej do niego:
PHP:
local cfg = {
			item = 2472,
			ile = 1,
			storage = 1242
			}

function onDeath(cid, corpse, deathList)
if isMonster(cid) and getPlayerStorageValue(deathList[1], cfg.storage) == -1 then
    doRemoveItem(corpse.uid)
    doPlayerAddItem(deathList[1], cfg.item, cfg.ile)
	doPlayerSetStorageValue(deathList[1], cfg.storage, 1)
end
return true
end
Do creaturescripts.xml wklej:
PHP:
<event type="death" name="Ot" event="script" value="nazwa.lua"/>
Do pliku monstera, pod </flags> wklej:
PHP:
	<script>
		<event name="Ot"/>
	</script>
Je?li cia?o nie b?dzie znika? to w pliku monstera usu? corpse.
 
Odp: Support Scripts - tworzymy/naprawiamy

Typ - NPC
Opis - Npc kt?ry daje nam misje my j? wykonujemy i dostajemy items ORAZ naucza nas nowego spellu<spells jest dodany do spells.xml> Tylko funkcja <learnspell..> jako? tak . . ;/ nie wiem jak to zrobi? prosze o pomoc ;/
Dodatkowe - Najlepiej jakby to by?o pod wz?r tego skryptu, tylko doda? tam funkcje aby uczy? nas spellu.

local focus = 0
local talk_start = 0
local target = 0
local following = false
local 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') then

selfSay('Hej!, masz moja tarcze?')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

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



if msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid,8000) == 1 then

selfSay('To nie twoja misja!.')
elseif msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid,2667,5) == 0 then
selfSay('Nie masz tej tarczy!.')

else
if doPlayerAddItem(cid,2151,50) then

setPlayerStorageValue(cid,8000,1)
selfSay('Dzieki! Nauczylem Cie techniki "omote"')
focus = 0
talk_start = 0


end
end
end

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

end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Nastepny prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Zegnaj.')
focus = 0
end
end
end
 
Status
Zamknięty.
Do góry