Config
Main Config
-- Enable debug make sure FiveM client is "Beta Channel" in setting to use more dev command.
-- Enter race faster by skip intro
-- Skip all cutscene
-- Test map 1-test will enable.
Config.Debug = false
Config.BypassRoutingBucketEntityLockdownMode = false -- Bypass SetRoutingBucketEntityLockdownMode(1, "strict") or "sv_entityLockdown strict"
Config.MinPlayers = 2 -- Minimum of player to allow counwdown (Set to 1, Trial mode will enable).
Config.LobbyTime = 30 -- Countdown timer to start race if minimum player reached Config.MinPlayers. (Second)
Config.ArenaTime = 120 -- Duration in race game before room auto close. (Minute)
Config.OwnWorld = true -- Race in another world. Participants and the non participants will not see each other.
Config.KickNotReady = true -- Kick player who not ready while host press play the race.
Config.KickAFK = true -- KLick player who away from keyboard more than 2 minute
Config.RecordsBestLapTimeByMap = false -- By default records use map and class for get records, set to true for use only map.
Config.EndGameDNFTimed = 5 -- Countdown timer of DNF, start contdown when finish line reached DNF setting number. (Second)
Config.AllowCommandPointmarker = { -- darkrp_pointmarker command, empty table this for allow everyone.
"steam:11000010971396e", -- steamID64 (Hex) https://www.steamidfinder.com/lookup
"steam:11000010572b40c", -- steamID64 (Hex) https://www.steamidfinder.com/lookup
"license:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"xbl:xxxxxxxxxxxxxxxx",
"live:xxxxxxxxxxxxxxx",
"fivem:xxxxx",
}
Config.AllowCommandEndgame = { -- darkrp_endgame command, for debug make next checkpoint to finishline, empty table this for allow everyone
"steam:11000010971396e", -- steamID64 (Hex) https://www.steamidfinder.com/lookup
"steam:11000010572b40c", -- steamID64 (Hex) https://www.steamidfinder.com/lookup
"license:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"xbl:xxxxxxxxxxxxxxxx",
"live:xxxxxxxxxxxxxxx",
"fivem:xxxxx",
}
Config.Game.AntiKnockedOffVehicle = true -- while vehicle is hit hard and the player will be knocked off.
Config.Game.RaceStartBoost = true -- Race start with turbo.
Config.Game.LoadMapTimeout = 60 -- If the player load map for more than X seconds player will be kicked out of race, set to 0 for disable. (Seconds)
Config.Game.ScaleformRequestTimeout = 1000 -- Request scaleform timeout if not loaded. (Millisecond)
Config.Game.HUD.HideUI = false
Config.Game.HUD.PaddingBottom = 0.0 -- If race HUD overlap other script HUD, try increase this value.
Config.Game.HUD.PaddingRight = 0.0 -- If race HUD overlap other script HUD, try increase this value.
Config.Game.HUD.RankPaddingBottom = 0.0 -- If race rack display HUD overlap, try increase this value.
Config.Game.HUD.RankFont = 4 -- Font of rank display HUD. https://docs.fivem.net/natives/?_0x66E0276CC5F6B9DA
Config.Game.HUD.Speedo.Metric = not IsDuplicityVersion() and ShouldUseMetricMeasurements() or false -- Speedometer MPH, KPH, "" to disable speedometer.
Config.Game.HUD.Speedo.Font = 4 -- Font of Speedometer HUD.
-- Example: https://forum.cfx.re/t/how-to-create-own-racing-gta-o-style/4898111/5
Config.Game.Scoreboard.LeftTextFormat = "player_name" -- Default Z scoreboard display text format left.
Config.Game.Scoreboard.RightTextFormat = "player_timediff + string_space + ~y~ + player_checkpoint + / + player_totalcheckpoint" -- Default Z scoreboard display text format right.
--[[ Create race menu]]--
Config.Menu.KeepLobbyAlive = true -- Keep Lobby Alive setting in race menu.
Config.Menu.DefaultRadio = "RANDOM" -- RANDOM, OFF
Config.Menu.GettingVehicleNoClassLimit = false -- Allow use any class getting in the own vehicle before the lobby starts.
Config.Menu.PersonalVehicleMenu.Enable = true -- Allow player can user Personal Vehicle Menu to select vehicle for race, disable it for only use player sitting vehicle before the lobby starts.
Config.Menu.PersonalVehicleMenu.Customize = true -- Allow player can user Personal Vehicle Menu customize selected vehicle such as upgrade changeing part.
Config.Menu.PersonalVehicleMenu.Vstancer = true -- Enable Personal Vehicle wheels Track Width, Camber
Config.Menu.PersonalVehicleMenu.ReadyCountdown = 30 -- Countdown timer of personal vehicle menu closeing when first player enter ready. (Second)
Config.Menu.Leaderboard.Enable = true -- Enable leaderboard in race menu.
Config.Menu.TabInfo.Enable = true -- Enable infomation in race menu.
Config.Menu.TabInfo.Data = { -- Racing menu infomation tab view
"~BLIP_INFO_ICON~ ~h~DarkRP_Racing/config/config.lua > Config.Menu.TabInfo.Data~h~",
"Blip ~BLIP_RACEFLAG~ ~BLIP_BASE_JUMP~ ~BLIP_TRIATHLON~", -- https://docs.fivem.net/docs/game-references/blips/ ( Change radar_ to blip_ )
"Input ~INPUT_SPRINT~ ~INPUT_JUMP~ ~INPUT_ENTER~", -- https://docs.fivem.net/docs/game-references/controls/
"Input group ~INPUTGROUP_FRONTEND_DPAD_ALL~ ~INPUTGROUP_FRONTEND_LSTICK_ALL~", -- https://github.com/TanKode/fivem-lua-sdk/blob/master/client/native/controls.lua#L1
"You can add more table for next line unlimit.",
"You can add more table for next line unlimit.",
"You can add more table for next line unlimit.",
}
Config.Menu.BettingList = { -- For menu select betting price.
1000, 10000, 30000, 50000,
}
-- Add hash of fixtures such as lamp posts and signs which will be removed from the world during the race.
Config.Game.RoadTrafficNSignProps = {
[`prop_beach_parasol_09`]=true,[`prop_sign_road_04i`]=true,[`prop_cs_bin_02`]=true
}
Config.Game.RankUpdateRefreshRate = 1000 -- ms, Rate send data to server for calculation of player rank position.
Config.Game.TextureVariant = math.random(0, 15) -- Color of stunt object // https://docs.fivem.net/natives/?_0x971DA0055324D033
Config.Game.ShowPlayerBlipName = true -- Display player blip and name on head.
Config.Game.MapLodDist = 1000 -- How far players to see map objects.
Config.Game.Player = {
BlipScale = 0.7,
GameDistance = 300.0, -- Distance for display name on head in race.
NormalDistance = 100.0, -- Default distance for display name on head after race end (Back to normal distance after racing).
}
-- Config.EndScreen.XP : Display XP rank system on end screen.
-- Example is https://github.com/chaixshot/DarkRP_XP
local DarkRP_XP = exports["DarkRP_XP"]
-- Current XP in rank system.
Config.EndScreen.XP.GetXPBeforeGain = function(source)
if GetResourceState("DarkRP_XP") == "started" then -- DarkRP_XP request.
return DarkRP_XP:GetCurrentPlayerXP()
else
return 0
end
end
-- Minimum XP of current rank.
Config.EndScreen.XP.GetMinLevelXP = function(source)
if GetResourceState("DarkRP_XP") == "started" then -- DarkRP_XP request.
return DarkRP_XP:GetXPCeilingForLevel(DarkRP_XP:GetCurrentPlayerLevel()-1)
else
return 0
end
end
-- Maximum XP of current rank.
Config.EndScreen.XP.GetMaxLevelXP = function(source)
if GetResourceState("DarkRP_XP") == "started" then -- DarkRP_XP request.
return DarkRP_XP:GetXPCeilingForLevel(DarkRP_XP:GetCurrentPlayerLevel())
else
return 0
end
end
-- Current rank.
Config.EndScreen.XP.GetCurrentRank = function(source)
if GetResourceState("DarkRP_XP") == "started" then -- DarkRP_XP request.
return DarkRP_XP:GetCurrentPlayerLevel()
else
return 1
end
end
-- Rank next from current rank.
Config.EndScreen.XP.GetNextRank = function(source)
if GetResourceState("DarkRP_XP") == "started" then -- DarkRP_XP request.
return DarkRP_XP:GetCurrentPlayerLevel() + 1
else
return 1
end
end
Config.EndScreen.Money = { -- Display money on end screen.
topText = "",
bottomText = "",
rightHandStat = "",
rightHandStatIcon = 3, --0 or 1 = checked, 2 = X, 3 = no icon
}
Config.EndScreen.ResultsPanelTime = 10 -- sec
Config.EndScreen.Animation = { -- TaskPlayAnim(dict, anim)
{"anim@amb@nightclub@mini@dance@dance_solo@male@var_b@", "high_center_down"},
{"anim@amb@nightclub@mini@dance@dance_solo@male@var_a@", "high_center"},
{"anim@amb@nightclub@mini@dance@dance_solo@male@var_b@", "high_center_up"},
{"anim@amb@casino@mini@dance@dance_solo@female@var_a@", "med_center"},
{"misschinese2_crystalmazemcs1_cs", "dance_loop_tao"},
{"misschinese2_crystalmazemcs1_ig", "dance_loop_tao"},
{"missfbi3_sniping", "dance_m_default"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@", "med_center_up"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@", "high_center"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@", "high_center_up"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@", "high_center_up"},
{"anim@amb@nightclub_island@dancers@beachdance@", "hi_idle_a_m03"},
{"anim@amb@nightclub_island@dancers@beachdance@", "hi_idle_a_m05"},
{"anim@amb@nightclub_island@dancers@beachdance@", "hi_idle_a_m02"},
{"anim@amb@nightclub_island@dancers@beachdance@", "hi_idle_b_f01"},
{"anim@amb@nightclub_island@dancers@club@", "hi_idle_a_f02"},
{"anim@amb@nightclub_island@dancers@club@", "hi_idle_b_m03"},
{"anim@amb@nightclub_island@dancers@club@", "hi_idle_d_f01"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@", "low_center"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@", "low_center_down"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_b@", "low_center"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_b@", "high_center"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_b@", "high_center_up"},
{"anim@amb@nightclub@mini@dance@dance_solo@male@var_a@", "low_center"},
{"anim@amb@nightclub@mini@dance@dance_solo@female@var_b@", "low_center_down"},
{"anim@amb@nightclub@mini@dance@dance_solo@male@var_b@", "low_center"},
{"rcmnigel1bnmt_1b", "dance_loop_tyler"},
{"special_ped@mountain_dancer@monologue_3@monologue_3a", "mnt_dnc_buttwag"},
{"move_clown@p_m_zero_idles@", "fidget_short_dance"},
{"move_clown@p_m_two_idles@", "fidget_short_dance"},
{"anim@amb@nightclub@lazlow@hi_podium@", "danceidle_hi_11_buttwiggle_b_laz"},
{"timetable@tracy@ig_5@idle_a", "idle_a"},
{"timetable@tracy@ig_8@idle_b", "idle_d"},
{"anim@mp_player_intcelebrationfemale@the_woogie", "the_woogie"},
{"anim@amb@casino@mini@dance@dance_solo@female@var_b@", "high_center"},
}
Config.Vehicle.PlateText = "DARKRP"
Config.Vehicle.ErrorModel = "bmx" -- If vehicle model in map file could not be found will be replaced with this.
Config.Vehicle.Class = {
--[[
Default vehicle by class if player no vehicle to play race.
Player can use own vehicle by sit in vehicle before race starting.
Try test you vehicle every map, because some may not be able to drive.
Don't change class name.
]]
["Compacts"]= {"asbo", "blista", "brioso", "brioso2", "brioso3", "club", "dilettante", "dilettante2", "issi2", "issi3", "issi4", "issi5", "issi6", "kanjo", "panto", "prairie", "rhapsody", "weevil"},
["Coupes"]= {"cogcabrio", "driftfr36", "eurosx32", "exemplar", "f620", "felon", "felon2", "fr36", "jackal", "kanjosj", "oracle", "oracle2", "postlude", "previon", "sentinel", "sentinel2", "windsor", "windsor2", "zion", "zion2"},
["Cycles"]= {"bmx", "cruiser", "fixter", "inductor", "inductor2", "scorcher", "tribike", "tribike2", "tribike3"},
["Emergency"]= {"ambulance", "fbi", "fbi2", "firetruk", "lguard", "pbus", "poldominator10", "poldorado", "polgauntlet", "polgreenwood", "police", "police2", "police3", "police4", "police5", "policeb", "policeold1", "policeold2", "policet", "policet3", "polimpaler5", "polimpaler6", "pranger", "riot", "riot2", "sheriff", "sheriff2"},
["Industrial"]= {"bulldozer", "cutter", "dump", "flatbed", "guardian", "handler", "mixer", "mixer2", "rubble", "tiptruck", "tiptruck2"},
--[[Custom Class]]--
[GetTranslate("create_freeforall")] = GetTranslate("create_freeforall"), -- Comment this line if you want disable "Free for All" class.
-- ["Custom Super 1"] = {"zentorno", "zorrusso"}, -- Make it table data to enable special menu (Yellow text). (Vehicle select, Random vehicle per lap)
["Custom Super 2"] = "zentorno", -- Only 'zentorno' in this class.
}
Config.Image.Class = {
["Motorcycles"] = "https://static.wikia.nocookie.net/gtawiki/images/7/74/PCJ600-GTAV-front.png",
["Muscle"] = "https://static.wikia.nocookie.net/gtawiki/images/f/fe/Greenwood-GTAOe-front.png",
["Sports"] = "https://static.wikia.nocookie.net/gtawiki/images/4/40/OmnisEGT-GTAOe-front.png",
["Super"] = "https://static.wikia.nocookie.net/gtawiki/images/a/a9/ToreroXO-GTAOe-front.png",
["Compacts"] = "https://static.wikia.nocookie.net/gtawiki/images/7/7d/IssiUp-GTAV-front.png",
["Sports Classics"] = "https://static.wikia.nocookie.net/gtawiki/images/f/f6/Toreador-GTAO-front.png",
["Sedans"] = "https://static.wikia.nocookie.net/gtawiki/images/e/e1/Tailgater-GTAV-front.png",
["Off-Road"] = "https://static.wikia.nocookie.net/gtawiki/images/9/97/Mesa-GTAV-front.png",
["Suvs"] = "https://static.wikia.nocookie.net/gtawiki/images/7/77/Landstalker-GTAV-front.png",
["Coupes"] = "https://static.wikia.nocookie.net/gtawiki/images/4/4c/Sentinel-GTAIV-front.png",
["Cycles"] = "https://static.wikia.nocookie.net/gtawiki/images/5/5d/Tri-CyclesRaceBike-GTAV-front.png",
["Custom Super"] = "https://static.wikia.nocookie.net/gtawiki/images/c/cf/LM87-GTAOe-front.png",
}
-- Player display name, can change to RP name.
event.getPlayerName = function(source --[[ number]])
if source then
local name = GetPlayerName(source)
return name ~= "**Invalid**" and name or "Unknown"
else
return "Unknown"
end
end
-- Check player money befor join lobby.
event.checkMoney = function(source --[[ number]], price --[[ number]])
if true then
return true
else
event.showNotification(source, "Not enough")
return false
end
--[[ Example for ESX
ESX = nil
TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end)
local xPlayer = ESX.GetPlayerFromId(source)
local money = xPlayer.getMoney()
if money > 0 and money >= price then
return true
else
event.showNotification(source, "Not enough")
return false
end
]]--
end
-- Make player pay bet if can and join game or awlay true if you wan't.
event.removeMoney = function(source --[[ number]], price --[[ number]], totalPlayer)
-- if totalPlayer > 1 then -- Free for play 1 player.
--[[ Example for ESX
ESX = nil
TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeMoney(price)
]]--
-- else
-- end
end
-- give money to player when win race
-- "money" come from event.calculateReward() "reward"
event.giveMoney = function(source --[[ number]], money --[[ number]])
--[[ Example for ESX
ESX = nil
TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addMoney(money)
]]--
end
event.calculateReward = function(totalPlayer, playerData, matchData)
-- totalPlayer : Number of players count except spectator.
local playerRank = playerData.FinishedPlace -- finishing place.
local playerLaps = playerData.Laps -- Laps player can make.
local totalBet = matchData.AllBet -- all player betting.
local totalCheckpoint = matchData.Checkpoint -- number of checkpoint count.
local mode = matchData.Mode -- game mode of race (stunt, timed, facetoface, parkour, destroylastplace, deadline, timed).
local reward_money = 0
local reward_exp = 0
if mode == "stunt" then
totalBet = totalBet
elseif mode == "facetoface" then
totalBet = totalBet*4
elseif mode == "parkour" then
totalBet = totalBet*2
elseif mode == "destroylastplace" then
totalBet = totalBet
elseif mode == "deadline" then
totalBet = totalBet
elseif mode == "timed" then
totalBet = totalBet/playerLaps
elseif mode == "sumo" then
totalBet = totalBet
elseif mode == "sumoremix" then
totalBet = totalBet
end
if playerRank == 1 then -- 1st place
reward_money = totalBet*(50/100) -- give 50% from all player betting to 1st place.
elseif playerRank == 2 then -- 2nd place
reward_money = totalBet*(35/100) -- give 35% from all player betting to 2nd place.
elseif playerRank == 3 then -- 3rd place
reward_money = totalBet*(25/100) -- give 30% from all player betting to 3rd place.
else -- other place
reward_money = totalBet*(15/100) -- give 5% from all player betting to other place.
end
reward_money = (reward_money*totalCheckpoint)/totalPlayer/4
if playerRank == 1 then -- 1st place
reward_exp = totalBet*(50/100) -- give 100% of number of checkpoint count.
elseif playerRank == 2 then -- 2nd place
reward_exp = totalBet*(35/100) -- give 80% of number of checkpoint count.
elseif playerRank == 3 then -- 3rd place
reward_exp = totalBet*(25/100) -- give 70% of number of checkpoint count.
else -- other place
reward_exp = totalBet*(15/100) -- give 40% of number of checkpoint count.
end
reward_exp = ((reward_exp*totalCheckpoint)/totalPlayer)/6
return reward_money, reward_exp -- Return money and exp value back to server.
end
-- Normal notification event
event.showNotification = function(source --[[ number]], text --[[ string]])
TriggerClientEvent('DarkRP_Racing:ShowNotification', source, text)
end
-- Call when player craete race
AddEventHandler("DarkRP_Racing:OnCreateArena", function(gameid --[[ number]])
end)
-- Call when lobby countdown end
AddEventHandler('DarkRP_Racing:OnSessionStart', function(gameid --[[ number]])
end)
-- Call when player entered race
AddEventHandler('DarkRP_Racing:OnPlayerStartRace', function(source --[[ number]], gameid --[[ number]])
end)
-- Call when player exited race
AddEventHandler('DarkRP_Racing:OnPlayerExitRace', function(source --[[ number]], gameid --[[ number]])
end)
-- Call when player finished last checkpoint
AddEventHandler('DarkRP_Racing:FinishedChekpoint', function(source, data)
-- data.raceid
-- data.identifier
-- data.map
-- data.name
-- data.time
-- data.bestlaptime
-- data.lap
-- data.race_mode
-- data.race_weather
-- data.race_time
-- data.race_class
-- data.race_racetype
-- data.race_finishedwith
end)
---Call to fix player vehicle
---@param vehicle integer Vehicle id
event.fixVehcile = function(vehicle)
SetVehicleUndriveable(vehicle, false)
SetVehicleEngineCanDegrade(vehicle, false)
SetVehicleEngineHealth(vehicle, 1000.0)
SetVehiclePetrolTankHealth(vehicle, 1000.0)
SetVehicleEngineOn(vehicle, true, true, false)
SetVehicleFixed(vehicle)
StopEntityFire(vehicle)
SetVehicleOilLevel(vehicle, 1.0)
SetVehicleDirtLevel(vehicle, 0)
SetVehicleDeformationFixed(vehicle)
SetEntityHealth(vehicle, GetEntityMaxHealth(vehicle))
local model = GetEntityModel(vehicle)
if IsThisModelAPlane(model) or IsThisModelAHeli(model) then
ControlLandingGear(vehicle, 3) -- Plane remove wheel
SetHeliBladesSpeed(vehicle, 1.0) -- Fix slow propeller respawn.
SetHeliBladesFullSpeed(vehicle) -- Fix slow propeller respawn.
end
if model == GetHashKey("avenger") or model == GetHashKey("hydra") then
SetVehicleFlightNozzlePositionImmediate(vehicle, 0.0) -- Vehicle avenger change mode
end
end
---Call to reive player
event.revivePlayer = function()
local playerPed = PlayerPedId()
if IsPlayerDead(PlayerId()) then
local coords = GetEntityCoords(playerPed, true)
local heading = GetEntityHeading(playerPed)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, 0, false)
TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, heading)
SetEntityHealth(playerPed, GetEntityMaxHealth(playerPed))
end
ClearPedBloodDamage(playerPed)
ClearEntityLastDamageEntity(playerPed)
AnimpostfxStop("DeathFailOut")
end
---Player display name, change to RP name
---@param playerID integer Player client id
---@return string String of player name
event.getPlayerName = function(playerID)
local source = GetPlayerServerId(playerID)
if RC.Players.RankBySource[source] then
return RC.Players.RankBySource[source].playerName
elseif playerID then
local name = GetPlayerName(playerID)
return name ~= "**Invalid**" and name or "Unknown"
else
return "Unknown"
end
end
---Maybe your want to bypass anticheats somehow
---@param entity integer Entity id
---@param x number Coord x
---@param y number Coord y
---@param z number Coord z
event.teleportToCoords = function(entity, x, y, z )
RequestCollisionAtCoord(x, y, z)
SetEntityCoords(entity, x, y, z, true, true, true, false)
end
---Make server force delete vehicle for everyone
---@param vehicle integer Vehicle id
event.deleteVehicle = function(vehicle)
SetVehicleAsNoLongerNeeded(vehicle)
SetEntityAsMissionEntity(vehicle, true, true)
DeleteVehicle(vehicle)
DeleteEntity(vehicle)
if DoesEntityExist(vehicle) then
TriggerServerEvent("DarkRP_Racing:DeleteVehicle", NetworkGetNetworkIdFromEntity(vehicle))
end
end
---Normal notification event
---@param msg1 string
---@param msg2 string
---@param msg3 string
event.showHelpNotification = function(msg1, msg2, msg3)
BeginTextCommandDisplayHelp("THREESTRINGS")
AddTextComponentSubstringPlayerName(msg1)
AddTextComponentSubstringPlayerName(msg2 and "~n~"..msg2 or "")
AddTextComponentSubstringPlayerName(msg3 and "~n~"..msg3 or "")
EndTextCommandDisplayHelp(0, false, true, -1)
end
RegisterNetEvent("DarkRP_Racing:showHelpNotification")
---Normal notification event
---@param msg1 string
---@param msg2 string
---@param msg3 string
AddEventHandler("DarkRP_Racing:showHelpNotification", function(msg1, msg2, msg3)
event.showHelpNotification(msg1, msg2, msg3)
end)
---Show minimap notification
---@param msg string
---@param nosound boolean Play sound?
event.ShowNotification = function(msg, nosound)
BeginTextCommandThefeedPost('STRING')
AddTextComponentSubstringPlayerName(msg)
local id = EndTextCommandThefeedPostTicker(true, true)
ThefeedRemoveItem(id-5)
if not nosound then
PlaySound(-1, "Boss_Message_Orange", "GTAO_Boss_Goons_FM_Soundset", false, 0, true)
end
end
RegisterNetEvent("DarkRP_Racing:ShowNotification")
---Show minimap notification
---@param msg string
---@param nosound boolean Play sound?
AddEventHandler("DarkRP_Racing:ShowNotification", function(msg, noSound)
event.ShowNotification(msg, noSound)
end)
---Show minimap advanced notification
---@param title string Title of notification
---@param subject string Subject of notification
---@param msg string Message of notification
---@param icon integer
---@param iconType integer Icon type
---@param noSound boolean Play sound?
AddEventHandler("DarkRP_Racing:ShowAdvancedNotification", function(title, subject, msg, icon, iconType, noSound)
local mugshot, headshot = GetPedMugshot(PlayerPedId())
BeginTextCommandThefeedPost('STRING')
AddTextComponentSubstringPlayerName(msg)
EndTextCommandThefeedPostMessagetext(headshot, headshot, false, iconType, title, subject)
local id = EndTextCommandThefeedPostTicker(true, true)
ThefeedRemoveItem(id-5)
UnregisterPedheadshot(mugshot)
if not noSound then
PlaySound(-1, "Event_Message_Purple", "GTAO_FM_Events_Soundset", false, 0, true)
end
end)
---Hide your ui for beautiful script screen, Do not loop on this it slowdown main script
---@param show boolean
event.onUiToggle = function(show)
-- Citizen.CreateThread(function()
if show then
DisplayRadar(true)
ThefeedResume()
Config.Game.HUD.HideUI = false
else
DisplayRadar(false)
for i=0,10 do
ThefeedRemoveItem(i)
end
ThefeedPause()
Config.Game.HUD.HideUI = true
end
-- end)
end
------------------------------
------------------------------
--------Event Handler-------
------------------------------
------------------------------
---Call on game spawn vehicle
---@param vehicle integer Vehicle id
---@param isNetwork boolean Is a network vehicle?
AddEventHandler("DarkRP_Racing:OnSpawnVehicle", function(vehicle, isNetwork)
end)
---Call on game spawn map object
---@param object integer Object id
AddEventHandler("DarkRP_Racing:OnSpawnObject", function(object)
end)
---Call on updated player in tick
AddEventHandler("DarkRP_Racing:OnUpdatePlayersData", function()
end)
--[[
-- Timeline on race start --
DarkRP_Racing:OnSessionStart
DarkRP_Racing:BeginReady
DarkRP_Racing:BeginRace
DarkRP_Racing:OnPlayerFinished
DarkRP_Racing:StartSpectatePlayer
DarkRP_Racing:OnSessionEnd
]]--
local IsInRace = false -- Example for loop.
---Call on object map load and race started.
AddEventHandler("DarkRP_Racing:OnSessionStart", function()
IsInRace = true
-- exports.spawnmanager:setAutoSpawn(false) -- Disable fivem auto respawn.
-- Disable voice chat.
SetPlayerTalkingOverride(PlayerId(), false)
MumbleSetActive(false)
while IsInRace do
DisableControlAction(0, 249, true) -- Disable voice chat.
Citizen.Wait(0)
end
end)
---Call on object map unload
AddEventHandler("DarkRP_Racing:OnSessionEnd", function()
IsInRace = false
-- exports.spawnmanager:setAutoSpawn(true) -- Enable fivem auto respawn.
-- Enable voice chat.
SetPlayerTalkingOverride(PlayerId(), true)
MumbleSetActive(true)
end)
---Call on all player is ready
AddEventHandler("DarkRP_Racing:BeginReady", function()
end)
---Call on race started after countdown 3 2 1
AddEventHandler("DarkRP_Racing:BeginRace", function()
end)
---Call on player finished race begin spectate mode
---@param index integer Target index slot
AddEventHandler("DarkRP_Racing:StartSpectatePlayer", function(index)
end)
---Call on exit lobby
AddEventHandler("DarkRP_Racing:OnSessionEnd", function()
end)
---Call on enter PointMarker test drive
AddEventHandler("DarkRP_Racing:StartTestDrive", function()
end)
---Call on exit PointMarker test drive
AddEventHandler("DarkRP_Racing:StopTestDrive", function()
end)
---Call on enter PointMarker mode
AddEventHandler("DarkRP_Racing:OnPointMarkerLoaded", function()
end)
---Call on exit PointMarker mode
AddEventHandler("DarkRP_Racing:OnPointMarkerUnLoaded", function()
end)
--[[
--- To save data of vehicle to personal vehicle.
TriggerEvent('DarkRP_Racing:CommandSavePersonalVehicle', GetVehiclePedIsIn(PlayerPedId(), false))
]]--
--[[
--- To open personal vehicle menu anywhere.
TriggerEvent("DarkRP_Racing:ForceOpenPersonalVehicleMenu")
]]--
--[[
--- Exports support from DarkRP_Racing for other script.
---Return true if player already join in race game.
exports.DarkRP_Racing:IsPlayerInGame() -- boolean
---Return true if player start race after countdown timer.
exports.DarkRP_Racing:IsPlayerInRacing() -- boolean
---Return true if player starting respawn to last checkpoint.
exports.DarkRP_Racing:IsPlayerRespawning() -- boolean
---Return true if player starting to change spectate target.
exports.DarkRP_Racing:IsPlayerChangeingSpectateTarget() -- boolean
---Return true if player finish race and become to spectator.
exports.DarkRP_Racing:IsPlayerOnSpectate() -- boolean
---Return true if player finish race.
exports.DarkRP_Racing:IsPlayerFinished() -- boolean
---Return true if player starting tranform vehciel by checkpoint.
exports.DarkRP_Racing:IsPlayerTransforming() -- boolean
---Return true if player starting tranform to parachute by checkpoint
exports.DarkRP_Racing:IsPlayerInTransformParachute() -- boolean
---Return true if player pickup boost ability and stil have it.
exports.DarkRP_Racing:IsPlayerHasPickupBoost() -- boolean
---Return true if player pickup rocket ability and stil have it.
exports.DarkRP_Racing:IsPlayerHasPickupRockets() -- boolean
---Return true while race game reset after winner screen showup.
exports.DarkRP_Racing:IsResetGame() -- boolean
---Return number vehicle entity of player race vehicle.
exports.DarkRP_Racing:GetPlayerRaceVehicle() -- [entity]
---Return number of player rank.
exports.DarkRP_Racing:GetPlayerRank() -- integer
---Return number of total player in race.
exports.DarkRP_Racing:GetPlayerCount() -- integer
]]--
Translate = {
["personal_setting_nocollisionselfghost_dec"] = {
["en"] = "No collision mode should make self player as ghost?",
["br"] = "Nenhum modo de colisão deve se tornar o auto -jogador como fantasma?",
["cn"] = "没有碰撞模式应该使自我播放器成为幽灵?",
["de"] = "Kein Kollisionsmodus sollte Selbstspieler als Geist machen?",
["es"] = "¿Ningún modo de colisión debería hacer que la auto jugadora sea fantasma?",
["fr"] = "Aucun mode de collision ne devrait rendre l'auto-joueur comme fantôme?",
["it"] = "Nessuna modalità di collisione dovrebbe rendere il giocatore di sé come fantasma?",
["jp"] = "衝突モードはセルフプレーヤーをゴーストにする必要がありますか?",
["kr"] = "충돌 모드가 셀프 플레이어를 유령으로 만들지 않아야합니까?",
["mx"] = "¿Ningún modo de colisión debería hacer que la auto jugadora sea fantasma?",
["pl"] = "Żaden tryb kolizji nie powinien uczynić Self Player jako ducha?",
["ru"] = "Никакий режим столкновения не должен сделать самостоятельного игрока как призрака?",
["tw"] = "沒有碰撞模式應該使自我播放器成為幽靈?",
},
}
local langTable = { [1] = "en", [2] = "fr", [3] = "de", [4] = "it", [5] = "es", [6] = "br", [7] = "pl", [8] = "ru", [9] =
"kr", [10] = "tw", [11] = "jp", [12] = "mx", [13] = "cn" }
local language = GetCurrentLanguage() + 1
GetTranslate = function(str, ...)
if Translate[str] then
if Translate[str][langTable[language]] then
if ... then
return string.format(Translate[str][langTable[language]], ...)
else
return Translate[str][langTable[language]]
end
end
if ... then
return string.format(Translate[str]["en"], ...)
else
return Translate[str]["en"]
end
end
return str
end
Last updated