arenas=
{
[1]={centerpos={x=2387, y=2360, z=10}, pos1={x=2384, y=2356, z=10}, pos2={x=2390, y=2364, z=10}},
[2]={centerpos={x=2404, y=2360, z=10}, pos1={x=2402, y=2356, z=10}, pos2={x=2408, y=2364, z=10}},
[3]={centerpos={x=2387, y=2372, z=10}, pos1={x=2384, y=2368, z=10}, pos2={x=2390, y=2376, z=10}},
[4]={centerpos={x=2404, y=2372, z=10}, pos1={x=2402, y=2368, z=10}, pos2={x=2408, y=2376, z=10}},
[5]={centerpos={x=2387, y=2384, z=10}, pos1={x=2384, y=2380, z=10}, pos2={x=2390, y=2388, z=10}},
[6]={centerpos={x=2404, y=2384, z=10}, pos1={x=2402, y=2380, z=10}, pos2={x=2408, y=2388, z=10}},
[7]={centerpos={x=2387, y=2396, z=10}, pos1={x=2384, y=2392, z=10}, pos2={x=2390, y=2400, z=10}},
[8]={centerpos={x=2404, y=2396, z=10}, pos1={x=2402, y=2392, z=10}, pos2={x=2408, y=2400, z=10}},
[9]={centerpos={x=2387, y=2408, z=10}, pos1={x=2384, y=2404, z=10}, pos2={x=2390, y=2412, z=10}},
[10]={centerpos={x=2404, y=2408, z=10}, pos1={x=2402, y=2404, z=10}, pos2={x=2408, y=2412, z=10}}
}
globalArenas=
{
[1]={pos1={x=2384, y=2356, z=10}, pos2={x=2390, y=2412, z=10}},
[2]={pos1={x=2402, y=2356, z=10}, pos2={x=2408, y=2412, z=10}}
}
ARENAS_TIME=5300
function getPlayerTimeArenas(cid)
return getPlayerStorageValue(cid, ARENAS_TIME)
end
function parseTime(secs, full, language)
local langTab=
{
[1]={hours={basic="hour", single="", plural="s", plural2="s"},
minutes={basic="minute", single="", plural="s", plural2="s"},
seconds={basic="second", single="", plural="s", plural2="s"}},
[2]={hours={basic="godzin", single="a", plural="y", plural2=""},
minutes={basic="minut", single="a", plural="y", plural2=""},
seconds={basic="sekund", single="a", plural="y", plural2=""}}
}
local function getPlural(timetype, count)
if count==0 then
return timetype.basic
end
if count<20 and count>9 then
return timetype.basic..timetype.plural2
end
local count2= count - ((math.floor(count/10))*10)
if count2<=1 then
count2=count
end
if count2>4 then
return timetype.basic..timetype.plural2
elseif count2>1 then
return timetype.basic..timetype.plural
else
return timetype.basic..timetype.single
end
end
if secs==0 then
return "0 "..langTab[language].seconds.basic
end
if full==nil then
full=false
end
if language==nil then
language=2
end
local text = ""
local hours = math.ceil(secs / 3600) - 1
local minutes = math.ceil(((secs - (3600 * hours))) / 60) - 1
if minutes == 60 then
minutes = 0
hours = hours + 1
end
local seconds = secs - (3600 * hours + minutes*60)
if seconds == 60 then
seconds = 0
minutes = minutes + 1
end
local begin = false
if hours>0 or full==true then
begin=true
text=text..hours.." "..getPlural(langTab[language].hours, hours)
end
if minutes>0 or full==true then
if begin then
text=text.." "
end
text=text..minutes.." "..getPlural(langTab[language].minutes, minutes)
begin=true
end
if seconds>0 or full==true then
if begin then
text=text.." "
end
--text=text.." " and begin==true or text..""
text=text..seconds.." "..getPlural(langTab[language].seconds, seconds)
end
return text
end
function setPlayerTimeArenas(cid, tim)
setPlayerStorageValue(cid, ARENAS_TIME, tim)
end
function addPlayerTimeArenas(cid, tim)
setPlayerStorageValue(cid, ARENAS_TIME, getPlayerStorageValue(cid, ARENAS_TIME)+tim)
end
function removePlayerTimeArenas(cid, tim)
setPlayerStorageValue(cid, ARENAS_TIME, getPlayerStorageValue(cid, ARENAS_TIME)-tim)
end
function isPlayerInArenaGlobal(cid)
local ppos=getPlayerPosition(cid)
for i=1,#globalArenas do
if isInRange(ppos, globalArenas[i].pos1, globalArenas[i].pos2) == 1 then
return TRUE
end
end
return FALSE
end
function isAnyPlayerInArea(pos1, pos2)
for zakresx = pos1.x,pos2.x do
for zakresy = pos1.y,pos2.y do
local pos = {x=zakresx,y=zakresy,z=pos1.z}
local creature = getTopCreature(pos)
if creature.uid > 0 then
if (isPlayer(creature.uid) == 1) then
return 1
end
end
end
end
return 0
end
function isAnyMonsterInArea(pos1, pos2)
for zakresx = pos1.x,pos2.x do
for zakresy = pos1.y,pos2.y do
local pos = {x=zakresx,y=zakresy,z=pos1.z}
local creature = getTopCreature(pos)
if creature.uid > 0 then
if (isMonster(creature.uid) == 1) then
return 1
end
end
end
end
return 0
end
function isPlayerInArea(cid, pos1, pos2)
for zakresx = pos1.x,pos2.x do
for zakresy = pos1.y,pos2.y do
local pos = {x=zakresx,y=zakresy,z=pos1.z}
local creature = getTopCreature(pos)
if creature.uid > 0 then
if (creature.uid == cid) then
return 1
end
end
end
end
return 0
end