AV Racing uses 4 different functions to verify player permissions, go to server/framework/permissions.lua, you will find the following functions:

1) CanCreateTracks()

  • This function is used to retrieve the player permissions to access the Create Track button in Racing APP (the blue one from the Tracks tab).

2) CanCreateRaces()

  • This function is used to retrieve the player permissions to access the Create Race button. Players with this permission will be able to organize and start races.

3) CanDeleteTracks()

  • This function retrieves player permissions to access the Delete Track button. If a Track is deleted can't be recovered, all the checkpoints and leaderboard will be lost.

4) AdminCrew()

  • This function gives you access to the command /racing:crew where you can create and delete racing crews.

This 3 functions are pre configured to retrieve the player admin permissions, but you can modify every function and make it compatible with your custom checks like job, job grades, items, etc. Here is an example on how to add a check with item, if the Player have the golden_dongle it will return true:

function CanCreateTracks(src) -- Player can create new tracks
    local permission = false
    permission = exports['av_laptop']:hasItem(src,'golden_dongle')
    return permission

Or maybe you want to add manually the Players identifier to a table:

local allowed = { -- Table with the players citizenid/character identifier
    ['XDFGH1'] = true,
    ['ABC123'] = true,

function CanCreateRaces(src) -- Player can create new events (races)
    local permission = false
    local identifier = exports['av_laptop']:getIdentifier(src)
    if allowed[identifier] then
        permission = true
    return permission

Last updated