UpInSmoke
Supreme Ruler
- Joined
- Nov 16, 2008
- Messages
- 303
- Reaction score
- 21
So i have this script for Last man standing; and it works fine except for one thing.
It only takes the minimum people into the arena.
Heres the script:
if i set that to 2 and theres 5 people in there .. it only takes 2.
If i set it for 10 and theres only 5 it wont even start..
so basically it will take that number of people and that number only.. any ideas why?
thanks!
It only takes the minimum people into the arena.
Heres the script:
Code:
local config = {
temporaryArea = {
{x = 670, y = 1182, z = 7}, -- northwest corner of area where players must stand in order to join the event
{x = 686, y = 1196, z = 7} -- south east corner
},
arenaArea = {
{x = 638, y = 1136, z = 7}, -- nw corner of arena
{x = 665, y = 1160, z = 7}, -- se corner of arena
{x = 652, y = 1148, z = 7} -- center of arena
},
minPlayers = 2, -- min players required to start the battle
prize = {2159} -- rewards
}
function onThink(interval, lastExecution, thinkInterval)
local players, arenaPlayers = {}, {}
for x = (config.temporaryArea)[1].x, (config.temporaryArea)[2].x do
for y = (config.temporaryArea)[1].y, (config.temporaryArea)[2].y do
for z = (config.temporaryArea)[1].z, (config.temporaryArea)[2].z do
if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
table.insert(players, getTopCreature({x = x, y = y, z = z}).uid)
end
end
end
end
for x = (config.arenaArea)[1].x, (config.arenaArea)[2].x do
for y = (config.arenaArea)[1].y, (config.arenaArea)[2].y do
for z = (config.arenaArea)[1].z, (config.arenaArea)[2].z do
if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
table.insert(arenaPlayers, getTopCreature({x = x, y = y, z = z}).uid)
end
end
end
end
if(table.maxn(arenaPlayers) == 1) then
doTeleportThing(arenaPlayers[1], getPlayerMasterPos(arenaPlayers[1]))
doSendMagicEffect(getPlayerMasterPos(arenaPlayers[1]), CONST_ME_TELEPORT)
doPlayerSendTextMessage(arenaPlayers[1], MESSAGE_STATUS_CONSOLE_BLUE, "You win a battle and recived your reward.")
doPlayerAddItem(arenaPlayers[1], (config.prize)[math.random(1, table.maxn(config.prize))], 1)
elseif(table.maxn(arenaPlayers) < 1) then
if(table.maxn(players) >= config.minPlayers) then
for i = 1, config.minPlayers do
doTeleportThing(players[i], (config.arenaArea)[3])
doSendMagicEffect((config.arenaArea)[3], CONST_ME_TELEPORT)
doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The battle begins. Survive for glory!")
end
end
end
return true
end
Code:
minPlayers = 2, -- min players required to start the battle
If i set it for 10 and theres only 5 it wont even start..
so basically it will take that number of people and that number only.. any ideas why?
thanks!