JackSena 0 Posted December 8, 2024 Share Posted December 8, 2024 (edited) Estou com esse script q to criando, a função já está pegando certinho, porem não para de funfar kkk o stopevent não ta funcionando alguem me ajuda? function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) doPlayerAddHealth(cid, 1000) addEvent(regenVida, 1 * 1000, cid) end regenVida(cid) return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) stopEvent(regenVida) end return TRUE end se estiver no local errado por favor mover. Edited December 8, 2024 by JackSena Link to comment Share on other sites More sharing options...
0 El Rusher 37 Posted December 8, 2024 Share Posted December 8, 2024 local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida() if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1 * 1000) -- Reagendar o evento. end end regenEvent[cid] = addEvent(regenVida, 1 * 1000) -- Inicializa o evento. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end Link to comment Share on other sites More sharing options...
0 JackSena 0 Posted December 9, 2024 Author Share Posted December 9, 2024 20 horas atrás, El Rusher disse: local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida() if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1 * 1000) -- Reagendar o evento. end end regenEvent[cid] = addEvent(regenVida, 1 * 1000) -- Inicializa o evento. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end Boa tarte mano!! obg pelo apoio!! eu coloquei pra rodar aqui e agora deu isso no executavel -> 1 hora atrás, JackSena disse: Boa tarte mano!! obg pelo apoio!! eu coloquei pra rodar aqui e agora deu isso no executavel -> local eventos = {} function regenVida(cid) doPlayerAddMana(cid, 1120) eventos[cid] = addEvent(regenVida, 1000, cid) end function pararRegen(cid) stopEvent(eventos[cid]) eventos[cid] = nil end function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) regenVida(cid) return true end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) pararRegen(cid) return true end function onLogin(cid) regenVida(cid) -- Start regeneration on login end function onLogout(cid) pararRegen(cid) -- Stop regeneration on logout end consegui colocar esse pra rodar, tentei adicionar função pra para quando desloga porem não consegui ainda, quando o char desloga com o item no corpo da isso no executavel Link to comment Share on other sites More sharing options...
0 El Rusher 37 Posted December 10, 2024 Share Posted December 10, 2024 opa, bom dia, tenta assim entao por gentileza local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento com o `cid`. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end Link to comment Share on other sites More sharing options...
0 JackSena 0 Posted December 10, 2024 Author Share Posted December 10, 2024 8 horas atrás, El Rusher disse: opa, bom dia, tenta assim entao por gentileza local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento com o `cid`. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end Tentei usar e continuou dando o error Link to comment Share on other sites More sharing options...
0 El Rusher 37 Posted December 10, 2024 Share Posted December 10, 2024 local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) and getPlayerAccess(cid) > 0 then -- Verifica se o jogador ainda é válido. doPlayerAddHealth(cid, 1000) regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento. else regenEvent[cid] = nil -- Limpa o evento se o jogador não estiver mais online. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end "Player not found", sugere que a função luaDoPlayerAddMana está sendo chamada para um jogador que não existe mais no jogo. Isso pode acontecer se um jogador se desconectar enquanto o evento regenVida ainda está rodando. Para corrigir isso, adiciona uma verificação extra se o jogador ainda está conectado antes de executar doPlayerAddHealth: Link to comment Share on other sites More sharing options...
0 JackSena 0 Posted December 11, 2024 Author Share Posted December 11, 2024 21 horas atrás, El Rusher disse: local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) and getPlayerAccess(cid) > 0 then -- Verifica se o jogador ainda é válido. doPlayerAddHealth(cid, 1000) regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento. else regenEvent[cid] = nil -- Limpa o evento se o jogador não estiver mais online. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end "Player not found", sugere que a função luaDoPlayerAddMana está sendo chamada para um jogador que não existe mais no jogo. Isso pode acontecer se um jogador se desconectar enquanto o evento regenVida ainda está rodando. Para corrigir isso, adiciona uma verificação extra se o jogador ainda está conectado antes de executar doPlayerAddHealth: Coloquei pra rodar, ele parou de regenerar a vida =/ 21 horas atrás, El Rusher disse: local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) and getPlayerAccess(cid) > 0 then -- Verifica se o jogador ainda é válido. doPlayerAddHealth(cid, 1000) regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento. else regenEvent[cid] = nil -- Limpa o evento se o jogador não estiver mais online. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") doSendAnimatedText(getPlayerPosition(cid), "Weakening!!", 210) doPlayerSay(cid, "Losing Strength!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) -- Parar o evento associado ao jogador. if regenEvent[cid] then stopEvent(regenEvent[cid]) -- Cancela o evento em execução. regenEvent[cid] = nil -- Remove o identificador para evitar uso futuro. end return TRUE end "Player not found", sugere que a função luaDoPlayerAddMana está sendo chamada para um jogador que não existe mais no jogo. Isso pode acontecer se um jogador se desconectar enquanto o evento regenVida ainda está rodando. Para corrigir isso, adiciona uma verificação extra se o jogador ainda está conectado antes de executar doPlayerAddHealth: local regenEvent = {} -- Tabela para armazenar os identificadores de eventos por jogador. function onEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Activated Strength Blessing.") doSendAnimatedText(getPlayerPosition(cid), "Reloading!!", 210) doPlayerSay(cid, "POWER-UP!", 16) doSendMagicEffect(getPlayerPosition(cid), 95) local function regenVida(cid) if isPlayer(cid) then doPlayerAddHealth(cid, 1000) -- Adiciona vida ao jogador. regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Reagendar o evento com o `cid`. end end regenEvent[cid] = addEvent(regenVida, 1000, cid) -- Inicializa o evento com o `cid`. return TRUE end function onDeEquip(cid, item, position, fromPosition) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Strength Blessing Disabled.") -- Check if the event exists before trying to remove it if regenEvent[cid] then removeEvent(regenEvent[cid]) -- Cancels the event in execution. regenEvent[cid] = nil -- Remove the identifier to avoid future use. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Event removed successfully.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "No event to remove.") end return TRUE end Esse aqui quando eu removo o item ele diz ( 17:15 No event to remove. ) e continua regenerando e quadno deslogo da aquele erro Link to comment Share on other sites More sharing options...
0 El Rusher 37 Posted December 12, 2024 Share Posted December 12, 2024 poe cid nesses parenteses ai Link to comment Share on other sites More sharing options...
Question
JackSena 0
Estou com esse script q to criando, a função já está pegando certinho, porem não para de funfar kkk o stopevent não ta funcionando alguem me ajuda?
Link to comment
Share on other sites
7 answers to this question
Recommended Posts