Retrieve the player crew or return false if not an active member.
localmyCrew=exports['av_racing']:getCrew()ifmyCrewthen-- returns a table {name:string, label:string and isBoss:boolean}print("Crew Name: "..myCrew['name'])print("Crew Label: "..myCrew['label'])print("Crew Label: ", myCrew['isBoss'])elseprint("Not a crew member")end
inRace()
Returns false if player is not in a race or a table with the following data:
started:boolean Race is in progress
raceId:string Race ID
isPassenger:boolean false means player is driver, true is passenger.
quitRace()
Removes the player from a race, returns true if player was actually in a race and was successfully removed.
registerCrew(source,crewName,boss)
Use this export to register a new crew from an external script.
params:
source number: Player server id triggering the export.
creaName string: Name of the racing crew.
boss number: Player server Id who's gonna be assigned as crew leader.
getCrew(playerId)
Retrieve a player crew or false if player is not an active member.
generateRace(eventData)
Generate a new Event from an external resource.
params:
track:string Track identifier/name.
title?:string Event title.
moneyAccount?:string Money account to use or false if is gonna be free.
startsin:number = Time to start (in minutes)
buyin?:number = Buy in or false to make it free
laps?:number = Amount of laps, false or 0 will be drag
class?:string = Vehicle class, if not specified then will be set to "all"
description?:string = Event description
password?:string = Event password or false
type?:string = Event type ("drag", "circuit", "bikes"), default "circuit"
accountLabel?:string = Money account label to show, if missing it will use moneyAccount value
phasing?:string = Phasing value or false to not use phasing at all
isRanked?:boolean = Event will affect player elo
isCrew?:boolean= Lock the event to only crew members
hostName?:string = Specify a host name, default is "SYSTEM"
reversed?:boolean = Reverse checkpoints
moneypot?:number = Starting money pot
returns:
generated:boolean
addXP(playerId,amount)
This export allows you to add extra XP to racer.
params:
playerId:number Player server ID
amount:number Amount to add
returns:
success:boolean
removeXP(playerId,amount)
Remove XP from racer.
params:
playerId:number Player server ID
amount:number Amount to remove
returns:
success:boolean
getRedeemed(playerId,identifier?)
Checks if a player has already redeemed a specific reward.
If the identifier argument is omitted, it returns the entire list of redeemed items for that player.
params:
playerId:number Player server ID
identifier?:string Prize identifier, should match one from server/editable/_progression.lua
returns:
result:boolean|table
Last updated
local src = 1
local crewName = "Los Vagos Racing"
local boss = 2
exports['av_racing']:registerCrew(src,crewName,boss)
local myCrew = exports['av_racing']:getCrew(source)
if myCrew then -- returns a table {name:string, label:string and isBoss:boolean}
print("Crew Name: "..myCrew['name'])
print("Crew Label: "..myCrew['label'])
print("Crew Label: ", myCrew['isBoss'])
else
print("Not a crew member")
end
local raceData = {
track = "legion_square_circuit", -- Track identifier or name
title = "Midnight Madness", -- (Optional) Event name
description = "S Class only. High stakes.", -- (Optional) Event description
startsin = 5, -- Time to start (in minutes)
laps = 3, -- Amount of laps (0 or false = drag/sprint)
type = "circuit", -- "drag", "circuit", "bikes" (Default: "circuit")
reversed = false, -- Run the track backwards (Finish -> Start)
class = "s", -- Vehicle class ("s", "a", "b"... or "all")
phasing = "full", -- Phasing type or false (no phasing)
isRanked = true, -- If true, race affects Elo rating
isCrew = false, -- If true, restricts to Crew members only
moneyAccount = "cosmo", -- Account to deduct money from
accountLabel = "Cosmo", -- (Optional) Label shown in UI
buyin = 1000, -- Entry fee (number) or false for free
moneypot = 5000, -- (Optional) Starting money added to the pot
password = "123", -- String for password or false for public
hostName = "Server Event", -- (Optional) Custom host name (Default: "SYSTEM")
}
local generated = exports['av_racing']:generateRace(raceData)
print(generated)
local playerId = 1
local prizeIdentifier = "Level1"
-- we are sending the prize identifier, we will receive true/false:
local result = exports['av_racing']:getRedeemed(playerId, prizeIdentifier)
print(result) -- true/false
-- This prints a list of strings containing all redeemed prizes by the player:
local result2 = exports['av_racing']:getRedeemed(playerId)
print(result2 and json.encode(result2))