local positions, state, names, msgs = { { Position(1208, 2082, 9), Position(1220, 2096, 9) }, { Position(1196, 2065, 9), Position(1183, 2076, 9) }, { Position(1210, 2098, 8), Position(1218, 2098, 8) }, Position(1165, 2081, 8) }, {'lost', 'won'}, {'Looser!', 'Winner!'}, {'Owned!', 'Game Over', 'Crushed', 'Impaled!', 'Slain', 'PWNT HARD'} function onPrepareDeath(cid, deathList) local pos = {getThingPosition(cid)} if isInRange(pos[1], positions[1][1], positions[1][2]) then pos[2] = getThingPosition(deathList[1]) local a = {cid, deathList[1]} for i = 1, 2 do doSendAnimatedText(pos[i], names[i], math.random(215)) doSendMagicEffect(pos[i], CONST_ME_POFF) doTeleportThing(a[i], positions[3][i]) doSendMagicEffect(positions[3][i], CONST_ME_TELEPORT) doPlayerSendTextMessage(a[i], MESSAGE_INFO_DESCR, 'You\'ve ' .. state[i] .. ' the duel against ' .. getCreatureName(a[i]) .. '.') unregisterCreatureEvent(a[i], 'arena') end a = nil doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, COLOR_GREEN, true) return false elseif isInRange(pos[1], positions[2][1], positions[2][2]) then local msg, color = msgs[math.random(#msgs)], math.random(215) for i = 1, 4 do addEvent(doSendAnimatedText, i * 250, pos[1], msg, color) end doSendMagicEffect(pos[1], CONST_ME_POFF) doTeleportThing(cid, positions[4]) doSendMagicEffect(positions[4], CONST_ME_TELEPORT) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got owned by ' .. ( isCreature(deathList[1]) and getCreatureName(deathList[1]) or 'Unknown' ) .. '.') doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, COLOR_GREEN, true) unregisterCreatureEvent(cid, 'arena') if not __achv.check(cid, 12) then __achv.set(cid, 12, __achv.get(cid, 12) + 1) end return false end return true end