Ir para conteúdo

Featured Replies

Postado

Bom eu mudei tfs do meu server para TheForgottenServer 0.4 e agora esta acontecendo o seguinte...


Eu uso esse script que muda de mapa a cada 20 minutos, que se localiza em data/lib/war.lua

Spoiler

                                            --[[
Storages:
global:
15000 = ID do mapa
15001 = tempo do mapa para !online
18888 = placar do time vermelho
18889 = placar do time verde
17778 = bandeira roubada pelo time verde
17779 = bandeira roubada pelo time vermelho

-----------------------------------------------------------

player:
12000 = Marca o time do player
17778 = bandeira roubada pelo time verde
17779 = bandeira roubada pelo time vermelho
]]--
------------------------ CONFIG ---------------------------
local numero_de_mapas = 9  -- colocar a quantidade de mapas existentes
local WAR_COLORS = {{0,0,0,0},{114,114,114,114}}  -- cores das roupas time vermelho e azul
local mapas = {
[1] = {{2,2},{3,3}}, -- [numero do mapa {maximo é o numero_de_mapas}] = {(townid de um spawn, townid de outro spawn),(townid de um spawn,town id de otro spawn)}, -- respectivamente verde e vermelho
[2] = {{5,5},{6,6}},
}
------------------------ FIM CONFIG -----------------------
function mudarMapa(id)
setGlobalStorageValue(15000,id) -- seta a ID do novo mapa
setGlobalStorageValue(15001,os.time() + 60*40)  --   seta o tempo do mapa para o !online
for i, pid in ipairs(getPlayersOnline()) do   -- verifica os players online  
       doRemoveCreature(pid)
end

end -- fim da funçao mudarMapa()


function nextMap()
    if getGlobalStorageValue(15000) == numero_de_mapas then 
       return 1
    else
       return (getGlobalStorageValue(15000) + 1)
    end
end -- fim da funcao nextMap


function mudarRopa(cid)  
        local colors = WAR_COLORS[getPlayerStorageValue(cid, 12000)]  -- verifica qual time é.
        local outfit = getCreatureOutfit(cid) 
        outfit.lookHead = colors[1] 
        outfit.lookBody = colors[2] 
        outfit.lookLegs = colors[3] 
        outfit.lookFeet = colors[4] 
        doCreatureChangeOutfit(cid, outfit) 
end -- fim do mudar roupas


function getTeamSpawn(cid)  
    return getTownTemplePosition(mapas[getGlobalStorageValue(15000)][getPlayerStorageValue(cid,12000)][math.random(1,2)]) 
end 

function getTeamMembers(id) 
    local players = getPlayersOnline() 
    local team = {} 
    if #players == 1 then 
        return team 
    end 
    for i, cid in ipairs(players) do 
        if getPlayerStorageValue(cid, 12000) == id and getPlayerGroupId(cid) == 1 then 
            table.insert(team, cid) 
        end 
    end 
    return team 
end 

function setTeam(cid) 
        local team1 = getTeamMembers(1) 
        local team2 = getTeamMembers(2) 
        if #team1 >= #team2 then 
            setPlayerStorageValue(cid, 12000, 2) 
        else 
            setPlayerStorageValue(cid, 12000, 1) 
        end 
        mudarRopa(cid) 
        doTeleportThing(cid,getTeamSpawn(cid),false)
end 

 

E quando um Player vai tentar logar acontece o seguinte erro e o player não loga.

 

Sem tError.png

 

Bom eu acho que é a script, por favor me ajudem.

  • Respostas 6
  • Visualizações 393
  • Created
  • Última resposta

Top Posters In This Topic

Posted Images

Postado
  • Autor

Olha meu Login.lua, quando eu tiro setTeam(cid) da pra logar normal só que a script não funciona.

 

 

Spoiler

local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
setTeam(cid)
    local loss = getConfigValue('deathLostPercent')
        if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
        doPlayerAddBlessing(cid, 1)
        doPlayerAddBlessing(cid, 2)
        doPlayerAddBlessing(cid, 3)
        doPlayerAddBlessing(cid, 4)
        doPlayerAddBlessing(cid, 5)

    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")
    registerCreatureEvent(cid, "GuildMotd")     
    registerCreatureEvent(cid, "fragReward")
    registerCreatureEvent(cid, "FragReward")
     registerCreatureEvent(cid, "deathBroadcast")
     registerCreatureEvent(cid, "DeathBroadcast")

    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end

    return true
end
 

 

Postado

Pelo que eu acho esse setTeam(cid) não deveria estar ai, ele deve ser o responsável por setar o time para os jogadores portanto isso só deveria ser ativado assim que o evento fosse iniciado e não em todo login realizado.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo