This page explains the available exports for the r_grab script and their usage. These exports allow you to interact with the script programmatically from other resources.
All exports are client side only.
1. Exports Overview
1.1 Grab a Player
exports['r_grab']:GrabPlayer(player)
Description:
This export allows you to drag a specified player.
Parameters:
player: The server ID of the player you want to grab.
1.2 Put the Player in a Vehicle
exports['r_grab']:PutPlayerInVehicle()
Description:
This export places the currently dragged player into the nearest vehicle.
Usage:
Make sure the dragged player is near a vehicle before calling this function.
1.3 Remove the Player from a Vehicle
exports['r_grab']:RemovePlayerFromVehicle()
Description:
This export removes the currently dragged player from the vehicle they are in.
Usage:
Call this function to pull the dragged player out of a vehicle.
1.4 Check if the Player is Being Dragged
Description:
This export checks if a player is currently being dragged.
Returns:
true: If the player is being dragged.
false: If the player is not being dragged.
2. Example Usage
Below is an example of how to use these exports in your script:
-- Grab a player by their server ID
exports['r_grab']:GrabPlayer(1)
-- Put the dragged player in the nearest vehicle
exports['r_grab']:PutPlayerInVehicle()
-- Remove the dragged player from the vehicle
exports['r_grab']:RemovePlayerFromVehicle()
-- Check if the local player is being dragged
if exports['r_grab']:IsGrabbed() then
print("You are being dragged!")
else
print("You are not being dragged.")
end