Config
-- Enable debug make sure FiveM client is "Beta Channel" in setting to use more dev command.
Config.Debug = false
Config.MinPlayers = 2 -- Minimum of player to allow counwdown (Set to 1, Trial mode will enable).
Config.MaxPlayers = 20 -- Maximum player allow in lobby.
Config.LobbyTime = 20 -- Countdown timer to start race if minimum player reached Config.MinPlayers. (second)
Config.ArenaTime = 60 -- Duration in game before lobby auto close. (minute)
Config.OwnWorld = true -- Game in another world. Participants and the non participants will not see each other.
Config.Game.FirendlyFire = false -- Can player attack teamate?
Config.Game.PrepareGameDuration = 60 -- Duration before game start after lobby countdown. (second)
Config.Game.PrepareRoundDuration = 20 -- Duration before round start after round end (second)
Config.Game.RoundDuration = 2*60+17+Config.Game.PrepareRoundDuration -- Duration of round (second)
Config.Game.BuyDuration = 24 -- Duration of buy zone after round started.
Config.Game.BombTimer = 40 -- Bomb placed countdown timer (second)
Config.Game.KillStreakDuration = 7 -- Duration before lost kill streak (second)
Config.Game.Team.ChangeCooldown = 20 -- Cooldown after changing team (second)
Config.Game.Team.Balance = 0 -- Allow how different are number of teams.
Config.Game.Team.EnemyBlip = true -- Show enemy blip while them shooting.
-- Config.XP : Display XP rank system on end screen.
-- Example is https://github.com/chaixshot/DarkRP_XP
local DarkRP_XP = exports["DarkRP_XP"]
Config.EndScreen.ResultsPanelTime = 10 -- sec
Config.EndScreen.XP.rankTextSmall = "LEVEL UP"
Config.EndScreen.XP.rankTextBig = "~b~Nice~s~"
Config.EndScreen.XP.GetXpGained = function(source, exp)
exp = math.floor(exp)
if GetResourceState("DarkRP_XP") == "started" then -- DarkRP_XP request.
DarkRP_XP:AddPlayerXPToServer(exp)
return exp
else
return 0
end
end
-- 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.Text = { -- Display money on end screen.
topText = "",
bottomText = "",
rightHandStat = "",
rightHandStatIcon = 3, --0 or 1 = checked, 2 = X, 3 = no icon
}
--- Map coords for custom map
Config.Location["de_dust"] = {
["mapObj"] = "de_dust", -- .ydr model to spawn as a map, remove the line if not have.
["bomb"] = { -- Bomb place location
{ x = 1859.622, y = 2704.357, z = 119.304 }, -- A
{ x = 1893.666, y = 2753.65, z = 117.808 }, -- B
},
["spawnblue"] = { -- Random spawn point of blue team
{ x = 1883.26, y = 2802.734, z = 115.138 },
{ x = 1870.391, y = 2807.705, z = 117.916 },
{ x = 1866.981, y = 2821.257, z = 118.954 },
{ x = 1881.062, y = 2819.922, z = 118.957 },
{ x = 1889.38, y = 2821.852, z = 118.957 },
{ x = 1888.57, y = 2815.916, z = 115.138 },
{ x = 1887.584, y = 2804.609, z = 115.311 },
{ x = 1877.103, y = 2810.098, z = 115.139 },
},
["spawnred"] = { -- Random spawn point of red team
{ x = 1851.586, y = 2731.815, z = 117.916 },
{ x = 1851.559, y = 2735.115, z = 117.916 },
{ x = 1855.591, y = 2735.184, z = 117.916 },
{ x = 1858.782, y = 2732.248, z = 117.916 },
{ x = 1856.049, y = 2727.842, z = 117.916 },
},
}
---Player display name, can change to RP name.
---@param source integer Player server id
---@return string Player name
event.getPlayerName = function(source --[[ number ]])
return GetPlayerName(source)
end
--- give money to player when win race
--- "money" come from event.calculateReward() "reward"
---@param source integer Player server id
---@param money integer
event.giveMoney = function(source, money)
--[[ Example for ESX
ESX = nil
TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end)
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addMoney(money)
]]--
end
---comment
---@param player table
---@param isRedWin boolean
---@param isBlueWin boolean
---@return number
---@return number
event.calculateReward = function(player, isRedWin, isBlueWin)
local reward_money = player.Hit * 900 + player.score * 200
local reward_exp = player.Hit * 110 + player.score * 100
if player.Team == "red" then
if isRedWin then
else
reward_money /= 2
reward_exp /= 2
end
elseif player.Team == "blue" then
if isBlueWin then
else
reward_money /= 2
reward_exp /= 2
end
end
event.giveMoney(player.source, reward_money)
return reward_money, reward_exp -- Return money and exp value back to server.
end
---Normal chat event
---@param source integer Player server id
---@param text string
event.chatMessage = function(source --[[ number ]], text --[[ string ]])
TriggerClientEvent('chatMessage', source, "[Racing]", { 255, 87, 35 }, text)
end
---Change player skin to normal, change for RP clothes
event.ClothNormal = function()
-- vRPClients.TriggerServerCallback({'esx_skin:getPlayerSkin', function(skin)
local model = nil
-- if skin.sex == 0 then
model = GetHashKey("mp_m_freemode_01")
-- else
-- model = GetHashKey("mp_f_freemode_01")
-- end
RequestModelC(model)
SetPlayerModel(PlayerId(), model)
SetPedDefaultComponentVariation(PlayerPedId())
-- TriggerEvent('skinchanger:loadSkin', skin)
-- TriggerEvent('skinchanger:modelLoaded')
SetPedRelationshipGroupHash(PlayerPedId(), GetHashKey("PLAYER"))
SetEntityOnlyDamagedByRelationshipGroup(PlayerPedId(), false, GetHashKey("GANG_1"))
SetEntityOnlyDamagedByRelationshipGroup(PlayerPedId(), false, GetHashKey("GANG_2"))
ClearPedBloodDamage(PlayerPedId())
ResetPedVisibleDamage(PlayerPedId())
ClearPedLastWeaponDamage(PlayerPedId())
-- end})
end
---Call to revive player, RP api
event.revivePlayer = function()
local heading = GetEntityHeading(PlayerPedId())
local coords = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 0.0, 0.0)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, heading, 0, false)
TriggerEvent('playerSpawned', coords.x, coords.y, coords.z, heading)
ClearPedBloodDamage(PlayerPedId())
ClearEntityLastDamageEntity(PlayerPedId())
AnimpostfxStop("DeathFailOut")
end
---Player display name, change to RP name?.
---@param playerID integer Player client id
---@return string
event.getPlayerName = function(playerID)
local source = GetPlayerServerId(playerID)
if Main.PlayersDataBySource[source] then
return Main.PlayersDataBySource[source].playerName
else
return GetPlayerName(playerID)
end
end
---Maybe your want to bypass anticheats somehow.
---@param entity integer PlayerPedId(), vehicleid
---@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, false, false, true)
end
---Top left 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
---Bottom left notification event
---@param msg string
---@param noSound boolean
event.ShowNotification = function(msg, noSound)
BeginTextCommandThefeedPost('STRING')
AddTextComponentSubstringPlayerName(msg)
local id = EndTextCommandThefeedPostTicker(false, true)
ThefeedRemoveItem(id-5)
if not noSound then
PlaySound(-1, "Boss_Message_Orange", "GTAO_Boss_Goons_FM_Soundset", 0, 0, 1)
end
end
-- Hide your ui for beautiful script screen, Do not loop on this it slowdown main script
event.onUiToggle = function(show --[[ Boolean ]])
-- CreateThread(function()
if show then
DisplayRadar(true)
else
DisplayRadar(false)
end
-- end)
end
-- Call on game start
AddEventHandler("DarkRP_Bomb:OnSessionStart", function()
NetworkSetFriendlyFireOption(true) -- For PVE server.
end)
-- Call on game end
AddEventHandler("DarkRP_Bomb:OnSessionEnd", function()
-- NetworkSetFriendlyFireOption(false)
end)
local Translate = {
["hud_killed"] = {
["en"] = "~r~KILLED",
["br"] = "~r~morto",
["cn"] = "~r~被杀",
["de"] = "~r~getötet",
["es"] = "~r~asesinado",
["fr"] = "~r~tué",
["it"] = "~r~ucciso",
["jp"] = "~r~kill",
["kr"] = "~r~죽었다",
["mx"] = "~r~asesinado",
["pl"] = "~r~zabity",
["ru"] = "~r~убит",
["tw"] = "~r~被殺",
},
}
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"}
GetTranslate = function(str, ...)
local language = GetCurrentLanguage() + 1
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