Server

This page lists all the available server-side events and exports.

Exports (Listeners)

onGroups

  • Used for listening for any onGroups actions

onGroups
  • Params:

    Name
    Type
    Description

    listenerName

    string

    Name of the listener to register for onGroups events

  • Returns:

    • string: Type - current action/task being done

    • table: The data of player in that group

  • Example:

-- return: type: string, data: table
exports["rcore_police"]:registerListener("onGroups", function(type, data)
    print("Received 'onGroups' event:")
    print("Type:", type)
    print("Data:", json.encode(data))
end)

onState

  • Used for listening for any interaction actions on players

onState
  • Params:

    Name
    Type
    Description

    listenerName

    string

    Name of the listener to register for onState events

  • Returns:

    • type: Current type (string)

    • action: Current action (string)

    • playerId: Performed state change on playerId (number)

  • Example:

-- return: type: string, action: string, playerId: number
exports["rcore_police"]:registerListener("onGroups", function(type, action, playerId)
    print("Received 'onState' event:")
    print("Type:", type)
    print("Action:", action)
    print("Player ID:", playerId)
end)

Exports (States)

IsPlayerCuffed

  • Used for checking if player is cuffed

IsPlayerCuffed
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which you want to get state of cuffed

  • Returns:

    • boolean: true if player is cuffed, otherwise false.

  • Example:

-- playerId: number
-- return: boolean
local isCuffed = exports['rcore_police']:IsPlayerCuffed(playerId)

if isCuffed then
    print('Player is cuffed')
else
    print('Player is not cuffed')
end

IsPlayerEscorted

  • Used for checking if player is escorted

IsPlayerEscorted
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which you want to get state of escort

  • Returns:

    • boolean: true if player is escorted, otherwise false.

  • Example:

-- playerId: number
-- return: boolean
local isEscorted = exports['rcore_police']:IsPlayerEscorted(playerId)

if isEscorted then
    print('Player is escorted')
else
    print('Player is not escorted')
end

IsPlayerHeadBagged

  • Used for checking if player is head bagged

IsPlayerHeadBagged
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which you want to get state of head bag

  • Returns:

    • boolean: true if player is head bagged, otherwise false.

  • Example:

-- playerId: number
-- return: boolean
local isHeadBagged = exports['rcore_police']:IsPlayerHeadBagged(playerId)

if isHeadBagged  then
    print('Player is head bagged')
else
    print('Player is not head bagged')
end

Exports (Actions)

JailPlayer

  • Used for jailing player, it will open Dialog form to put specific player in jail

JailPlayer
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to get jailed

  • Returns:

    • boolean: true if player is jailed, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isJailed, statusOrErr = exports['rcore_police']:JailPlayer(playerId, target)

if isJailed then
    print('Player is jailed')
else
    print('Player is not jailed an error occurred:', statusOrErr)
end

SearchPlayer

  • Used for searching player, it will try to open search of target player inventory

SearchPlayer
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to search inventory

  • Returns:

    • boolean: true if player is searched, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isSearched, statusOrErr = exports['rcore_police']:SearchPlayer(playerId, target)

if isSearched then
    print('Player is searched')
else
    print('Player is not searched an error occurred:', statusOrErr)
end

Escort

  • Used for setting/unsetting escort to target player

Escort
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to get escorted

  • Returns:

    • boolean: true if player is escorted, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isEscorted, statusOrErr = exports['rcore_police']:Escort(playerId, target)

if isEscorted then
    print('Player is escorted')
else
    print('Player is not escorted')
end

Zipties

  • Used for setting/unsetting Zipties to target player

Zipties
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to set zipties

  • Returns:

    • boolean: true if player is ziptied, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isZiptied, statusOrErr = exports['rcore_police']:Zipties(playerId, target)

if isZiptied then
    print('Player is ziptied')
else
    print('Player is not ziptied')
end

Handcuff

  • Used for setting/unsetting Handcuff to target player

Handcuff
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to set handcuffs

  • Returns:

    • boolean: true if player is handcuffs, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isCuffed, statusOrErr = exports['rcore_police']:Handcuff(playerId, target)

if isCuffed then
    print('Player is handcuffed')
else
    print('Player is not handcuffed')
end

PutPlayerInVehicle

  • Used for PutPlayerInVehicle target player into nearby vehicle seat

PutPlayerInVehicle
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to set into vehicle

  • Returns:

    • boolean: true if player is set into vehicle, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isInVehicle, statusOrErr = exports['rcore_police']:PutPlayerInVehicle(playerId, target)

if isInVehicle then
    print('Player is in vehicle')
else
    print('Player is not in vehicle')
end

TakePlayerFromVehicle

  • Used for TakePlayerFromVehicle target player from nearby vehicle

TakePlayerFromVehicle
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to get from vehicle

  • Returns:

    • boolean: true if player is outside of vehicle, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isFromVehicle, statusOrErr = exports['rcore_police']:TakePlayerFromVehicle(playerId, target)

if isFromVehicle then
    print('Player is not in vehicle')
else
    print('Player is in vehicle')
end

RemoveHandcuff

  • Used for removing handcuffs/zipties from target player

RemoveHandcuff
  • Type: boolean

  • Default value:: false

  • Params:

    Name
    Type
    Description

    playerId

    number

    ID of player which is starting the interaction

    target

    number

    ID of player which you want to remove handcuffs/zipties

  • Returns:

    • boolean: true if player handcuffs/zipties are removed, otherwise false.

    • string: Status code or error message

  • Example:

-- playerId: number
-- target: number
-- return: boolean, string
local isRemovedCuffs, statusOrErr = exports['rcore_police']:RemoveHandcuff(playerId, target)

if isRemovedCuffs then
    print('Player is free')
else
    print('Player not free')
end

Exports (General)

GetPoliceOnline

  • Used for getting all police officers online

GetPoliceOnline
  • Type: number

  • Default value:: 0

  • Returns:

    • number: Number of officers online, by default returns 0 when not any online

  • Example:

-- return: number
local policeOnline = exports['rcore_police']:GetPoliceOnline()

if policeOnline then
    print('Online units: ', retval)
end

Last updated

Was this helpful?