- 1
- 1
- Версия SA-MP
-
- 0.3.7 (R1)
# NSlapV1.lua - Script Explanation
### Overview
NSlapV1.lua is a MoonLoader script for SA-MP. It registers the `/NSlap` command and uses the **SAMP.Events** library to intercept outgoing **Vehicle Sync** packets. The script stores a target player ID and, while active, modifies the outgoing vehicle synchronization data using the target player's position. :contentReference[oaicite:0]{index=0}
### How It Works
- Waits until SA-MP is fully loaded.
- Displays **"nOryX Loaded"** in the chat.
- Registers the `/NSlap` chat command.
- Checks if:
- The entered player ID is valid.
- The player is connected.
- You are inside a vehicle.
- The target player exists.
- The target is within 45 units.
- If all checks pass:
- Saves the target player ID.
- Enables the script (`active = true`).
- While enabled:
- Every Vehicle Sync packet is intercepted.
- The outgoing vehicle position is updated using the target player's coordinates.
- The movement values inside the sync packet are also modified.
- Running `/NSlap` without an ID disables the script.
### Main Functions
- `main()` → Initializes the script and registers the command.
- `slapCmd(id)` → Validates the player ID and activates/deactivates the script.
- `ev.onSendVehicleSync(sync)` → Modifies outgoing Vehicle Sync packets while the script is active. :contentReference[oaicite:1]{index=1}
### Overview
NSlapV1.lua is a MoonLoader script for SA-MP. It registers the `/NSlap` command and uses the **SAMP.Events** library to intercept outgoing **Vehicle Sync** packets. The script stores a target player ID and, while active, modifies the outgoing vehicle synchronization data using the target player's position. :contentReference[oaicite:0]{index=0}
### How It Works
- Waits until SA-MP is fully loaded.
- Displays **"nOryX Loaded"** in the chat.
- Registers the `/NSlap` chat command.
- Checks if:
- The entered player ID is valid.
- The player is connected.
- You are inside a vehicle.
- The target player exists.
- The target is within 45 units.
- If all checks pass:
- Saves the target player ID.
- Enables the script (`active = true`).
- While enabled:
- Every Vehicle Sync packet is intercepted.
- The outgoing vehicle position is updated using the target player's coordinates.
- The movement values inside the sync packet are also modified.
- Running `/NSlap` without an ID disables the script.
### Main Functions
- `main()` → Initializes the script and registers the command.
- `slapCmd(id)` → Validates the player ID and activates/deactivates the script.
- `ev.onSendVehicleSync(sync)` → Modifies outgoing Vehicle Sync packets while the script is active. :contentReference[oaicite:1]{index=1}