Justin123456
New Member
- Joined
- Mar 24, 2011
- Messages
- 177
- Reaction score
- 4
Can someone help me edit this script so when it says "The Battle begins. Survive for glory!" it will remove the teleport that is at x=968, y=1306, z=6?
I tried but as you can see... I kinda failed haha
Here is mine:
Here is original:
Btw I'm using TFS 0.3.6! I'll REP whoever helps!
I tried but as you can see... I kinda failed haha
Here is mine:
PHP:
local config = {
temporaryArea = {
{x = 951, y = 1314, z = 6}, -- northwest corner of area where players must stand in order to join the event
{x = 957, y = 1320, z = 6} -- south east corner
},
arenaArea = {
{x = 964, y = 1313, z = 7}, -- nw corner of arena
{x = 987, y = 1327, z = 7}, -- se corner of arena
{x = 977, y = 1321, z = 7} -- center of arena
},
minPlayers = 1, -- min players required to start the battle
prize = {2160, 5467} -- rewards
}
gatepos = {x=968, y=1306, z=6, stackpos=1}
getgate = getThingfromPos(gatepos)
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!")
if getgate.itemid == 1355 then
doRemoveItem(getgate.uid,1)
end
end
end
return true
end
Here is original:
PHP:
local config = {
temporaryArea = {
{x = 951, y = 1314, z = 6}, -- northwest corner of area where players must stand in order to join the event
{x = 957, y = 1320, z = 6} -- south east corner
},
arenaArea = {
{x = 964, y = 1313, z = 7}, -- nw corner of arena
{x = 987, y = 1327, z = 7}, -- se corner of arena
{x = 977, y = 1321, z = 7} -- center of arena
},
minPlayers = 1, -- min players required to start the battle
prize = {2160, 5467} -- 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
Btw I'm using TFS 0.3.6! I'll REP whoever helps!