• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Check the TILE ID before teleport a player

Chady Chaito

New Member
Joined
Nov 25, 2013
Messages
11
Reaction score
1
I need to check the place that will teleport a player before teleporting.
If the place has the ITEM ID of this array:
walls_id = {1115,1111,1112,5258,1385,1113}
Choose another random position, look the code:

function isInWallArray(pos)
for k = 0, table.getn(t.onShoot.misc.walls_id) do
if getTileItemById(pos, t.onShoot.misc.walls_id[k]).itemid == t.onShoot.misc.walls_id[k] then
return true
end
end
return false
end
function moveToEvent()
doBroadcastMessage("PaintBall Event - Let's kill them!")
for _, pid in ipairs(getPlayersOnline()) do
if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
doPlayerSetStorageValue(pid, t.main.storages.score, 0)
doPlayerSendTextMessage(pid,27,"!shoot bullet\n!shoot info\n!shoot ammo")
end
end
doBroadcastMessage("[SNOWBALL - EVENTO] Iniciou, facam uma grande guerra de neve.")
doRemoveItem(getTileItemById(t.main.positions.tp_to_snowball,1387).uid)
addEvent(endsnowball, t.main.event_config.event_duration*1000*60)
end

I'm flattered!
 
Back
Top