Postado Maio 3, 2017 8 anos Coloquei em meu otserver o script de regen stamina nos trainers. A cada minuto de treino, recupera 5 min de stamina. Funciona muito bem até certo ponto... Citar Estou usando o seguinte script: function onAttack(cid, target) local storage = 19387 local tempo = 133 ----(numero de ataques em um minuto) local minutes = 5 if isMonster(target) and getCreatureName(target):lower() == 'target' then doPlayerSetStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+1) if getPlayerStorageValue(cid, storage) >= tempo then doPlayerAddStamina(cid, minutes) doPlayerSetStorageValue(cid, storage, 0) doPlayerSendTextMessage(cid, 25, "Você recebeu 5 minutos de stamina.") end end return true end Porém após um tempo treinando o PLAYER para de atacar e só volta atacar se o mesmo for relogado. Aparece o seguinte erro na distro: Alguém pode me ajudar?
Postado Maio 4, 2017 8 anos Provavelmente o erro ocorre quando o player atinge 100% da stamina, crie uma função para verificar a stamina do player, se estiver full, o script não roda. Ou seja, mude a linha: if isMonster(target) and getCreatureName(target):lower() == 'target' then para if isMonster(target) and getCreatureName(target):lower() == 'target' and getPlayerStamina(cid) < 42 * 60 * 60 * 1000 then Editado Maio 4, 2017 8 anos por luangop script (veja o histórico de edições) Te ajudei? Clique em Gostei ! ²²²d¬¬b²²² "She's got a smile that it seems to me...." ♪♪
Postado Maio 4, 2017 8 anos Autor 17 horas atrás, luangop disse: Provavelmente o erro ocorre quando o player atinge 100% da stamina, crie uma função para verificar a stamina do player, se estiver full, o script não roda. Ou seja, mude a linha: if isMonster(target) and getCreatureName(target):lower() == 'target' then para if isMonster(target) and getCreatureName(target):lower() == 'target' and getPlayerStamina(cid) < 42 * 60 * 60 * 1000 then Estou efetuando o teste. Assim que completar o time do teste do o rep+. Muito obrigado. @luangop, infelizmente não funcionou, continua funcionando o script, mesmo com a stamina full.
Postado Maio 5, 2017 8 anos A noite vou dar uma estudada melhor! Tente reduzir para segundos ao invés de milissegundos. Na linha: if isMonster(target) and getCreatureName(target):lower() == 'target' and getPlayerStamina(cid) < 42 * 60 * 60 * 1000 then Mude para: if isMonster(target) and getCreatureName(target):lower() == 'target' and (getPlayerStamina(cid) < 42 * 60 * 60) then @Luis Gustavo de M A Te ajudei? Clique em Gostei ! ²²²d¬¬b²²² "She's got a smile that it seems to me...." ♪♪
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.