Con ayuda de una AI genere este codigo pero no estaria funcionando y estoy recurriendo a esto para ver si me pueden ayudar a corregir los problemas ya que no anda el skript
les explico lo que quiero hacer, me gustaria hacer que un npc se genere cuando un jugador este en combate para ver si su mira (punto de vista) se cambia o golpea al npc deberia ser simple y que se repita infinitamente
options:
prefix: &cAntiHack &8»&f
detectionCooldown: 5 seconds # Tiempo entre detección de NPCs
npcLifetime: 3 seconds # Duración de cada NPC antes de eliminarse
checkDistance: 3 # Distancia al rededor del jugador para spawn de NPCs
variables:
{lastCombat::%player%} = 0 # Último momento en combate
{npcTargets::*} = {} # Lista de NPCs creados para la detección
on damage of player:
if attacker is a player:
if {lastCombat::%attacker%} is not set or difference between now and {lastCombat::%attacker%} > {@detectionCooldown}:
set {lastCombat::%attacker%} to now
# Genera NPCs alrededor del atacante para la detección de hacks
loop 4 times:
set {_distance} to {@checkDistance}
set {_angle} to 90 * loop-index # Distribuye los NPCs en 90° alrededor del jugador
set {_npcLocation} to location of attacker
add cos({_angle}) * {_distance} to x-coordinate of {_npcLocation}
add sin({_angle}) * {_distance} to z-coordinate of {_npcLocation}
# Crea el NPC y guárdalo en la lista de detección
spawn fake player "NPC_Detector" at {_npcLocation}
add last spawned entity to {npcTargets::*}
# Elimina el NPC después del tiempo de vida
wait {@npcLifetime}
delete last spawned entity
remove last spawned entity from {npcTargets::*}
on damage:
# Si el objetivo es un NPC en la lista de detección
if victim is in {npcTargets::*}:
if attacker is a player:
send "{@prefix} &cAlerta: &f%attacker% ha golpeado un NPC de detección. Posible uso de hacks." to all players where [input has permission "antihack.alert"]
cancel event
les explico lo que quiero hacer, me gustaria hacer que un npc se genere cuando un jugador este en combate para ver si su mira (punto de vista) se cambia o golpea al npc deberia ser simple y que se repita infinitamente
options:
prefix: &cAntiHack &8»&f
detectionCooldown: 5 seconds # Tiempo entre detección de NPCs
npcLifetime: 3 seconds # Duración de cada NPC antes de eliminarse
checkDistance: 3 # Distancia al rededor del jugador para spawn de NPCs
variables:
{lastCombat::%player%} = 0 # Último momento en combate
{npcTargets::*} = {} # Lista de NPCs creados para la detección
on damage of player:
if attacker is a player:
if {lastCombat::%attacker%} is not set or difference between now and {lastCombat::%attacker%} > {@detectionCooldown}:
set {lastCombat::%attacker%} to now
# Genera NPCs alrededor del atacante para la detección de hacks
loop 4 times:
set {_distance} to {@checkDistance}
set {_angle} to 90 * loop-index # Distribuye los NPCs en 90° alrededor del jugador
set {_npcLocation} to location of attacker
add cos({_angle}) * {_distance} to x-coordinate of {_npcLocation}
add sin({_angle}) * {_distance} to z-coordinate of {_npcLocation}
# Crea el NPC y guárdalo en la lista de detección
spawn fake player "NPC_Detector" at {_npcLocation}
add last spawned entity to {npcTargets::*}
# Elimina el NPC después del tiempo de vida
wait {@npcLifetime}
delete last spawned entity
remove last spawned entity from {npcTargets::*}
on damage:
# Si el objetivo es un NPC en la lista de detección
if victim is in {npcTargets::*}:
if attacker is a player:
send "{@prefix} &cAlerta: &f%attacker% ha golpeado un NPC de detección. Posible uso de hacks." to all players where [input has permission "antihack.alert"]
cancel event