Witam pom?g?by mi kto? zmieni? skrypt tak aby dawa? on Crystal Coins [ID ustawienie i ile ma dawac] + chcia?bym aby dany task dawal takze ITEM [ID do ustawienia]
KOD:
KOD:
Code:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
talk_state = 0
local tasks = {
{name = "Rotworm", count = 5, exp = 1000, gp = 0, itemid = 2160, itemcnt = 2},
{name = "Hero", count = 20, exp = 1250, gp = 1000, itemid = 2160, itemcnt = 0},
{name = "Dragon", count = 30, exp = 700, gp = 200, itemid = 2160, itemcnt = 2},
{name = "Dragon Lord", count = 40, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Demon", count = 50, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Ots King", count = 80 , exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Wise Man", count = 300, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Adobe", count = 500, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Crazy", count = 700, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Glacius", count = 1000, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Moras De Greg", count = 1200, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Farenthid", count = 1500, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0},
{name = "Zanur", count = 2000, exp = 2000, gp = 3775, itemid = 2160, itemcnt = 0}
}
local ilosc_taskow = 13
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Dowidzenia.')
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('Witam ' .. creatureGetName(cid) .. '! Potrzebuje twojej pomocy musisz zabic kilka potworow. A wzamian dostaniesz ciekawe nagrody wystarczy wpisac \"task\". a jezeli ukonczysz zadanie wystarczy wpisz \"report\".')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! Mowie do ciebie za chwile.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'task') then
local task_counter = getPlayerStorageValue(cid,123456)
if task_counter == -1 then
setPlayerStorageValue(cid,123456,1)
end
local task_counter = getPlayerStorageValue(cid,123456)
if task_counter > ilosc_taskow then
selfSay('Wykoanles wszystkie juz zadania ('..(task_counter-1)..'). \n Czy chcialbys wykonac je jeszcze raz?')
talk_state = 1
else
setPlayerTaskMonster(cid,tasks[task_counter].name)
setPlayerTaskMax(cid,tasks[task_counter].count)
if getPlayerStorageValue(cid,1234567) == 0 then
selfSay(' Nie tak szybko '..creatureGetName(cid)..'! Musisz ukonczysz poprzednie zadanie, aby otrzymac kolejne zadanie. jezeli wykonales zadanie napisz \"report\" to do mnie.')
else
selfSay(' To twoje '..task_counter..' Zadanie. Musisz zabic '..tasks[task_counter].count..' '..(string.lower(tasks[task_counter].name))..'s. \"Report\" wroc do mnie, gdy tylko zabijes wymagana ilosc potworow.')
setPlayerStorageValue(cid,1234567,0)
end
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
setPlayerStorageValue(cid,123456,1)
selfSay('Jak sobie zyczysz '..creatureGetName(cid)..'. Mozesz teraz zaczac od nowa piszac \"task\".')
talk_state = 0
elseif msgcontains(msg, 'no') and talk_state == 1 then
selfSay('Wracaj jesli zmienisz zdanie drogi graczu.')
talk_state = 0
elseif msgcontains(msg, 'report') then
if getPlayerStorageValue(cid,123456) == -1 then
selfSay('Nie wykonales jeszcze zadnego mojego zadania ktore mam dla ciebie.')
else
if getPlayerTaskCount(cid) >= getPlayerTaskMax(cid) then
local task_counter = getPlayerStorageValue(cid,123456)
if tasks[task_counter].gp >= 1000 then
gpmsg = ""..(tasks[task_counter].gp/1000).."k"
else
gpmsg = ""..(tasks[task_counter].gp).." gp"
end
if tasks[task_counter].itemcnt > 0 then
if tasks[task_counter].itemcnt == 1 then
itemmsg = "."
else
itemmsg = "s."
end
msg = 'Dziekuje Ci bardzo '..creatureGetName(cid)..'. Otrzymujesz '..tasks[task_counter].exp..' doswiadczenie, '..gpmsg..' i '..tasks[task_counter].itemcnt..' '..getItemName(tasks[task_counter].itemid)..itemmsg
else
msg = 'Dziekuje Ci Bardzo '..creatureGetName(cid)..'. Otrzymujesz '..tasks[task_counter].exp..' doswiadczenie i '..gpmsg..''
end
selfSay(msg)
AddRewards(cid,tasks[task_counter].exp, tasks[task_counter].gp, tasks[task_counter].itemid, tasks[task_counter].itemcnt)
setPlayerStorageValue(cid,123456,task_counter+1)
setPlayerTaskCount(cid,0)
setPlayerStorageValue(cid,1234567,1)
setPlayerTaskMonster(cid,"brakTaska")
else
if getPlayerStorageValue(cid,1234567) == 1 then
selfSay('Twoim ostatnim zadaniem bylo zabic '..tasks[getPlayerStorageValue(cid,123456)-1].count..' '..string.lower(tasks[getPlayerStorageValue(cid,123456)-1].name)..'s. \nSay \"task\" aby zdobyc kolejna.')
else
if getPlayerTaskMax(cid) - getPlayerTaskCount(cid) == 1 then
koncowka = ""
else
koncowka = "s"
end
selfSay('Przepraszam '..creatureGetName(cid)..' ale musisz zabic '..(getPlayerTaskMax(cid) - getPlayerTaskCount(cid))..' '..(string.lower(getPlayerTaskMonster(cid)))..koncowka..' wiecej.')
end
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Dowidzenia, ' .. 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('Nastepny Prosze...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Dowidzenia.')
focus = 0
end
end
end