avatar
Untitled

Guest 165 20th Jan, 2023

MARKUP 5.35 KB
                                           
                         local taskActive = 19000
local tasks =
{
	['rotworm'] = {storage = 19002, experience = 15000, items = 2160, itemcount = 10, premiumpoints = nil, str = "rotworm", count = 20, outfitId = nil, outfitIdfemale = nil, addon = nil},
	['ghoul'] = {storage = 19003, experience = 20000, items = 2160, premiumpoints = 5, str = "ghoul", count = 30, outfitId = nil, outfitIdfemale = nil, addon = nil},
	['warlock'] = {storage = 19004, experience = nil, items = nil, premiumpoints = nil, str = "warlock", count = 800, outfitId = 134, outfitIdfemale = 142, addon = 1},
	['demon'] = {storage = 19005, experience = nil, items = nil, premiumpoints = nil, str = "demon", count = 1600, outfitId = 134, outfitIdfemale = 142, addon = 2},
	['orshabaal'] = {storage = 19006, experience = nil, items = nil, premiumpoints = nil, str = "orshabaal", count = 2400, outfitId = 133, outfitIdfemale = 141, addon = 1},
	['ferumbras'] = {storage = 19007, experience = nil, items = nil, premiumpoints = nil, str = "ferumbras", count = 4800, outfitId = 133, outfitIdfemale = 141, addon = 2},
	['dragon'] = {storage = 19008, experience = nil, items = nil, premiumpoints = nil, str = "dragon", count = 7000, outfitId = 146, outfitIdfemale = 150, addon = 1},
	['dragon lord'] = {storage = 19009, experience = nil, items = nil, premiumpoints = nil, str = "dragon lord", count = 14000, outfitId = 146, outfitIdfemale = 150, addon = 2},
	['hero'] = {storage = 19010, experience = nil, items = nil, premiumpoints = nil, str = "hero", count = 25000, outfitId = 154, outfitIdfemale = 158, addon = 1},
	['lich'] = {storage = 19011, experience = nil, items = nil, premiumpoints = nil, str = "lich", count = 50000, outfitId = 154, outfitIdfemale = 158, addon = 2},
	['wolf'] = {storage = 19012, experience = 4500, items = nil, premiumpoints = nil, str = "wolf", count = 100, outfitId = nil, outfitIdfemale = nil, addon = nil},
	['hunter'] = {storage = 19013, experience = 7500, items = nil, premiumpoints = nil, str = "hunter", count = 250, outfitId = nil, outfitIdfemale = nil, addon = nil},
	['barbaros'] = {storage = 19016, experience = nil, items = nil, premiumpoints = nil, str = "barbaros", count = 5000, outfitId = 152, outfitIdfemale = 156, addon = 2},
	['kalyssa'] = {storage = 19017, experience = nil, items = nil, premiumpoints = nil, str = "kalyssa", count = 10000, outfitId = 152, outfitIdfemale = 156, addon = 1},
	['cyclops'] = {storage = 19018, experience = 50000, items = 2160, itemcount = 10, premiumpoints = nil, str = "cyclops", count = 50, outfitId = nil, outfitIdfemale = nil, addon = nil},
	['hydra'] = {storage = 19018, experience = 150000, items = 2160, itemcount = 10, premiumpoints = nil, str = "cyclops", count = 50, outfitId = 128, outfitIdfemale = 136, addon = 1},
}

local outfits =
{
	[128] = "Citizen",
	[129] = "Hunter",
	[130] = "Mage",
	[131] = "Knight",
	[132] = "Noblewoman",
	[133] = "Summoner",
	[134] = "Warrior",
	[143] = "Barbarian",
	[144] = "Druid",
	[145] = "Wizard",
	[146] = "Oriental",
	[151] = "Pirate",
	[152] = "Assassin",
	[153] = "Beggar",
	[154] = "Shaman",
}





function onKill(cid, target)
	if(getPlayerStorageValue(cid, taskActive) <= 0) then
		return true
	end
	
	local task = tasks[getCreatureName(target):lower()]
	if(not task) then
		return true
	end
	
	if(getPlayerStorageValue(cid, task.storage) <= 0) then
		return true
	end
	
	local tmp = getPlayerStorageValue(cid, (task.storage + 200))
	setPlayerStorageValue(cid, (task.storage + 200), (tmp + 1))
	local tmp = getPlayerStorageValue(cid, (task.storage + 200))
	if(tmp >= task.count) then
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You are completed a " .. task.str .. " task!")

		if(task.outfitId ~= nil) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your reward is " .. (task.addon == 1 and "first" or "second") .. " " .. outfits[task.outfitId]:lower() .. ".")
		doPlayerAddAddon(cid, task.outfitId, task.addon)
		doPlayerAddAddon(cid, task.outfitIdfemale, task.addon)
		end

		
		if(task.premiumpoints ~= nil) then
			db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + task.premiumpoints WHERE `id` = " .. getAccountIdByName(getCreatureName(cid)) .. ";")
		end
		
		if(task.experience ~= nil) then
			doPlayerAddExp(cid, task.experience)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your reward is " .. task.experience .. " experiance.")
		end
		
		if(task.items ~= nil) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your reward is " .. getItemName(items,task) .. " experiance.")
			doPlayerAddItem(cid,task.items,task.itemcount)
		end
	
		local taskEnd = math.max(0, task.storage + 400)
		setPlayerStorageValue(cid, task.storage, 0)
		setPlayerStorageValue(cid, taskEnd, 1)
		setPlayerStorageValue(cid, taskActive, 0)
	end
	
	return true
end
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM