diff options
| -rw-r--r-- | lib/Aircraft.py | 4 | ||||
| -rw-r--r-- | plugins/smoke_on_damage/Plugin.py | 3 | ||||
| -rw-r--r-- | proxy.py | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/Aircraft.py b/lib/Aircraft.py index dd2bbed..5e6e24d 100644 --- a/lib/Aircraft.py +++ b/lib/Aircraft.py @@ -76,7 +76,11 @@ class Aircraft: if packet.player_id != self.id: return None + if self.life == -1: + self.life=packet.life + self.prev_life = self.life + self.life = packet.life self.set_position(packet.position) self.set_attitude(packet.atti) diff --git a/plugins/smoke_on_damage/Plugin.py b/plugins/smoke_on_damage/Plugin.py index b3b4ccd..e6c57e2 100644 --- a/plugins/smoke_on_damage/Plugin.py +++ b/plugins/smoke_on_damage/Plugin.py @@ -1,5 +1,6 @@ """TThis plugin will cause the aircraft to emit smoke if it's health is below a certain threshold. -It is also an example of a plugin as a folder/module.""" +It is also an example of a plugin as a folder/module. +This can be used as a basis for more complex plugins that may need multiple files.""" from lib.PacketManager.packets import FSNETCMD_AIRCMD, FSNETCMD_AIRPLANESTATE, FSNETCMD_TEXTMESSAGE from logging import debug from config import SMOKE_LIFE, SMOKE_PLANE @@ -137,15 +137,11 @@ async def handle_client(client_reader, client_writer): if not keep_message: data = None - if player.aircraft.life == -1: #Uninitialised - player.aircraft.prev_life = player.aircraft.life - elif player.aircraft.prev_life < player.aircraft.life and player.aircraft.prev_life != -1 and not player.aircraft.just_repaired: cheatingMsg = YSchat.message(f"{HEALTH_HACK_MESSAGE} by {player.username}") warning(f"Health hack detected for {player.username}, Connected from {player.ip}") message_to_server.append(cheatingMsg) - player.aircraft.prev_life = player.aircraft.life player.aircraft.just_repaired = False elif packet_type == "FSNETCMD_UNJOIN": |
