• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua rep++ //onkill error :(

E

Evil Puncker

Guest
can some lua expert analise this script and tell wtf is wrong, everytime I kill a monster that are at config, the server crash with no error at all, please give me some light :(

Lua:
local config = {	
	["carniphila"] = {storage = 9999, mob_storage = 19999, race_name = "carniphilas", begin_storage_value = 1, finished_storage_value = 2, count = 150},
	["crocodile"] = {storage = 9998, mob_storage = 19998, race_name = "crocodiles", begin_storage_value = 3, finished_storage_value = 4, count = 300},
	["tarantula"] = {storage = 9997, mob_storage = 19997, race_name = "tarantulas", begin_storage_value = 5, finished_storage_value = 6, count = 300},
	["stone golem"] = {storage = 9996, mob_storage = 19996, race_name = "stone golems", begin_storage_value = 7, finished_storage_value = 8, count = 200},
	["mammoth"] = {storage = 9995, mob_storage = 19995, race_name = "mammoths", begin_storage_value = 9, finished_storage_value = 10, count = 300},

	["ice golem"] = {storage = 9994, mob_storage = 19994, race_name = "ice golems", begin_storage_value = 11, finished_storage_value = 12, count = 300},

	["quara constrictor scout"] = {storage = 9993, mob_storage = 19993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
	["quara hydromancer scout"] = {storage = 9993, mob_storage = 19992, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
	["quara mantassin scout"] = {storage = 9993, mob_storage = 19991, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
	["quara pincher scout"] = {storage = 9993, mob_storage = 19990, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
	["quara predator scout"] = {storage = 9993, mob_storage = 19989, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
	
	["quara constrictor"] = {storage = 9992, mob_storage = 19988, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
	["quara hydromancer"] = {storage = 9992, mob_storage = 19987, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
	["quara mantassin"] = {storage = 9992, mob_storage = 19986, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
	["quara pincher"] = {storage = 9992, mob_storage = 19985, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
	["quara predator"] = {storage = 9992, mob_storage = 19984, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},

	["fire elemental"] = {storage = 9991, mob_storage = 19983, race_name = "fire elementals", begin_storage_value = 28, finished_storage_value = 29, count = 70},
	["massive fire elemental"] = {storage = 9991, mob_storage = 19982, race_name = "fire elementals", begin_storage_value = 28, finished_storage_value = 29, count = 70},

	["water elemental"] = {storage = 9990, mob_storage = 19981, race_name = "water elementals", begin_storage_value = 30, finished_storage_value = 31, count = 70},
	["massive water elemental"] = {storage = 9990, mob_storage = 19980, race_name = "water elementals", begin_storage_value = 30, finished_storage_value = 31, count = 70},

	["earth elemental"] = {storage = 9989, mob_storage = 19979, race_name = "earth elementals", begin_storage_value = 32, finished_storage_value = 33, count = 70},
	["massive earth elemental"] = {storage = 9989, mob_storage = 19978, race_name = "earth elementals", begin_storage_value = 32, finished_storage_value = 33, count = 70},

	["energy elemental"] = {storage = 9988, mob_storage = 19977, race_name = "energy elementals", begin_storage_value = 34, finished_storage_value = 35, count = 70},
	["massive energy elemental"] = {storage = 9988, mob_storage = 19976, race_name = "energy elementals", begin_storage_value = 34, finished_storage_value = 35, count = 70},
	
	["mutated rat"] = {storage = 9987, mob_storage = 19975, race_name = "mutated rats", begin_storage_value = 13, finished_storage_value = 14, count = 200},
	["giant spider"] = {storage = 9986, mob_storage = 19974, race_name = "giant spiders", begin_storage_value = 15, finished_storage_value = 16, count = 500},

	["hydra"] = {storage = 9985, mob_storage = 19973, race_name = "hydras", begin_storage_value = 17, finished_storage_value = 18, count = 4},
	["sea serpent"] = {storage = 9984, mob_storage = 19972, race_name = "sea serpents", begin_storage_value = 19, finished_storage_value = 20, count = 2000},
	["behemoth"] = {storage = 9983, mob_storage = 19971, race_name = "behemoths", begin_storage_value = 21, finished_storage_value = 22, count = 20},
	["serpent spawn"] = {storage = 9982, mob_storage = 19970, race_name = "serpent spawns", begin_storage_value = 23, finished_storage_value = 24, count = 1500},

	["demon"] = {boss = "no", begin_storage_main_value = 36, finished_storage_main_value = 37, special_storage = 10007, storage = 9981, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1, count = 6666},
	
	--bosses
	["demodras"] = {boss = "yes", special_storage = 10005, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
	["tiquandas revenge"] = {boss = "yes", special_storage = 10006, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
	
	["the snapper"] = {storage = 9998, begin_boss_storage_value = 1, finished_boss_storage_value = 2},
	["hide"] = {storage = 9997, begin_boss_storage_value = 3, finished_boss_storage_value = 4},
	["the bloodtusk"] = {storage = 9995, begin_boss_storage_value = 5, finished_boss_storage_value = 6},
	["shardhead"] = {storage = 9994, begin_boss_storage_value = 7, finished_boss_storage_value = 8},
	["esmeralda"] = {storage = 9987, begin_boss_storage_value = 9, finished_boss_storage_value = 10},
	["the old widow"] = {storage = 9986, begin_boss_storage_value = 11, finished_boss_storage_value = 12},
	["the many"] = {storage = 9985, begin_boss_storage_value = 13, finished_boss_storage_value = 14},
	["leviathan"] = {storage = 9984, begin_boss_storage_value = 15, finished_boss_storage_value = 16},
	["stonecracker"] = {storage = 9983, begin_boss_storage_value = 17, finished_boss_storage_value = 18},
	["the noxious spawn"] = {storage = 9982, begin_boss_storage_value = 19, finished_boss_storage_value = 20},
	["thul"] = {storage = 9992, begin_boss_storage_value = 21, finished_boss_storage_value = 22}
	}
local points = 10002
local main_storage = 10001
local bosses_storage = 10003

function onKill(cid, target)
local mob = config[string.lower(getCreatureName(target))]
if not(mob and isPlayer(target) ~= true) then
	return true
end
local killedMonsters = getPlayerStorageValue(cid, mob.storage)
local mob_storages = getPlayerStorageValue(cid, mob.mob_storage)
local totalpoints = getPlayerStorageValue(cid, points)
if(totalpoints == -1) then
	totalpoints = 0
end
	for k, v in pairs(config) do
		if getPlayerStorageValue(cid, main_storage) == v.begin_storage_value then
			counts = getPlayerStorageValue(cid, v.mob_storage)
			if counts < 0 then
				counts = 0
			end
		end
	end
	for k, v in pairs(config) do
		if mob_storages == -1 then
			if getPlayerStorageValue(cid, main_storage) == v.begin_storage_value then
				doPlayerSetStorageValue(cid, v.mob_storage, 0)
			end
		end
	end
if getPlayerStorageValue(cid, main_storage) == mob.begin_storage_value and counts <= mob.count then
	doPlayerSetStorageValue(cid, mob.mob_storage, getPlayerStorageValue(cid, mob.mob_storage) + 1)
		x = 0
		s = "You killed "
		for k, v in pairs(config) do
			if getPlayerStorageValue(cid, main_storage) == v.begin_storage_value then
				if s ~= "You killed " then
					s = s .. " "
				end
				count = getPlayerStorageValue(cid, v.mob_storage)
				if count < 0 then
					count = 0
				end
				s = s ..count.." " .. k .. ","
				x = x + count
			end
		end
		s = string.sub(s, 1, string.len(s) - 1)..". You have killed " .. x .." of ".. mob.count .." "..mob.race_name.."."
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, s)
		if x == mob.count then 
			doPlayerSetStorageValue(cid, mob.storage, 1)
			doPlayerSetStorageValue(cid, main_storage, mob.finished_storage_value)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..mob.race_name..".")
				if totalpoints < 50 then
					if mob.count < 1500 then
						doPlayerSetStorageValue(cid, points, totalpoints + 1)
						doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")	
					else
						doPlayerSetStorageValue(cid, points, totalpoints + 3)
						doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")	
					end
				end
			for k, v in pairs(config) do
				if x == mob.count then
					if getPlayerStorageValue(cid, main_storage) == v.finished_storage_value then
						if getPlayerStorageValue(cid, v.mob_storage) >= 0 and getPlayerStorageValue(cid, v.storage) >= 0 then
							doPlayerSetStorageValue(cid, v.mob_storage, -1)
						end
					end
				end
			end
			return true
		end
elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_boss_storage_value and killedMonsters == 2 then
	doPlayerSetStorageValue(cid, bosses_storage, mob.finished_boss_storage_value)
	doPlayerSetStorageValue(cid, mob.storage, 3)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
	if totalpoints < 50 then
		doPlayerSetStorageValue(cid, points, totalpoints + 1)
		doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")	
	end
elseif getPlayerStorageValue(cid, mob.special_storage) == mob.begin_special_task_boss_storage_value then
	if mob.boss == "no" then
		if killedMonsters <= mob.count and getPlayerStorageValue(cid, main_storage) == mob.begin_storage_main_value then
			doPlayerSetStorageValue(cid, mob.storage, killedMonsters + 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..getCreatureName(target)..".")
			if getPlayerStorageValue(cid, mob.storage) == mob.count then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target)..".")
				doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
				doPlayerSetStorageValue(cid, storages.main_storage, mob.finished_storage_main_value)
			end
		end
	elseif mob.boss == "yes" then
		if isInArray({-1,0}, killedMonsters) then
			doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
		end
	end	
end
return true
end

the guy who made the script cant help at all, since he dont get any error and i've already reinstalled the script from 0 so many times, but still the error -.-
maybe the error is at this part:

function onKill(cid, target)
local mob = config[string.lower(getCreatureName(target))]
if not(mob and isPlayer(target) ~= true) then


but i dont know
 
Last edited by a moderator:
There is constant that had to be updated for 0.4, but script still crashes because of smth at last part
This is it updated for 0.4:
Lua:
local config = {        
        ["carniphila"] = {storage = 9999, mob_storage = 19999, race_name = "carniphilas", begin_storage_value = 1, finished_storage_value = 2, count = 150},
        ["crocodile"] = {storage = 9998, mob_storage = 19998, race_name = "crocodiles", begin_storage_value = 3, finished_storage_value = 4, count = 300},
        ["tarantula"] = {storage = 9997, mob_storage = 19997, race_name = "tarantulas", begin_storage_value = 5, finished_storage_value = 6, count = 300},
        ["stone golem"] = {storage = 9996, mob_storage = 19996, race_name = "stone golems", begin_storage_value = 7, finished_storage_value = 8, count = 200},
        ["mammoth"] = {storage = 9995, mob_storage = 19995, race_name = "mammoths", begin_storage_value = 9, finished_storage_value = 10, count = 300}, 
        ["ice golem"] = {storage = 9994, mob_storage = 19994, race_name = "ice golems", begin_storage_value = 11, finished_storage_value = 12, count = 300},
        ["quara constrictor scout"] = {storage = 9993, mob_storage = 19993, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ["quara hydromancer scout"] = {storage = 9993, mob_storage = 19992, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ["quara mantassin scout"] = {storage = 9993, mob_storage = 19991, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ["quara pincher scout"] = {storage = 9993, mob_storage = 19990, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ["quara predator scout"] = {storage = 9993, mob_storage = 19989, race_name = "quara scouts", begin_storage_value = 26, finished_storage_value = 27, count = 300},        
        ["quara constrictor"] = {storage = 9992, mob_storage = 19988, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ["quara hydromancer"] = {storage = 9992, mob_storage = 19987, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ["quara mantassin"] = {storage = 9992, mob_storage = 19986, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ["quara pincher"] = {storage = 9992, mob_storage = 19985, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ["quara predator"] = {storage = 9992, mob_storage = 19984, race_name = "quaras", begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ["fire elemental"] = {storage = 9991, mob_storage = 19983, race_name = "fire elementals", begin_storage_value = 28, finished_storage_value = 29, count = 7},
        ["massive fire elemental"] = {storage = 9991, mob_storage = 19982, race_name = "fire elementals", begin_storage_value = 28, finished_storage_value = 29, count = 70}, 
        ["water elemental"] = {storage = 9990, mob_storage = 19981, race_name = "water elementals", begin_storage_value = 30, finished_storage_value = 31, count = 70},
        ["massive water elemental"] = {storage = 9990, mob_storage = 19980, race_name = "water elementals", begin_storage_value = 30, finished_storage_value = 31, count = 70},
        ["earth elemental"] = {storage = 9989, mob_storage = 19979, race_name = "earth elementals", begin_storage_value = 32, finished_storage_value = 33, count = 70},
        ["massive earth elemental"] = {storage = 9989, mob_storage = 19978, race_name = "earth elementals", begin_storage_value = 32, finished_storage_value = 33, count = 70},
        ["energy elemental"] = {storage = 9988, mob_storage = 19977, race_name = "energy elementals", begin_storage_value = 34, finished_storage_value = 35, count = 70},
        ["massive energy elemental"] = {storage = 9988, mob_storage = 19976, race_name = "energy elementals", begin_storage_value = 34, finished_storage_value = 35, count = 70},
        ["mutated rat"] = {storage = 9987, mob_storage = 19975, race_name = "mutated rats", begin_storage_value = 13, finished_storage_value = 14, count = 200},
        ["giant spider"] = {storage = 9986, mob_storage = 19974, race_name = "giant spiders", begin_storage_value = 15, finished_storage_value = 16, count = 500},
        ["hydra"] = {storage = 9985, mob_storage = 19973, race_name = "hydras", begin_storage_value = 17, finished_storage_value = 18, count = 7},
        ["sea serpent"] = {storage = 9984, mob_storage = 19972, race_name = "sea serpents", begin_storage_value = 19, finished_storage_value = 20, count = 2000},
        ["behemoth"] = {storage = 9983, mob_storage = 19971, race_name = "behemoths", begin_storage_value = 21, finished_storage_value = 22, count = 20},
        ["serpent spawn"] = {storage = 9982, mob_storage = 19970, race_name = "serpent spawns", begin_storage_value = 23, finished_storage_value = 24, count = 1500},
        ["demon"] = {boss = "no", begin_storage_main_value = 36, finished_storage_main_value = 37, special_storage = 10007, storage = 9981, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1, count = 6666},
        --bosses
        ["demodras"] = {boss = "yes", special_storage = 10005, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
        ["tiquandas revenge"] = {boss = "yes", special_storage = 10006, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},        
        ["the snapper"] = {storage = 9978, begin_boss_storage_value = 1, finished_boss_storage_value = 2},
        ["hide"] = {storage = 9977, begin_boss_storage_value = 3, finished_boss_storage_value = 4},
        ["the bloodtusk"] = {storage = 9976, begin_boss_storage_value = 5, finished_boss_storage_value = 6},
        ["shardhead"] = {storage = 9975, begin_boss_storage_value = 7, finished_boss_storage_value = 8},
        ["esmeralda"] = {storage = 9973, begin_boss_storage_value = 9, finished_boss_storage_value = 10},
        ["the old widow"] = {storage = 9972, begin_boss_storage_value = 11, finished_boss_storage_value = 12},
        ["the many"] = {storage = 9971, begin_boss_storage_value = 13, finished_boss_storage_value = 14},
        ["leviathan"] = {storage = 9970, begin_boss_storage_value = 15, finished_boss_storage_value = 16},
        ["stonecracker"] = {storage = 9969, begin_boss_storage_value = 17, finished_boss_storage_value = 18},
        ["the noxious spawn"] = {storage = 9968, begin_boss_storage_value = 19, finished_boss_storage_value = 20},
        ["thul"] = {storage = 9974, begin_boss_storage_value = 21, finished_boss_storage_value = 22}
        }
local points = 10002
local main_storage = 10001
local bosses_storage = 10003
 
function onKill(cid, target, damage, flags)
	local mob = config[string.lower(getCreatureName(target))]
	if not mob or not isMonster(target) then
		return true
	end
	local killedMonsters = getPlayerStorageValue(cid, mob.storage)
	local mob_storages = getPlayerStorageValue(cid, mob.mob_storage)
	local totalpoints = getPlayerStorageValue(cid, points)
	if(totalpoints == -1) then
		totalpoints = 0
	end
	for k, v in pairs(config) do
		if isInArray({-1,0}, killedMonsters) or mob_storages == -1 then
			if getPlayerStorageValue(cid, main_storage) == v.begin_storage_value then
				doPlayerSetStorageValue(cid, v.mob_storage, 0)
				doPlayerSetStorageValue(cid, v.storage, 0)
			end
		end
	end
	if getPlayerStorageValue(cid, main_storage) == mob.begin_storage_value and killedMonsters <= mob.count then
		doPlayerSetStorageValue(cid, mob.storage, getPlayerStorageValue(cid, mob.storage) + 1)
		doPlayerSetStorageValue(cid, mob.mob_storage, getPlayerStorageValue(cid, mob.mob_storage) + 1)
		x = 0
		s = "You killed "
		for k, v in pairs(config) do
			if getPlayerStorageValue(cid, main_storage) == v.begin_storage_value then
				if s ~= "You killed " then
					s = s .. " "
				end
				count = getPlayerStorageValue(cid, v.mob_storage)
				if count < 0 then
					count = 0
				end
				s = s ..count.." " .. k .. ","
				x = x + count
			end
		end
		s = string.sub(s, 1, string.len(s) - 1)..". You have killed " .. x .." of ".. mob.count .." "..mob.race_name.."."
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, s)
		if getPlayerStorageValue(cid, mob.storage) == mob.count then 
			doPlayerSetStorageValue(cid, main_storage, mob.finished_storage_value)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..mob.race_name..".")
			if totalpoints < 50 then
				if mob.count < 1500 then
					doPlayerSetStorageValue(cid, points, totalpoints + 1)
					doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, "Your total points is "..getPlayerStorageValue(cid, points)..".")   
				else
					doPlayerSetStorageValue(cid, points, totalpoints + 3)
					doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, "Your total points is "..getPlayerStorageValue(cid, points)..".")   
				end
			end
			for k, v in pairs(config) do
				if getPlayerStorageValue(cid, mob.storage) == mob.count then
					if getPlayerStorageValue(cid, main_storage) == v.finished_storage_value then
						if getPlayerStorageValue(cid, v.mob_storage) >= 0 and getPlayerStorageValue(cid, v.storage) >= 0 then
							doPlayerSetStorageValue(cid, v.mob_storage, -1)
							doPlayerSetStorageValue(cid, v.storage, -1)
						end
					end
				end
			end
			return true
		end
	elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_boss_storage_value and isInArray({-1,0}, killedMonsters) then
		doPlayerSetStorageValue(cid, bosses_storage, mob.finished_boss_storage_value)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
		if totalpoints < 50 then
			doPlayerSetStorageValue(cid, points, totalpoints + 1)
			doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, "Your total points is "..getPlayerStorageValue(cid, points)..".")   
		end
	elseif getPlayerStorageValue(cid, mob.special_storage) == mob.begin_special_task_boss_storage_value then
		if mob.boss == "no" then
			if killedMonsters <= mob.count and getPlayerStorageValue(cid, main_storage) == mob.begin_storage_main_value then
				doPlayerSetStorageValue(cid, mob.storage, killedMonsters + 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..getCreatureName(target)..".")
				if getPlayerStorageValue(cid, mob.storage) == mob.count then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target)..".")
					doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
					doPlayerSetStorageValue(cid, storages.main_storage, mob.finished_storage_main_value)
				end
			end
		elseif mob.boss == "yes" then
			if isInArray({-1,0}, killedMonsters) then
				doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
			end
		end     
	end
	return true
end
Now, problem is somewhere here:
Lua:
	elseif getPlayerStorageValue(cid, mob.special_storage) == mob.begin_special_task_boss_storage_value then
		if mob.boss == "no" then
			if killedMonsters <= mob.count and getPlayerStorageValue(cid, main_storage) == mob.begin_storage_main_value then
				doPlayerSetStorageValue(cid, mob.storage, killedMonsters + 1)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..getCreatureName(target)..".")
				if getPlayerStorageValue(cid, mob.storage) == mob.count then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target)..".")
					doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
					doPlayerSetStorageValue(cid, storages.main_storage, mob.finished_storage_main_value)
				end
			end
		elseif mob.boss == "yes" then
			if isInArray({-1,0}, killedMonsters) then
				doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
			end
		end     
	end
 
test:
Lua:
local config = {        
        ['carniphila'] = {storage = 9999, mob_storage = 19999, race_name = 'carniphilas', begin_storage_value = 1, finished_storage_value = 2, count = 150},
        ['crocodile'] = {storage = 9998, mob_storage = 19998, race_name = 'crocodiles', begin_storage_value = 3, finished_storage_value = 4, count = 300},
        ['tarantula'] = {storage = 9997, mob_storage = 19997, race_name = 'tarantulas', begin_storage_value = 5, finished_storage_value = 6, count = 300},
        ['stone golem'] = {storage = 9996, mob_storage = 19996, race_name = 'stone golems', begin_storage_value = 7, finished_storage_value = 8, count = 200},
        ['mammoth'] = {storage = 9995, mob_storage = 19995, race_name = 'mammoths', begin_storage_value = 9, finished_storage_value = 10, count = 300}, 
        ['ice golem'] = {storage = 9994, mob_storage = 19994, race_name = 'ice golems', begin_storage_value = 11, finished_storage_value = 12, count = 300},
        ['quara constrictor scout'] = {storage = 9993, mob_storage = 19993, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara hydromancer scout'] = {storage = 9993, mob_storage = 19992, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara mantassin scout'] = {storage = 9993, mob_storage = 19991, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara pincher scout'] = {storage = 9993, mob_storage = 19990, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara predator scout'] = {storage = 9993, mob_storage = 19989, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},        
        ['quara constrictor'] = {storage = 9992, mob_storage = 19988, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara hydromancer'] = {storage = 9992, mob_storage = 19987, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara mantassin'] = {storage = 9992, mob_storage = 19986, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara pincher'] = {storage = 9992, mob_storage = 19985, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara predator'] = {storage = 9992, mob_storage = 19984, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['fire elemental'] = {storage = 9991, mob_storage = 19983, race_name = 'fire elementals', begin_storage_value = 28, finished_storage_value = 29, count = 7},
        ['massive fire elemental'] = {storage = 9991, mob_storage = 19982, race_name = 'fire elementals', begin_storage_value = 28, finished_storage_value = 29, count = 70}, 
        ['water elemental'] = {storage = 9990, mob_storage = 19981, race_name = 'water elementals', begin_storage_value = 30, finished_storage_value = 31, count = 70},
        ['massive water elemental'] = {storage = 9990, mob_storage = 19980, race_name = 'water elementals', begin_storage_value = 30, finished_storage_value = 31, count = 70},
        ['earth elemental'] = {storage = 9989, mob_storage = 19979, race_name = 'earth elementals', begin_storage_value = 32, finished_storage_value = 33, count = 70},
        ['massive earth elemental'] = {storage = 9989, mob_storage = 19978, race_name = 'earth elementals', begin_storage_value = 32, finished_storage_value = 33, count = 70},
        ['energy elemental'] = {storage = 9988, mob_storage = 19977, race_name = 'energy elementals', begin_storage_value = 34, finished_storage_value = 35, count = 70},
        ['massive energy elemental'] = {storage = 9988, mob_storage = 19976, race_name = 'energy elementals', begin_storage_value = 34, finished_storage_value = 35, count = 70},
        ['mutated rat'] = {storage = 9987, mob_storage = 19975, race_name = 'mutated rats', begin_storage_value = 13, finished_storage_value = 14, count = 200},
        ['giant spider'] = {storage = 9986, mob_storage = 19974, race_name = 'giant spiders', begin_storage_value = 15, finished_storage_value = 16, count = 500},
        ['hydra'] = {storage = 9985, mob_storage = 19973, race_name = 'hydras', begin_storage_value = 17, finished_storage_value = 18, count = 7},
        ['sea serpent'] = {storage = 9984, mob_storage = 19972, race_name = 'sea serpents', begin_storage_value = 19, finished_storage_value = 20, count = 2000},
        ['behemoth'] = {storage = 9983, mob_storage = 19971, race_name = 'behemoths', begin_storage_value = 21, finished_storage_value = 22, count = 20},
        ['serpent spawn'] = {storage = 9982, mob_storage = 19970, race_name = 'serpent spawns', begin_storage_value = 23, finished_storage_value = 24, count = 1500},

        --bosses
        ['demon'] = {boss = 'no', begin_storage_main_value = 36, finished_storage_main_value = 37, special_storage = 10007, storage = 9981, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1, count = 6666},
        ['demodras'] = {boss = 'yes', special_storage = 10005, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
        ['tiquandas revenge'] = {boss = 'yes', special_storage = 10006, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},        
        
		['the snapper'] = {storage = 9978, begin_boss_storage_value = 1, finished_boss_storage_value = 2},
        ['hide'] = {storage = 9977, begin_boss_storage_value = 3, finished_boss_storage_value = 4},
        ['the bloodtusk'] = {storage = 9976, begin_boss_storage_value = 5, finished_boss_storage_value = 6},
        ['shardhead'] = {storage = 9975, begin_boss_storage_value = 7, finished_boss_storage_value = 8},
        ['esmeralda'] = {storage = 9973, begin_boss_storage_value = 9, finished_boss_storage_value = 10},
        ['the old widow'] = {storage = 9972, begin_boss_storage_value = 11, finished_boss_storage_value = 12},
        ['the many'] = {storage = 9971, begin_boss_storage_value = 13, finished_boss_storage_value = 14},
        ['leviathan'] = {storage = 9970, begin_boss_storage_value = 15, finished_boss_storage_value = 16},
        ['stonecracker'] = {storage = 9969, begin_boss_storage_value = 17, finished_boss_storage_value = 18},
        ['the noxious spawn'] = {storage = 9968, begin_boss_storage_value = 19, finished_boss_storage_value = 20},
        ['thul'] = {storage = 9974, begin_boss_storage_value = 21, finished_boss_storage_value = 22}
	}

local points = 10002
local main_storage = 10001
local bosses_storage = 10003
 
function onKill(cid, target, damage, flags)
	local mob = config[string.lower(getCreatureName(target))]
	if not mob or not isMonster(target) then
		return true
	end
	local killedMonsters = getCreatureStorage(cid, mob.storage)
	
	local totalpoints = getCreatureStorage(cid, points)
	if(totalpoints == -1) then
		totalpoints = 0
	end
	
	if mob.begin_boss_storage_value == nil or finished_special_task_boss_storage_value == nil then
		local mob_storages = getCreatureStorage(cid, mob.mob_storage)
		for k, v in pairs(config) do
			if isInArray({-1,0}, killedMonsters) or mob_storages == -1 then
				if getCreatureStorage(cid, main_storage) == v.begin_storage_value then
					doCreatureSetStorage(cid, v.mob_storage, 0)
					doCreatureSetStorage(cid, v.storage, 0)
				end
			end
		end
		if getCreatureStorage(cid, main_storage) == mob.begin_storage_value and killedMonsters <= mob.count then
			doCreatureSetStorage(cid, mob.storage, getCreatureStorage(cid, mob.storage) + 1)
			doCreatureSetStorage(cid, mob.mob_storage, getCreatureStorage(cid, mob.mob_storage) + 1)
			x = 0
			s = 'You killed '
			for k, v in pairs(config) do
				if getCreatureStorage(cid, main_storage) == v.begin_storage_value then
					if s ~= 'You killed ' then
						s = s .. ' '
					end
					count = getCreatureStorage(cid, v.mob_storage)
					if count < 0 then
						count = 0
					end
					s = s ..count..' ' .. k .. ','
					x = x + count
				end
			end
			s = string.sub(s, 1, string.len(s) - 1)..'. You have killed ' .. x ..' of '.. mob.count ..' '..mob.race_name..'.'
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, s)
			if getCreatureStorage(cid, mob.storage) == mob.count then 
				doCreatureSetStorage(cid, main_storage, mob.finished_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed enough '..mob.race_name..'.')
				if totalpoints < 50 then
					if mob.count < 1500 then
						doCreatureSetStorage(cid, points, totalpoints + 1)
						doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, 'Your total points is '..getCreatureStorage(cid, points)..'.')   
					else
						doCreatureSetStorage(cid, points, totalpoints + 3)
						doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, 'Your total points is '..getCreatureStorage(cid, points)..'.')   
					end
				end
				for k, v in pairs(config) do
					if getCreatureStorage(cid, mob.storage) == mob.count then
						if getCreatureStorage(cid, main_storage) == v.finished_storage_value then
							if getCreatureStorage(cid, v.mob_storage) >= 0 and getCreatureStorage(cid, v.storage) >= 0 then
								doCreatureSetStorage(cid, v.mob_storage, -1)
								doCreatureSetStorage(cid, v.storage, -1)
							end
						end
					end
				end
				return true
			end
		elseif mob.boss == nil then --kkk
			if getCreatureStorage(cid, bosses_storage) == mob.begin_boss_storage_value and isInArray({-1,0}, killedMonsters) then
				doCreatureSetStorage(cid, bosses_storage, mob.finished_boss_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed '..getCreatureName(target)..'.')
				if totalpoints < 50 then
					doCreatureSetStorage(cid, points, totalpoints + 1)
					doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, 'Your total points is '..getCreatureStorage(cid, points)..'.')   
				end
			end
		elseif mob.boss ~= nil then --kkk				        
			if mob.boss == 'no' then
				if killedMonsters <= mob.count and getCreatureStorage(cid, main_storage) == mob.begin_storage_main_value then
					doCreatureSetStorage(cid, mob.storage, killedMonsters + 1)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have killed '..getCreatureStorage(cid, mob.storage)..' of '..mob.count..' '..getCreatureName(target)..'.')
					if getCreatureStorage(cid, mob.storage) == mob.count then
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed enough '..getCreatureName(target)..'.')
						doCreatureSetStorage(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
						doCreatureSetStorage(cid, storages.main_storage, mob.finished_storage_main_value)
					end
				end
			elseif mob.boss == 'yes' then
				if isInArray({-1,0}, killedMonsters) then
					doCreatureSetStorage(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed '..getCreatureName(target)..'.')
				end
			end     
		end 
    end
	return true
end
script crashes ot because for some monsters some table values are null
 
Lua:
getPlayerStorageValue = getCreatureStorage
TFS 0.4
I changed it because I'm now used to it, but that does not affect the script at all since both ones work the same :p I changed other things
 
now the script is working, but if I kill one monster without talking to npc i get alot of buffer errors and the monster does not die

Lua:
local config = {        
        ['carniphila'] = {storage = 9999, mob_storage = 19999, race_name = 'carniphilas', begin_storage_value = 1, finished_storage_value = 2, count = 150},
        ['crocodile'] = {storage = 9998, mob_storage = 19998, race_name = 'crocodiles', begin_storage_value = 3, finished_storage_value = 4, count = 300},
        ['tarantula'] = {storage = 9997, mob_storage = 19997, race_name = 'tarantulas', begin_storage_value = 5, finished_storage_value = 6, count = 300},
        ['stone golem'] = {storage = 9996, mob_storage = 19996, race_name = 'stone golems', begin_storage_value = 7, finished_storage_value = 8, count = 200},
        ['mammoth'] = {storage = 9995, mob_storage = 19995, race_name = 'mammoths', begin_storage_value = 9, finished_storage_value = 10, count = 300}, 
        ['ice golem'] = {storage = 9994, mob_storage = 19994, race_name = 'ice golems', begin_storage_value = 11, finished_storage_value = 12, count = 300},
        ['quara constrictor scout'] = {storage = 9993, mob_storage = 19993, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara hydromancer scout'] = {storage = 9993, mob_storage = 19992, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara mantassin scout'] = {storage = 9993, mob_storage = 19991, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara pincher scout'] = {storage = 9993, mob_storage = 19990, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},
        ['quara predator scout'] = {storage = 9993, mob_storage = 19989, race_name = 'quara scouts', begin_storage_value = 26, finished_storage_value = 27, count = 300},        
        ['quara constrictor'] = {storage = 9992, mob_storage = 19988, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara hydromancer'] = {storage = 9992, mob_storage = 19987, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara mantassin'] = {storage = 9992, mob_storage = 19986, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara pincher'] = {storage = 9992, mob_storage = 19985, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['quara predator'] = {storage = 9992, mob_storage = 19984, race_name = 'quaras', begin_storage_value = 24, finished_storage_value = 25, count = 300},
        ['fire elemental'] = {storage = 9991, mob_storage = 19983, race_name = 'fire elementals', begin_storage_value = 28, finished_storage_value = 29, count = 70},
        ['massive fire elemental'] = {storage = 9991, mob_storage = 19982, race_name = 'fire elementals', begin_storage_value = 28, finished_storage_value = 29, count = 70}, 
        ['water elemental'] = {storage = 9990, mob_storage = 19981, race_name = 'water elementals', begin_storage_value = 30, finished_storage_value = 31, count = 70},
        ['massive water elemental'] = {storage = 9990, mob_storage = 19980, race_name = 'water elementals', begin_storage_value = 30, finished_storage_value = 31, count = 70},
        ['earth elemental'] = {storage = 9989, mob_storage = 19979, race_name = 'earth elementals', begin_storage_value = 32, finished_storage_value = 33, count = 70},
        ['massive earth elemental'] = {storage = 9989, mob_storage = 19978, race_name = 'earth elementals', begin_storage_value = 32, finished_storage_value = 33, count = 70},
        ['energy elemental'] = {storage = 9988, mob_storage = 19977, race_name = 'energy elementals', begin_storage_value = 34, finished_storage_value = 35, count = 70},
        ['massive energy elemental'] = {storage = 9988, mob_storage = 19976, race_name = 'energy elementals', begin_storage_value = 34, finished_storage_value = 35, count = 70},
        ['mutated rat'] = {storage = 9987, mob_storage = 19975, race_name = 'mutated rats', begin_storage_value = 13, finished_storage_value = 14, count = 200},
        ['giant spider'] = {storage = 9986, mob_storage = 19974, race_name = 'giant spiders', begin_storage_value = 15, finished_storage_value = 16, count = 500},
        ['hydra'] = {storage = 9985, mob_storage = 19973, race_name = 'hydras', begin_storage_value = 17, finished_storage_value = 18, count = 2000},
        ['sea serpent'] = {storage = 9984, mob_storage = 19972, race_name = 'sea serpents', begin_storage_value = 19, finished_storage_value = 20, count = 2000},
        ['behemoth'] = {storage = 9983, mob_storage = 19971, race_name = 'behemoths', begin_storage_value = 21, finished_storage_value = 22, count = 2000},
        ['serpent spawn'] = {storage = 9982, mob_storage = 19970, race_name = 'serpent spawns', begin_storage_value = 23, finished_storage_value = 24, count = 1500},
 
        --bosses
        ['demon'] = {boss = 'no', begin_storage_main_value = 36, finished_storage_main_value = 37, special_storage = 10007, storage = 9981, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1, count = 6666},
        ['demodras'] = {boss = 'yes', special_storage = 10005, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},
        ['tiquandas revenge'] = {boss = 'yes', special_storage = 10006, begin_special_task_boss_storage_value = 0, finished_special_task_boss_storage_value = 1},        
 
		['the snapper'] = {storage = 9978, begin_boss_storage_value = 1, finished_boss_storage_value = 2},
        ['hide'] = {storage = 9977, begin_boss_storage_value = 3, finished_boss_storage_value = 4},
        ['the bloodtusk'] = {storage = 9976, begin_boss_storage_value = 5, finished_boss_storage_value = 6},
        ['shardhead'] = {storage = 9975, begin_boss_storage_value = 7, finished_boss_storage_value = 8},
        ['esmeralda'] = {storage = 9973, begin_boss_storage_value = 9, finished_boss_storage_value = 10},
        ['the old widow'] = {storage = 9972, begin_boss_storage_value = 11, finished_boss_storage_value = 12},
        ['the many'] = {storage = 9971, begin_boss_storage_value = 13, finished_boss_storage_value = 14},
        ['leviathan'] = {storage = 9970, begin_boss_storage_value = 15, finished_boss_storage_value = 16},
        ['stonecracker'] = {storage = 9969, begin_boss_storage_value = 17, finished_boss_storage_value = 18},
        ['the noxious spawn'] = {storage = 9968, begin_boss_storage_value = 19, finished_boss_storage_value = 20},
        ['thul'] = {storage = 9974, begin_boss_storage_value = 21, finished_boss_storage_value = 22}
	}
 
local points = 10002
local main_storage = 10001
local bosses_storage = 10003
 
function onKill(cid, target, damage, flags)
	local mob = config[string.lower(getCreatureName(target))]
	if not mob or not isMonster(target) then
		return true
	end
	local killedMonsters = getCreatureStorage(cid, mob.storage)
 
	local totalpoints = getCreatureStorage(cid, points)
	if(totalpoints == -1) then
		totalpoints = 0
	end
 
	if mob.begin_boss_storage_value == nil or finished_special_task_boss_storage_value == nil then
		local mob_storages = getCreatureStorage(cid, mob.mob_storage)
		for k, v in pairs(config) do
			if isInArray({-1,0}, killedMonsters) or mob_storages == -1 then
				if getCreatureStorage(cid, main_storage) == v.begin_storage_value then
					doCreatureSetStorage(cid, v.mob_storage, 0)
					doCreatureSetStorage(cid, v.storage, 0)
				end
			end
		end
		if getCreatureStorage(cid, main_storage) == mob.begin_storage_value and killedMonsters <= mob.count then
			doCreatureSetStorage(cid, mob.storage, getCreatureStorage(cid, mob.storage) + 1)
			doCreatureSetStorage(cid, mob.mob_storage, getCreatureStorage(cid, mob.mob_storage) + 1)
			x = 0
			s = 'You killed '
			for k, v in pairs(config) do
				if getCreatureStorage(cid, main_storage) == v.begin_storage_value then
					if s ~= 'You killed ' then
						s = s .. ' '
					end
					count = getCreatureStorage(cid, v.mob_storage)
					if count < 0 then
						count = 0
					end
					s = s ..count..' ' .. k .. ','
					x = x + count
				end
			end
			s = string.sub(s, 1, string.len(s) - 1)..'. You have killed ' .. x ..' of '.. mob.count ..' '..mob.race_name..'.'
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, s)
			if getCreatureStorage(cid, mob.storage) == mob.count then 
				doCreatureSetStorage(cid, main_storage, mob.finished_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed enough '..mob.race_name..'.')
				if totalpoints < 50 then
					if mob.count < 1500 then
						doCreatureSetStorage(cid, points, totalpoints + 1)
						doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, 'Your total points is '..getCreatureStorage(cid, points)..'.')   
					else
						doCreatureSetStorage(cid, points, totalpoints + 3)
						doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, 'Your total points is '..getCreatureStorage(cid, points)..'.')   
					end
				end
				for k, v in pairs(config) do
					if getCreatureStorage(cid, v.storage) == mob.count then
						if getCreatureStorage(cid, main_storage) == v.finished_storage_value then
							if getCreatureStorage(cid, v.mob_storage) >= 0 and getCreatureStorage(cid, v.storage) >= 0 then
								doCreatureSetStorage(cid, v.mob_storage, -1)
								doCreatureSetStorage(cid, v.storage, -1)
							end
						end
					end
				end
				return true
			end
		elseif mob.boss == nil then --kkk
			if getCreatureStorage(cid, bosses_storage) == mob.begin_boss_storage_value and isInArray({-1,0}, killedMonsters) then
				doCreatureSetStorage(cid, bosses_storage, mob.finished_boss_storage_value)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed '..getCreatureName(target)..'.')
				if totalpoints < 50 then
					doCreatureSetStorage(cid, points, totalpoints + 1)
					doPlayerSendTextMessage(cid, TALKTYPE_MONSTER, 'Your total points is '..getCreatureStorage(cid, points)..'.')   
				end
			end
		elseif mob.boss ~= nil then --kkk				        
			if mob.boss == 'no' then
				if killedMonsters <= mob.count and getCreatureStorage(cid, main_storage) == mob.begin_storage_main_value then
					doCreatureSetStorage(cid, mob.storage, killedMonsters + 1)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have killed '..getCreatureStorage(cid, mob.storage)..' of '..mob.count..' '..getCreatureName(target)..'.')
					if getCreatureStorage(cid, mob.storage) == mob.count then
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed enough '..getCreatureName(target)..'.')
						doCreatureSetStorage(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
						doCreatureSetStorage(cid, storages.main_storage, mob.finished_storage_main_value)
					end
				end
			elseif mob.boss == 'yes' then
				if isInArray({-1,0}, killedMonsters) then
					doCreatureSetStorage(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have killed '..getCreatureName(target)..'.')
				end
			end     
		end 
    end
	return true
end
 
Last edited by a moderator:
Delete this:
PHP:
elseif getPlayerStorageValue(cid, bosses_storage) == mob.begin_boss_storage_value and killedMonsters == 2 then
	doPlayerSetStorageValue(cid, bosses_storage, mob.finished_boss_storage_value)
	doPlayerSetStorageValue(cid, mob.storage, 3)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
	if totalpoints < 50 then
		doPlayerSetStorageValue(cid, points, totalpoints + 1)
		doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "Your total points is "..getPlayerStorageValue(cid, points)..".")	
	end
elseif getPlayerStorageValue(cid, mob.special_storage) == mob.begin_special_task_boss_storage_value then
	if mob.boss == "no" then
		if killedMonsters <= mob.count and getPlayerStorageValue(cid, main_storage) == mob.begin_storage_main_value then
			doPlayerSetStorageValue(cid, mob.storage, killedMonsters + 1)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have killed "..getPlayerStorageValue(cid, mob.storage).." of "..mob.count.." "..getCreatureName(target)..".")
			if getPlayerStorageValue(cid, mob.storage) == mob.count then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed enough "..getCreatureName(target)..".")
				doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
				doPlayerSetStorageValue(cid, storages.main_storage, mob.finished_storage_main_value)
			end
		end
	elseif mob.boss == "yes" then
		if isInArray({-1,0}, killedMonsters) then
			doPlayerSetStorageValue(cid, mob.special_storage, mob.finished_special_task_boss_storage_value)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have killed "..getCreatureName(target)..".")
		end
	end
And try again.
 
lol, i deleted it and now when I kill 1 hydra, she does not die, the buffer errors still and the counter raises automaticaly:


kill 1 hydra -> errors -\/
15:07 You killed 1 hydra. You have killed 1 of 2000 hydras.
15:07 You killed 2 hydra. You have killed 2 of 2000 hydras.
15:07 You killed 3 hydra. You have killed 3 of 2000 hydras.
15:07 You killed 4 hydra. You have killed 4 of 2000 hydras.
15:07 You killed 5 hydra. You have killed 5 of 2000 hydras.
15:07 You killed 6 hydra. You have killed 6 of 2000 hydras.
15:07 You killed 7 hydra. You have killed 7 of 2000 hydras.
15:07 You killed 8 hydra. You have killed 8 of 2000 hydras.
15:07 You killed 9 hydra. You have killed 9 of 2000 hydras.
15:07 You killed 10 hydra. You have killed 10 of 2000 hydras.
15:07 You killed 11 hydra. You have killed 11 of 2000 hydras.
15:08 You killed 12 hydra. You have killed 12 of 2000 hydras.
15:08 You killed 13 hydra. You have killed 13 of 2000 hydras.
15:08 You killed 14 hydra. You have killed 14 of 2000 hydras.
15:08 You killed 15 hydra. You have killed 15 of 2000 hydras.
15:08 You killed 16 hydra. You have killed 16 of 2000 hydras.
15:08 You killed 17 hydra. You have killed 17 of 2000 hydras.

then I kill 1 tarantula:

15:10 You killed 264 hydra. You have killed 264 of 2000 hydras.
15:10 You killed 1 hydra. You have killed 1 of 2000 hydras.
15:10 You killed 1 hydra. You have killed 1 of 2000 hydras.
15:10 You killed 1 hydra. You have killed 1 of 2000 hydras.
15:10 You killed 1 hydra. You have killed 1 of 2000 hydras.
15:10 You killed 1 hydra. You have killed 1 of 2000 hydras.
 
:( i dont think so, since 0.4 is compatible with 0.3.6 scripts, then i'll wait until cyberm convert your script to 0.4 and add the null table checks =/
 
Back
Top