• 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 arenakill.lua problem (GIVES REP)

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
132
Location
Unknown
Hello, OtLanders i have a problem in my server with script arenakill.lua

Problem:

errorarena.jpg


Script:

Lua:
function getArenaMonsterIdByName(name)
    name = string.lower(tostring(name))
    for i = 42300, 42329 do
        if tostring(arena_monsters[i]) == name then
            return i
        end
    end
    return 0
end


local t = {
	newPos = {x=33062, y=31029, z=7},
	msg = "You have won! As new champion take the ancient armor as reward before you leave.",
	area = {
		fromX = 33054, toX = 33073,
		fromY = 31026, toY = 32356,
		z = 3
	}
}
local spheres = {
	['energy overlord'] = 8568,
	['fire overlord'] = 8569,
	['ice overlord'] = 8570,
	['earth overlord'] = 8578
}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
	local creaturesList = {}
	for x = -radiusx, radiusx do
		for y = -radiusy, radiusy do
			if not (x == 0 and y == 0) then
				creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z, stackpos = 253})
				if (creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
				table.insert(creaturesList, creature.uid)
				end
			end
		end
	end

	local creature = getTopCreature(position)
	if(creature.type == 1 and showPlayers == TRUE) or (creature.type == 2 and showMonsters == TRUE and (showSummons == FALSE or (showSummons == TRUE and getCreatureMaster(creature.uid) == (creature.uid)))) then
              if not(table.find(creaturesList, creature.uid)) then
			table.insert(creaturesList, creature.uid)
		end
	end
	return creaturesList
end
function onKill(cid, target, damage, flags)
	if isPlayer(target) or not isInArray({1, 3}, flags) or getCreatureMaster(target) then
		return true
	end

	local name = getCreatureName(target):lower()
	if name == 'tirecz' then
		local players = getCreaturesInRange({x=33063, y=31035,z=3}, 10, 9, FALSE, TRUE)
		for i = 1, #players do
			doTeleportThing(players[i], t.newPos)
			doCreatureSay(players[i], t.msg, TALKTYPE_ORANGE_1, false, players[i], getCreaturePosition(players[i]))
		end
		return true
	end

	if spheres[name] then
		setGlobalStorageValue(spheres[name], -1)
		return true
	end

	local now = tasks[name]
	if (now) then
		if isInArray({-1, now.amount}, getPlayerStorageValue(cid, now.storage)) or (not isInArray({14003, 14004, 14005}, now.storage) and getPlayerStorageValue(cid, 14500) ~= now.storage) then
			return true
		end

		local newValue = getPlayerStorageValue(cid, now.storage) + 1
		setPlayerStorageValue(cid, now.storage, newValue)
	end

	local room = getArenaMonsterIdByName(getCreatureName(target))
	if room > 0 then
		setPlayerStorageValue(cid, room, 1)
		doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'You can enter next room!')
	end
	return true
end


Rep ++ for helper :)
 
Last edited:
try this

Lua:
function onKill(cid, target)
	local room = getArenaMonsterIdByName(getCreatureName(target))
	if room > 0 then
		setPlayerStorageValue(cid, room, 1)
		doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'You can enter next room!')
	end
	return TRUE
end
 
you have this on 000-constant

Lua:
tasks = {
	['demon'] = {storage = 14006, amount = 666},
	['crocodile'] = {storage = 14007, amount = 300},
	['tarantula'] = {storage = 14008, amount = 300},
	['carniphila'] = {storage = 14009, amount = 150},
	['stone golem'] = {storage = 14010, amount = 200},
	['mammoth'] = {storage = 14011, amount = 300},
	['ice golem'] = {storage = 14012, amount = 300},
	['quara constrictor scout'] = {storage = 14013, amount = 300},
	['quara hydromancer scout'] = {storage = 14013, amount = 300},
	['quara mantassin scout'] = {storage = 14013, amount = 300},
	['quara pincher scout'] = {storage = 14013, amount = 300},
	['quara predator scout'] = {storage = 14013, amount = 300},
	['quara constrictor'] = {storage = 14014, amount = 300},
	['quara hydromancer'] = {storage = 14014, amount = 300},
	['quara mantassin'] = {storage = 14014, amount = 300},
	['quara pincher'] = {storage = 14014, amount = 300},
	['quara predator'] = {storage = 14014, amount = 300},
	['water elemental'] = {storage = 14015, amount = 70},
	['massive water elemental'] = {storage = 14015, amount = 70},
	['earth elemental'] = {storage = 14016, amount = 70},
	['massive earth elemental'] = {storage = 14016, amount = 70},
	['energy elemental'] = {storage = 14017, amount = 70},
	['massive energy elemental'] = {storage = 14017, amount = 70},
	['fire elemental'] = {storage = 14018, amount = 70},
	['massive fire elemental'] = {storage = 14018, amount = 70},
	['mutated rat'] = {storage = 14019, amount = 200},
	['giant spider'] = {storage = 14020, amount = 500},
	['hydra'] = {storage = 14021, amount = 2000},
	['sea serpent'] = {storage = 14001, amount = 2000},
	['behemoth'] = {storage = 14022, amount = 2000},
	['serpent spawn'] = {storage = 14002, amount = 1500},
	
	['pirate buccaneer'] = {storage = 14005, amount = 3000},
	['pirate corsair'] = {storage = 14005, amount = 3000},
	['pirate cutthroat'] = {storage = 14005, amount = 3000},
	['pirate ghost'] = {storage = 14005, amount = 3000},
	['pirate marauder'] = {storage = 14005, amount = 3000},
	['pirate skeleton'] = {storage = 14005, amount = 3000},

	['minotaur'] = {storage = 14004, amount = 5000},
	['minotaur archer'] = {storage = 14004, amount = 5000},
	['minotaur guard'] = {storage = 14004, amount = 5000},
	['minotaur mage'] = {storage = 14004, amount = 5000},

	['necromancer'] = {storage = 14003, amount = 4000},
	['priestess'] = {storage = 14003, amount = 4000}
}
?
 
Back
Top