Scrappy Coco
Member
- Joined
- Dec 27, 2014
- Messages
- 95
- Reaction score
- 17
I have problems to randomly select a player from a specific area and transport . Thanks for all the help
this code ...
this code ...
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
print('bien hasta aqui')
local test = {}
local specs1 = Game.getSpectators(Wait_Place, false, true, 0, ctfWaitingRoomRadiusX, 0, ctfWaitingRoomRadiusY)
for i = 1, #specs1 do
local tid = specs1[i]
local tid2 = specs1[uid]
table.insert(test, tid2)
table.insert(test, tid)
end
local R_out = test[math.random(1,#specs1)]
local play = specs1:getName()
if R_out then
R_out:teleportTo(R_out:getTown():getTemplePosition(), false)
print("player " ..n_r.. " pl")
end
return true
end