Skip to content

am-megaphone

Latest
Compare
Choose a tag to compare
@fivemasdasd fivemasdasd released this 06 Jun 21:02
· 3 commits to main since this release
ad22bd9

Release Notes

Changes

  • Code refactoring for better readability and performance.
  • Added a new megaphone prop which can be configured in the shared folder.
  • Introduced new exports for improved functionality.

New Exports

  1. OpenMenu

    • Description: Opens the megaphone menu.
    • Usage:
      local isWhitelisted = exports['am-megaphone']:OpenMenu()
    • Note: This function will show the megaphone menu and, if AM.UseProp is enabled, will also play an animation on the specified player.
  2. IsWhitelisted

    • Description: Checks if the player is whitelisted.
    • Usage:
      local isWhitelisted = exports['am-megaphone']:IsWhitelisted()
    • Returns: Boolean indicating if the player is whitelisted.
  3. IsVehicleClassAllowed

    • Description: Checks if the vehicle class is allowed.
    • Usage:
      local isAllowed = exports['am-megaphone']:IsVehicleClassAllowed(vehicleEntity)
    • Parameters:
      • vehicleEntity (entity) - The vehicle entity to check.
    • Returns: Boolean indicating if the vehicle class is allowed.
  4. IsVehicleModelAllowed

    • Description: Checks if the vehicle model is allowed.
    • Usage:
      local isAllowed = exports['am-megaphone']:IsVehicleModelAllowed(vehicleEntity)
    • Parameters:
      • vehicleEntity (entity) - The vehicle entity to check.
    • Returns: Boolean indicating if the vehicle model is allowed.

Example Usage

-- Open the megaphone menu
exports['am-megaphone']:OpenMenu()

-- Check if a player is whitelisted
local isWhitelisted = exports['am-megaphone']:IsWhitelisted()
if isWhitelisted then
    print("Player is whitelisted")
else
    print("Player is not whitelisted")
end

-- Check if a vehicle class is allowed
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local isClassAllowed = exports['am-megaphone']:IsVehicleClassAllowed(vehicle)
if isClassAllowed then
    print("Vehicle class is allowed")
else
    print("Vehicle class is not allowed")
end

-- Check if a vehicle model is allowed
local isModelAllowed = exports['am-megaphone']:IsVehicleModelAllowed(vehicle)
if isModelAllowed then
    print("Vehicle model is allowed")
else
    print("Vehicle model is not allowed")
end