Postado Outubro 10, 2023 1 ano 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.
Postado Outubro 11, 2023 1 ano 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 Outubro 11, 2023 1 ano 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 Outubro 11, 2023 1 ano 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 Outubro 11, 2023 1 ano 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.