Conditionals
This functions provide a way to pause code execution until a certain condition is met. These are useful when you want to wait for certain events to prevent before continuing with the mission flow.
Functions.WaitUntilPlayerIsInArea()
This function waits until the player is within a specified area. It continuously checks the distance between the player's position and the specified coords
. If the distance is less than the specified area
, the function exits the loop. The whileFunc
callback function, if provided, is called during each iteration and is passed the current distance as a parameter.
Parameters:
coords
: A vector3 representing the coordinates of the area.area
: A number representing the radius of the area.whileFunc
(optional): A callback function to be executed during each iteration, taking the current distance as a parameter.
Returns: None.
Functions.WaitUntilPlayerIsNotInArea()
This function waits until the player is outside a specified area. It continuously checks the distance between the player's position and the specified coords
. If the distance is greater than the specified area
, the function exits the loop. The whileFunc
callback function, if provided, is called during each iteration and is passed the current distance as a parameter.
Parameters:
coords
: A vector3 representing the coordinates of the area.area
: A number representing the radius of the area.whileFunc
(optional): A callback function to be executed during each iteration, taking the current distance as a parameter.
Returns: None.
Functions.WaitUntilPlayerHasItem()
This function waits until the player has a certain number of a specific item. The implementation for this function is not provided (WIP).
Parameters:
item
: A string representing the name or identifier of the item.count
: A number representing the desired quantity of the item.
Returns: None.
Functions.WaitUntilConditionBeTrue()
This function waits until a specified condition evaluates to true
. It continuously checks the condition until it becomes true
. If the Break
parameter is set to true
, the loop is manually broken.
Parameters:
condition
: A function representing the condition to be evaluated.Break
: A boolean indicating whether to manually break the loop.
Returns: None.
Functions.WaitUntilPlayerHasWeaponOnHands()
This function waits until the player has a specific weapon equipped in their hands. It continuously checks whether the player is armed, and if not, calls the notArmedFunc
callback function. Once the player is armed, it checks if the player's selected weapon matches the specified weaponHash
. If the weapon does not match, the notArmedFunc
callback is called again. This loop continues until the player has the specified weapon on their hands.
Parameters:
weaponHash
: A hash value representing the weapon.notArmedFunc
: A callback function to be executed when the player is not armed.
Returns: None.
Functions.WaitUntilPlayerIsInAreaOnVehicle()
This function waits until the player is both within a specified area and inside a specific vehicle. It continuously checks the distance between the player's position and the specified coords
, as well as whether the player is inside the specified vehicle
. The whileFunc
callback function, if provided, is called during each iteration and is passed the current state of the player's position in the area, the player's presence in the vehicle, and the current distance as parameters.
Parameters:
vehicle
: The vehicle entity the player should be inside.coords
: A vector3 representing the coordinates of the area.area
: A number representing the radius of the area.whileFunc
(optional): A callback function to be executed during each iteration, taking the player's position in the area, presence in the vehicle, and current distance as parameters.
Returns: None.
Functions.WaitUntilPlayerIsInVehicle()
This function waits until the player is inside a specific vehicle. It continuously checks whether the player is inside the specified vehicle
, and if a seat is specified, whether the player is in the specified seat. The whileFunc
callback function, if provided, is called during each iteration.
Parameters:
vehicle
: The vehicle entity the player should be inside.seat
: (optional) An integer representing the seat index the player should be in. If not provided, any seat will be considered.whileFunc
(optional): A callback function to be executed during each iteration.
Returns: None.
Functions.WaitUntilPlayerIsWalking()
This function waits until the player is walking (not in a vehicle). It continuously checks whether the player is in any vehicle. If the player is not in a vehicle, the loop is exited. The whileFunc
callback function, if provided, is called during each iteration.
Parameters:
whileFunc
(optional): A callback function to be executed during each iteration.
Returns: None.
(WIP) Functions.WaitUntilPlayerMakeAnimation()
This function waits until the player completes a specific animation. It displays a progress bar with the specified text
and animations
while waiting for the player to finish the animation. The onStartAction
callback function is called when the animation starts, and the onCompleteAction
callback function is called when the animation completes.
Parameters:
duration
: The duration of the animation in milliseconds.text
: A string representing the text to be displayed in the progress bar.animations
: An animation table specifying the animation details.onStartAction
: A callback function to be executed when the animation starts.onCompleteAction
: A callback function to be executed when the animation completes.
Returns: None.
Functions.WaitUntilPlayerHasXScorePoints()
This function waits until the player has a certain number of score points for a specific score ID. It continuously checks the score value associated with the scoreId
in the GM ScoreBoxes
table. If the condition
function returns true
for the score value, the loop is exited. The whileFunc
callback function, if provided, is called during each iteration and is passed the current score value as a parameter.
Parameters:
scoreId
: A string representing the score ID.condition
: A function that takes the score value and returns a boolean indicating whether the condition is met.whileFunc
(optional): A callback function to be executed during each iteration, taking the current score value as a parameter.
Returns: None.
(WIP) Functions.MakeForcedAnimationUntilStop()
This function plays a forced animation repeatedly until the loop is manually broken. It executes the specified emote
using the "emote" command and waits for the specified delay
before playing the animation again. The loop can be broken by returning true
in the onBreak
callback function.
Parameters:
emote
: A string representing the name of the animation/emote to be played.delay
(optional): The delay between animation repetitions in milliseconds (default is 3000).onBreak
: A callback function that is called during each iteration to check whether to break the loop.
Returns: None.
Last updated
Was this helpful?