[object Object]

Documentation

List of all modules

On this page you'll find more information on how every modules works and what useful functions within the modules are.

Player

The player module contains all functions regarding player actions. Here is a full list of useful functions:

Client Side

GetPlayerData()

The GetPlayerData function will return all Player Data of the loaded character.

GetPlayerCitizenIdBySource(Source : int)

Returns the StateId (CitizenId) of the player, using the source as a parameter.

GetPlayers()

Returns all players that are currently connected with the server.

IsPlayerAdmin()

Checks if player using the command, function or event is an admin.

GetPlayersInArea(Coords : vector3, Radius : float)

Checks the player's surroundings and returns the all players found within the radius.

Returns: array in following format:

[1] = {
  ['ServerId'] = PLAYER_SOURCE,
  ['Name'] = PLAYER_NAME,
}

GetClosestPlayer(Coords : vector3, Radius : float)

Checks the player's surroundings and returns the first player found within the radius.

Returns: table in following format:

  ['ClosestServer'] = PLAYER_SOURCE,
  ['ClosestDistance'] = DISTANCE,
  ['ClosestPlayerPed'] = PLAYER_PED

Server Side

The server sided Player module functions will be listed here later.

Callbacks

The callback module contains all functions that make callbacks possible to the server and client side. Here is a full list of useful functions:

Client Side

TriggerCallback(Name : String, Callback : any, OtherParameters...)

Triggers a callback in the server side.

Returns: value within Callback

SendCallback(Name : String, OtherParameters...)

Triggers a callback in the server side and returns the result. (Can be useful to use to with a variable declaration)

Returns: value within Callback

CreateCallback(Name : String, Callback : function)

Creates a callback in the client side.

Server Side

TriggerCallback(Name : String, Callback : any, OtherParameters...)

Triggers a callback in the client side.

Returns: value within Callback

CreateCallback(Name : String, Callback : function)

Creates a callback in the server side.

Events

The Events Module makes it possible to created token protected events. There is no possible way for a hacker to trigger these kind of events without knowing the token. Which is stored in the server side. Here is a full list of useful functions:

Client Side

TriggerServer(Name : String, OtherParameters...)

This will trigger a token protected event, it will automatically fill in the token, then trigger the event like any other event.

Server Side

RegisterServer(Name, Source : int, OtherParameters...)

This will register a token protected event.

Blip Manager

The Blip Manager Module makes it super easy to create, edit and remove blips. Here is a full list of useful functions:

Client Side

CreateBlip = function(BlipId: String, Coords: vector3, Text: String, Logo: int, FirstColor: int, Flashing: boolean, Size: float, ShortRange: boolean, Category: int, Number: int, Cone: boolean)

This will create a blip using the given variables and save it locally.

CreateRadiusBlip = function(BlipId: String, Coords: vector3, Color: int, Radius: float)

This will create a radius blip and save it locally. Can be useful to highlight a specific region on the map. eg. A hunting zone,..

SetBlipCoords = function(BlipId: String, Coords: vector3)

This will edit a locally saved blip it's coords to the newly given ones.

RemoveBlip = function(BlipId: String)

This will remove a locally saved blip given a valid BlipId.

GetBlipById = function(BlipId: String)

This will return the data of a locally stored blip given a valid BlipId.

GetAllBlipsData = function(Type: String)

This will return all the blips within the provided type category. (eg. 'Radius' blips or 'Normal' blips)

Entity

The Entity Module makes it super easy to spawn, despawn and place entities. Here is a full list of useful functions:

Client Side

EnumerateObjects()

Gets all nearby objects and returns them.

EnumeratePeds()

Gets all nearby peds and returns them.

EnumerateVehicles()

Gets all nearby vehicles and returns them.

EnumeratePickups()

Gets all nearby pickups and returns them.

CreateEntity = function(Model: String | int, Coords: vector3, Networked: boolean)

This will create an object, ped, entity and load it when it is not loaded yet.

DeleteEntity = function(Entity: String | int)

This will delete the entity server sided even if the script has no control over the entity.

IsPlacingEntity()

Used to check if the player is using the entity placer.

StopEntityPlacer()

Used to forcefully stop the entity placing process.

DoEntityPlacer = function(Model: String | int, MaxDistance: float, StickToGround: boolean, PlayerHeading: float, ZMin: float, Cb: function)

Usefull function to place entities around the world.

Functions

The Function Module stores very useful functions that can be used for the development of new resources. Here is a full list of the functions:

Client Side

GetEntityPlayerIsLookingAt = function(Distance: float, Radius: float, Flag: int, Ignore: String | int)

Gets the entity player is looking at.

CalculateZCoords = function(CoordX: float, CoordY: float, CoordZ: float)

Calculates the Z Ground coordinate for specific coords.

GetStreetName = function(Coords: vector3, Type: String)

Returns the current full street name. When Type "Single" gets provided it will return half of the street name.

GetCoords()

Returns the full coords of the player including heading: table in following format:

  ['X'] = Coords.x,
  ['Y'] = Coords.y,
  ['Z'] = Coords.z,
  ['Heading'] = Heading

RequestModel = function(Model: String | int)

Loads the provided model so it can be used to create an entity using the model.

RequestAnimDict = function(AnimDict: String)

Loads the provided Animation Dictionary so it can be used to play an animation included in the dictionary.

CreateCustomGpsRoute = function(CoordsTable: vector3)

Creates a custom GPS route that is different from the waypoint route. So it's useful for missions or other kind of needs.

ClearCustomGpsRoute()

Clears the created custom gps route.

DeepCopyTable = function(Obj: Array)

Takes a copy of the provided table sorted and returns it.

GetTaxPrice = function(Price: float, Type: String)

Adds the tax percentage on the current provided price using the provided tax type.

EncryptString = function(String: String)

Encrypts the provided string.

DecryptString = function(String: String)

Decrypts the provided string.

RoundDecimal = function(Number: float, Decimals: int)

Rounds a float number given the provided decimals.

Throttled = function(Name: String, Time: int)

Creates a locally stored Throttle timer that can be used to block certain actions for an x amount of seconds. (Time being in milliseconds)

Server Side

GetIdentifier = function(source: int, idtype: String)

Gets the specific identifier from the player.

  • Recently FiveM added a native for this called GetPlayerIdentifierByType which exactly does the same.

GetPlayerIdentifiers = function(source: int)

Gets all the player it's identifiers.

GetSource = function(identifier: String)

Gets the source id from the player using an identifier.

GetTaxPrice = function(Price: int, Type: string)

Adds the tax percentage on the current provided price using the provided tax type.

ShowError = function(resource: String, msg: String)

Useful to log error messages in console. Besides using the logger module.

ShowSuccess = function(resource: String, msg: String)

Useful to log success messages in console. Besides using the logger module.

CreateUseableItem = function(ItemData: String, cb: function)

Creates a useable item that can be used within the inventory.

CanUseItem = function(ItemData: String)

Checks if the item can be used.

UseItem = function(Source: int, ItemData: String)

Uses the provided item.

Kick = function(source: int, Reason: String, setKickReason: function, deferrals: Array)

Kicks the player using the provided reason.

IsPlayerBanned = function(Source: int)

Checks if the provided player is banned from the server.

Keybinds

The Keybinds Module stores very useful functions that can be used for linking keypresses to actions. Here is a full list of the functions:

Client Side

Add = function(CommandString: String, Category String, Description String, DefaultParameter String, OnKey: function, Event: String, IsHold: boolean, DefaultWrapper: String)

Creates a registered keybind that can be found and edited in the "FiveM" keybinds ingame.

DisableControlAction = function(Group: int, Key: int, Disable: boolean)

Disables or Enables a control (keypress) action for the player.

GetCustomizedKey = function(CommandString: String)

Gets the current player's it's keyboard key for a certain keypress action.

Logger

The Logger Module stores very useful functions that can be used for debugging or adding logs to certain actions. Here is a full list of the functions:

Client Side

Success = function(Component: String, Text : String)

Error = function(Component: String, Text : String)

Warning = function(Component: String, Text : String)

Debug = function(Component: String, Text : String)

Neutral = function(Component: String, Text : String)

Above functions just print text in client console in different styles.

ServerLog = function(Component: String, Text : String)

Creates a discord webhook log with the provided strings.

Peds

The Peds Module stores very useful functions that are mostly used to fetch information about closest peds. Here is a full list of the functions:

Client Side

GetPeds = function(IgnoreList: Array)

Returns a list of peds being in range. Ignore list can be used to ignore certain ped models.

GetPedsInArea = function(Coords: vector3, Radius: float)

Returns a list of closest peds given the coords and radius.

GetClosestPed = function(Coords: vector3, IgnoreList: Array)

Returns the closest ped it's id and distance to the player. Ignore list can be used to ignore certain ped models.

Vehicles

The Vehicles Module stores very useful functions that are mostly used to spawn, save and fetch data about vehicles. Here is a full list of the functions:

Client Side

SpawnVehicle = function(VehicleName: String, Coords: {X: float, Y: Float: Z: Float}, Plate: String, Warp: boolean)

Spawns a server synced vehicle with the provided model and coords, plate,..

SpawnLocalVehicle = function(VehicleName: String, Coords: {X: float, Y: Float: Z: Float}, Plate: String, Warp: boolean, Ground: boolean)

Spawns a non server synced vehicle which will despawn when you go out of a certain range. This with the provided model, coords, plate,..

RepairVehicle = function(Vehicle)

SetVehicleFuelLevel = function(Vehicle, Level)

SetVehicleTyreBurst = function(Vehicle, Index, OnRim, TyreHealth)

SetVehicleTyreFixed = function(Vehicle, Index)

SetTyreHealth = function(Vehicle, Index, Health)

SetVehicleOnGroundProperly = function(Vehicle)

SetVehicleDoorsLocked = function(Vehicle, Status)

SetVehicleDoorOpen = function(Vehicle, Index)

SetVehicleDoorShut = function(Vehicle, Index)

SetVehicleDirtLevel = function(Vehicle, Level)

SetVehicleNumberPlate = function(Vehicle, Plate)

DeleteVehicle = function(Vehicle)

Above functions are the better versions of the FiveM Natives. It firstly checks if the network has control over the entity. If it doesn't it syncs with the server.

GetVehicles()

Returns all vehicles in the range of the player.

GetClosestVehicle = function(Coords: vector3)

Returns the closest vehicle to the provided coords: table in following format:

  ['Distance'] = -1,
  ['Vehicle'] = -1

GetVehiclesInArea = function(Coords: vector3, Radius: float)

Returns all the vehicles within the provided radius on a specific location.

CanVehicleSpawnAtCoords = function(Coords: vector3, Radius: float)

Checks if a vehicle can be spawned on a location and there is not other object blocking it.

GetVehicleMods = function(Vehicle: int)

Gets all the vehicle mods currently applied on the provided vehicle.

ApplyVehicleMods = function(Vehicle: int, VehicleMods: Array, Plate: String, FadeIgnore: boolean)

Applies specific vehicle mods on the vehicle.

GetVehicleDamage = function(Vehicle: int)

Gets the current damage to the vehicle. Windows, doors and tyres.

DoVehicleDamage = function(Vehicle: int, VehicleDamage: Array, Metadata: Array)

Applies damage to the vehicle. Can be windows, tyres, engine,..

SaveVehicle = function(Vehicle: int, Plate: String, MetaData: Array, Type: String)

Saves the provided vehicle to the database and saves the vehicle mods and damage.

Commands

The Commands Module stores commands in a special way so it can be restricted to specific ranks and it can have aliases. Here is a full list of the functions:

Server Side

Add = function(Name: String, Help : String, Arguments: Array, ArgsRequired: boolean, CMDCallback: function, Permission: String)

Creates a command, could be rank restricted or not. Could also have multiple aliases by making the Name variable a table with strings.

Refresh = function(source: int)

Refreshes the command suggestions.

CallCommand = function(source: int, Message: String)

Executes a commmand.

Database

The Database Module has useful functions that can be used to fetch data out of the database or store / update it. Here is a full list of the functions:

Server Side

Execute = function(Query: String, Data: Array, Cb: function, Wait: boolean)

The execute function is optimized for query operations, it can be awaited by using enabling Wait parameter.

Insert = function(Query: String, Data: Array, Cb: function, Wait: boolean)

The insert function is optimized for insert operations, it can be awaited by using enabling Wait parameter.

Update = function(Query: String, Data: Array, Cb: function, Wait: boolean)

The update function is optimized for update operations, it can be awaited by using enabling Wait parameter.

That's it. All modules and their functions listed above. If you have any questions, we are more than happy to help you on our Discord Server.

Previous
Custom scripts

© 2024 Mercy Collective

Not affiliated with Take-Two interactive