local config = {
{["name"] = "Rat", ["storage"] = 1, ["count"] = 4, }, -- monster name for dung number 1
{["name"] = "bat", ["storage"] = 1, ["count"] = 10}, -- monster name for dung number 2
}
--===============================================================================================
local pos1 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos2 = {x = 1276, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
local pos3 = {x = 1274, y = 1053, z = 7} -- where player will tp after end time
--===============================================================================================
function onKill(cid, target, lastHit)
if isPlayer(target) then
print("onKill...")
return true
end
for i = 1, #config do
if getCreatureName(target):lower() == config[i].name:lower() then
print("first if...")
if getPlayerStorageValue(cid, 242389) == config[i].storage then
print("second if...")
if isInRange(getPlayerPosition(cid), {x = 1099, y = 1008, z = 7}, {x = 1169, y = 1091, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos1)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
end
end end
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 2--------------------------------------------------------------------------------------
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(member, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 8}, {x = 16753, y = 16641, z = 8}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos2)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
end
end end
-----------------------------------------------------------Dung number 3--------------------------------------------------------------------------------------
-----------------------------------------------------------Dung number 3-------------------------------------------------------------------------------------
if getCreatureName(target):lower() == config[i].name:lower() then
if getPlayerStorageValue(member, 242389) == config[i].storage then
if isInRange(getPlayerPosition(cid), {x = 16515, y = 16419, z = 7}, {x = 16753, y = 16641, z = 7}) then -- dung cordintaes up left to down right
setPlayerStorageValue(cid, 242589, getPlayerStorageValue(cid, 242589) + 1)
if getPlayerStorageValue(cid, 242589) < config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed " .. config[i].name .. " [" .. getPlayerStorageValue(cid, 242589) .. " / " .. config[i].count.."]")
elseif getPlayerStorageValue(cid, 242589) == config[i].count then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING," You have killed last " .. config[i].name .. ", go open the chest.")
setPlayerStorageValue(cid,242589,0)--Counting Again
doTeleportThing(cid, pos3)
setPlayerStorageValue(cid, 242389, 0)
doCreatureSetStorage(cid,987272, 0)
end
end
end end
-----------------------------------------------------------End----------------------------------------------------------------------------------------------------
-----------------------------------------------------------End---------------------------------------------------------------------------------------------------
end
end
return true
end