Joriku
Working in the mines, need something?
Hi, so I got hard stuck... talking haaard stuck.
So i am trying to get the script to put teleport on location (TPS) and randomize an arena from cgf.arena to be placed upon the map for 10 minutes then be removed.
For the moment being, i am stuck and would love someone to help me out
So i am trying to get the script to put teleport on location (TPS) and randomize an arena from cgf.arena to be placed upon the map for 10 minutes then be removed.
For the moment being, i am stuck and would love someone to help me out
Lua:
local lms = TalkAction("/lms3")
local tps =
{
[1] = {x= 1007, y= 1001, z= 5}, -- where tp is created
[2] = {x= 1007, y= 1002, z= 5}, -- where tp is created
[3] = {x= 1007, y= 1003, z= 5}, -- where tp is created
};
local arena1 =
{
[1] = {x= 976, y= 1025, z= 11}, -- arena positions
[2] = {x= 987, y= 1029, z= 11},
[3] = {x= 984, y= 1019, z= 11},
};
local arena2 =
{
[1] = {x= 958, y= 1046, z= 2},
[2] = {x= 960, y= 1036, z= 2},
[3] = {x= 965, y= 1042, z= 2},
};
local arena3 =
{
[1] = {x= 1026, y= 1017, z= 7},
[2] = {x= 1021, y= 1021, z= 7},
[3] = {x= 1031, y= 1013, z= 7},
};
local cfg =
{
arena = { 'arena1', 'arena2', 'arena3' }, -- variable for the arenas 1 to 3
messagea1 = 'Arena1', -- test message to check if it works
messagea2= 'Arena2',
messagea3 = 'Arena3',
messagecreate = 'LMS has been opened up for 10 minutes, you can find the teleports at the bridge.', -- broadcast message on create
messageremove = 'LMS has ended, better luck next time!', -- broadcast message on remove
minutes = 10*(60*1000) -- amount of minutes to wait
}
function lms.onSay(cid, words, param) -- new usage, trying to write here
for k in pairs(cfg.arena) do
local a = Tile(tps):math.random([k])
-- trying to take it from "arena" to randomize an arena to put out the teleports at "tps" locations table above
return true
end
function lms.onSay(cid, words, param) -- old usage
doCreateTeleport(1387, cfg.tpto, tps[1])
doCreateTeleport(1387, cfg.tpto1, tps[2])
doCreateTeleport(1387, cfg.tpto2, tps[3])
Game.broadcastMessage(cfg.messagecreate)
addEvent(onRemoveItem, cfg.minutes)
return true
end
function onRemoveItem() -- removing the teleports
for i = 1, #tps do
local item = Tile(tps[i]):getItemById(1387)
if item then
item:remove()
doSendMagicEffect(tps[i], CONST_ME_POFF)
end
end
Game.broadcastMessage(cfg.messageremove)
return true
end
lms:separator(" ")
lms:register()