• 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 TFS 0.4 - Spawning on top of objects

FearWar

Active Member
Joined
Sep 17, 2017
Messages
221
Reaction score
26
Location
Brasil
Hi otlanders,

I'm using a script at an event, and it's spawning on top of objects as shown in the image:

otland.png

Script:

Lua:
               function killPlayer(cid, pos, killer)
                    local t_l = SBW_AREA[1]
                    local b_r = SBW_AREA[2]
                    local posti = {}
                    local isPossibleToTeleportPlayer = false
                    while (isPossibleToTeleportPlayer == FALSE) do
                    doTeleportThing(cid, {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)})
                        if isInWallArray(posti) == FALSE then
                            isPossibleToTeleportPlayer = TRUE
                        end
                    end
                    doTeleportThing(cid, posti)
                    doSendMagicEffect(pos,2)
                    doSendMagicEffect(posti,6)
                    doSendAnimatedText(pos, ""..getCreatureName(killer).." ", 55)
                    doPlayerSendTextMessage(cid, 27, "Voce foi morto por "..getCreatureName(killer)..".")
                    doPlayerSetStorageValue(killer, SBW_SCORE, getPlayerStorageValue(killer, SBW_SCORE)+SBW_POINTSKILL)               
                    doPlayerSendTextMessage(killer, 27, "You've killed "..getCreatureName(cid)..".")
                    if SBW_LOSTSCORE then
                        doPlayerSetStorageValue(cid, SBW_SCORE, getPlayerStorageValue(cid, SBW_SCORE)-1)
                    end
                    if SBW_RESETAMMO then
                        doPlayerSetStorageValue(cid, SBW_AMMO, SBW_MINAMMO)
                    end
                end
 
Solution
Lua:
               function killPlayer(cid, pos, killer)
                    local t_l = SBW_AREA[1]
                    local b_r = SBW_AREA[2]
                    local isPossibleToTeleportPlayer = false
                    repeat
                        posti = {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), stackpos = 253}

                        if isInWallArray(posti) == FALSE then
                            isPossibleToTeleportPlayer = true
                        end
                    until isPossibleToTeleportPlayer == true
                    doSendMagicEffect(pos, 2)
                    doTeleportThing(cid, posti)
                    doSendMagicEffect(posti, 6)...
Lua:
               function killPlayer(cid, pos, killer)
                    local t_l = SBW_AREA[1]
                    local b_r = SBW_AREA[2]
                    local isPossibleToTeleportPlayer = false
                    repeat
                        posti = {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), stackpos = 253}

                        if isInWallArray(posti) == FALSE then
                            isPossibleToTeleportPlayer = true
                        end
                    until isPossibleToTeleportPlayer == true
                    doSendMagicEffect(pos, 2)
                    doTeleportThing(cid, posti)
                    doSendMagicEffect(posti, 6)
                    doSendAnimatedText(pos, ""..getCreatureName(killer).." ", 55)
                    doPlayerSendTextMessage(cid, 27, "Voce foi morto por "..getCreatureName(killer)..".")
                    doPlayerSetStorageValue(killer, SBW_SCORE, getPlayerStorageValue(killer, SBW_SCORE)+SBW_POINTSKILL)             
                    doPlayerSendTextMessage(killer, 27, "You've killed "..getCreatureName(cid)..".")
                    if SBW_LOSTSCORE then
                        doPlayerSetStorageValue(cid, SBW_SCORE, getPlayerStorageValue(cid, SBW_SCORE)-1)
                    end
                    if SBW_RESETAMMO then
                        doPlayerSetStorageValue(cid, SBW_AMMO, SBW_MINAMMO)
                    end
                end
 
Solution
Can this other part of the script do the same thing @Deatthraz ?

Lua:
function moveToEvent()
for _, pid in ipairs(getPlayersOnline()) do
    if isInRange(getCreaturePosition(pid), SBW_WAITROOM[1], SBW_WAITROOM[2]) then
        local posti = {}
        local isPossibleToTeleportPlayer = false
        while (isPossibleToTeleportPlayer == FALSE) do
        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)})
            if (isInWallArray(posti) == FALSE) then
                isPossibleToTeleportPlayer = TRUE
            end
        end
        doTeleportThing(pid, posti)
        doPlayerSetStorageValue(pid, SBW_INEVENT, 1)
        doPlayerSetStorageValue(pid, SBW_AMMO, SBW_MINAMMO)
        doPlayerSetStorageValue(pid, SBW_SCORE, 0)
        doPlayerSendTextMessage(pid, 27, "[SNOWBALL WAR] Seja bem vindo, aqui estao os comandos que voce vai usar durante o evento\n!snowball atirar --Atirar uma bola de neve.\n!snowball info --Isso mostra seus pontos de jogos e a quantia de bolas de neve que voce tem. Tambem mostra o ranking de pontos do evento.\n Recarregue suas bolas de neve clicando em frente ao gerador no centro do campo.\nAltamente recomendado adicionar estes comandos a sua hotkeys.")                                                                       
    end
end
doRemoveItem(getTileItemById(SBW_TP, 1387).uid)
addEvent(endsnowball, SBW_DURATION*1000*60)
doBroadcastMessage(SBW_MSGSTART)
end

Changing that part?

Lua:
                    local isPossibleToTeleportPlayer = false
                    repeat
                        posti = {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), stackpos = 253}

                        if isInWallArray(posti) == FALSE then
                            isPossibleToTeleportPlayer = true
                        end
                    until isPossibleToTeleportPlayer == true
 
Can this other part of the script do the same thing @Deatthraz ?

Lua:
function moveToEvent()
for _, pid in ipairs(getPlayersOnline()) do
    if isInRange(getCreaturePosition(pid), SBW_WAITROOM[1], SBW_WAITROOM[2]) then
        local posti = {}
        local isPossibleToTeleportPlayer = false
        while (isPossibleToTeleportPlayer == FALSE) do
        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)})
            if (isInWallArray(posti) == FALSE) then
                isPossibleToTeleportPlayer = TRUE
            end
        end
        doTeleportThing(pid, posti)
        doPlayerSetStorageValue(pid, SBW_INEVENT, 1)
        doPlayerSetStorageValue(pid, SBW_AMMO, SBW_MINAMMO)
        doPlayerSetStorageValue(pid, SBW_SCORE, 0)
        doPlayerSendTextMessage(pid, 27, "[SNOWBALL WAR] Seja bem vindo, aqui estao os comandos que voce vai usar durante o evento\n!snowball atirar --Atirar uma bola de neve.\n!snowball info --Isso mostra seus pontos de jogos e a quantia de bolas de neve que voce tem. Tambem mostra o ranking de pontos do evento.\n Recarregue suas bolas de neve clicando em frente ao gerador no centro do campo.\nAltamente recomendado adicionar estes comandos a sua hotkeys.")                                                                    
    end
end
doRemoveItem(getTileItemById(SBW_TP, 1387).uid)
addEvent(endsnowball, SBW_DURATION*1000*60)
doBroadcastMessage(SBW_MSGSTART)
end

Changing that part?

Lua:
                    local isPossibleToTeleportPlayer = false
                    repeat
                        posti = {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), stackpos = 253}

                        if isInWallArray(posti) == FALSE then
                            isPossibleToTeleportPlayer = true
                        end
                    until isPossibleToTeleportPlayer == true

Yes, just replace same lines
 
Back
Top