Postado Abril 23, 2023 2 anos Queria um script que um player que estiver de mc ele ataca outro player apenas com 1 dos char o outro dele não consegue atacar, bloqueando o attack com mcs. Citar Você tem o código disponível? Se tiver publique-o aqui: Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.
Postado Maio 13, 2023 2 anos Diretor function Player.canAttack(cid, target) -- Verifica se o jogador e o alvo são jogadores reais (não NPCs ou criaturas) if not isPlayer(cid) or not isPlayer(target) then return true end -- Verifica se o jogador está usando MC e tem o mesmo endereço IP que o alvo if getPlayerClient(cid).isMC and getPlayerIp(cid) == getPlayerIp(target) then -- Se as condições acima forem verdadeiras, envia uma mensagem de cancelamento para o jogador e impede o ataque doPlayerSendCancel(cid, "Você não pode atacar outro jogador enquanto estiver usando MC com o mesmo endereço IP.") return false end -- Se as condições acima não forem verdadeiras, permite que o ataque ocorra normalmente return true end function onPrepareDeath(cid, killer) -- Se o jogador morreu para outro jogador, atualiza a lista de frags if isPlayer(killer) and killer ~= cid then doPlayerAddFrags(killer, 1) doPlayerAddKill(cid, 1) end return true end function onLogin(cid) -- Ao entrar no jogo, exibe a mensagem de boas-vindas e atualiza a lista de frags doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Bem-vindo ao servidor de PvP!") doPlayerUpdateFrags(cid) return true end function onLogout(cid) -- Ao sair do jogo, atualiza a lista de frags doPlayerUpdateFrags(cid) return true end function onKill(cid, target) -- Exibe a mensagem de morte para o jogador e atualiza a lista de frags doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você matou " .. getCreatureName(target) .. ".") doPlayerUpdateFrags(cid) return true end function onDeath(cid, killer) -- Exibe a mensagem de morte para o jogador e atualiza a lista de frags doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você foi morto por " .. getCreatureName(killer) .. ".") doPlayerUpdateFrags(cid) return true end <event type="login" name="PvpOnLogin" event="script" value="pvp.lua"/> <event type="logout" name="PvpOnLogout" event="script" value="pvp.lua"/> <event type="preparedeath" name="PvpOnPrepareDeath" event="script" value="pvp.lua"/> <event type="kill" name="PvpOnKill" event="script" value="pvp.lua"/> <event type="death" name="PvpOnDeath" event="script" value="pvp.lua"/> <event type="attack" name="PvpOnAttack" event="script" value="pvp.lua"/> <event type="advance" name="PvpOnAdvance" event="script" value="pvp.lua"/> <event type="login" name="PvpFragsOnLogin" event="script" value="frags.lua"/> <event type="logout" name="PvpFragsOnLogout" event="script" value="frags.lua"/> <event type="preparedeath" name="PvpFragsOnPrepareDeath" event="script" value="frags.lua"/> <event type="kill" name="PvpFragsOnKill" event="script" value="frags.lua"/> <event type="death" name="PvpFragsOnDeath" event="script" value="frags.lua"/> <event type="advance" name="PvpFragsOnAdvance" event="script" value="frags.lua"/>
Postado Janeiro 6, 2024 1 ano Autor Vi só agora, não entendi está tudo muito junto tem como separar os que proibe os mcs ataca e dos frags? Queria só os que os mcs não consegue ataca outros player so com 1 char mesmo.
Postado Janeiro 8, 2024 1 ano function onAttack(cid, target) -- Verificar se ambos os jogadores estão usando MC local attackerAccount = getPlayerAccountId(cid) local targetAccount = getPlayerAccountId(target) if attackerAccount == targetAccount then doPlayerSendCancel(cid, "Você não pode atacar outro personagem seu.") doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_RED, "Atenção: "..getPlayerName(cid).." tentou atacar você, mas não foi possível devido à proteção contra MC.") return false -- Impedir o ataque end return true -- Permitir o ataque normal end
Postado Maio 29, 2024 Mai 29 Autor Em 08/01/2024 em 07:50, Karliin disse: function onAttack(cid, target) -- Verificar se ambos os jogadores estão usando MC local attackerAccount = getPlayerAccountId(cid) local targetAccount = getPlayerAccountId(target) if attackerAccount == targetAccount then doPlayerSendCancel(cid, "Você não pode atacar outro personagem seu.") doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_RED, "Atenção: "..getPlayerName(cid).." tentou atacar você, mas não foi possível devido à proteção contra MC.") return false -- Impedir o ataque end return true -- Permitir o ataque normal end Isso coloco aonde? Foi mal ver so agora.
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.