Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Entao galera, queria a ajuda de voces pra bolar um codigo em movemments pf. uma area que so 10 pessoas podemssem entrar, ao passar pela tile que tenha uma stoage contasse quantas pessoas entraram, q quando desse o max de players dentro da sala, nao desse pra entrar mais ninguem. E tipo se alguem sair da sala, ficando 9, poderia entrar mais 1 pessoa. mas sempre seguindo a regra de 10 pessoas na sala.

Resolvido por Doidodepeda

Ir para solução
  • Respostas 6
  • Visualizações 225
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Se não funcionar para você, tenho esse que fica na área.   Essa será a área From = {x = 1069, y = 1027, z = 6}, -- Area Left To = {x = 1071, y = 1030, z = 7}, -- Area Corner local

Postado
local MAX_PLAYERS_IN_ROOM = 10
local STORAGE_COUNT_KEY = 85565

function onStepIn(cid, item, position, fromPosition)
    local playerCount = getStorageValue(STORAGE_COUNT_KEY) or 0
    if playerCount < MAX_PLAYERS_IN_ROOM then
        setStorageValue(STORAGE_COUNT_KEY, playerCount + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bem-vindo à sala!")
        return true
    else
        doPlayerSendCancel(cid, "A sala está cheia. Você não pode entrar.")
        return false
    end
end

function onStepOut(cid, item, position, fromPosition)
    local playerCount = getStorageValue(STORAGE_COUNT_KEY) or 0
    if playerCount > 0 then
        setStorageValue(STORAGE_COUNT_KEY, playerCount - 1)
    end
end

tentar ai.

Postado
  • Autor
4 horas atrás, GM Vortex disse:

local MAX_PLAYERS_IN_ROOM = 10
local STORAGE_COUNT_KEY = 85565

function onStepIn(cid, item, position, fromPosition)
    local playerCount = getStorageValue(STORAGE_COUNT_KEY) or 0
    if playerCount < MAX_PLAYERS_IN_ROOM then
        setStorageValue(STORAGE_COUNT_KEY, playerCount + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bem-vindo à sala!")
        return true
    else
        doPlayerSendCancel(cid, "A sala está cheia. Você não pode entrar.")
        return false
    end
end

function onStepOut(cid, item, position, fromPosition)
    local playerCount = getStorageValue(STORAGE_COUNT_KEY) or 0
    if playerCount > 0 then
        setStorageValue(STORAGE_COUNT_KEY, playerCount - 1)
    end
end

tentar ai.

Deu seguinte error. Esqueci de avisar q e TFS 0.4
 

Citar

[13:6:46.214] [Error - MoveEvents Interface]
[13:6:46.217] data/movements/scripts/cave_loot.lua:onStepIn
[13:6:46.218] Description:
[13:6:46.219] data/movements/scripts/cave_loot.lua:5: attempt to call global 'getStorageValue' (a nil value)
[13:6:46.221] stack traceback:
[13:6:46.222]   data/movements/scripts/cave_loot.lua:5: in function <data/movements/scripts/cave_loot.lua:4>

 

Postado
local MAX_PLAYERS_IN_ROOM = 10
local STORAGE_COUNT_KEY = 85565

function onStepIn(cid, item, position, fromPosition)
    local playerCount = getPlayerStorageValue(cid, STORAGE_COUNT_KEY) or 0
    if playerCount < MAX_PLAYERS_IN_ROOM then
        setPlayerStorageValue(cid, STORAGE_COUNT_KEY, playerCount + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bem-vindo à sala!")
        return true
    else
        doPlayerSendCancel(cid, "A sala está cheia. Você não pode entrar.")
        return false
    end
end

function onStepOut(cid, item, position, fromPosition)
    local playerCount = getPlayerStorageValue(cid, STORAGE_COUNT_KEY) or 0
    if playerCount > 0 then
        setPlayerStorageValue(cid, STORAGE_COUNT_KEY, playerCount - 1)
    end
end

 

Postado
  • Autor
1 hora atrás, GM Vortex disse:

local MAX_PLAYERS_IN_ROOM = 10
local STORAGE_COUNT_KEY = 85565

function onStepIn(cid, item, position, fromPosition)
    local playerCount = getPlayerStorageValue(cid, STORAGE_COUNT_KEY) or 0
    if playerCount < MAX_PLAYERS_IN_ROOM then
        setPlayerStorageValue(cid, STORAGE_COUNT_KEY, playerCount + 1)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Bem-vindo à sala!")
        return true
    else
        doPlayerSendCancel(cid, "A sala está cheia. Você não pode entrar.")
        return false
    end
end

function onStepOut(cid, item, position, fromPosition)
    local playerCount = getPlayerStorageValue(cid, STORAGE_COUNT_KEY) or 0
    if playerCount > 0 then
        setPlayerStorageValue(cid, STORAGE_COUNT_KEY, playerCount - 1)
    end
end

 

sem error algum, porem da pra passar quantas player quiser, nao esta bloqueando passar + q 10.

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.7k

Informação Importante

Confirmação de Termo