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 = 10 -- 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.PrepareGameDuration = 30 -- Duration before game start after lobby countdown. (second)
Config.Game.PrepareRoundDuration = 10 -- Duration before round start after round end (second)
Config.Game.RespawnDuration = 4 -- Respawn 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.RespawnOnBase = false -- Respawn player on tem base location.
---Control behavior of buy menu
---@param currentMap string map name
---@param weaponMode string
Config.Game.OpenWeaponSelectMenu = function(currentMap, weaponMode) -- Weapon but menu.
---@ammo integer Ammo to give with weapon.
---@infinite boolean Infinite ammo of gived weapon.
---@removetype table Remove weapon category in list from buy menu.
if currentMap == "awp_india" then
TriggerEvent("weaponselecter:setmoney", 5000) -- Starting money.
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"pistol", "submachine", "assault", "shotgun", "melee", "tool", "grenade"}})
else
if weaponMode == "all" then
TriggerEvent("weaponselecter:setmoney", 5000)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"melee", "tool", "grenade"}})
elseif weaponMode == "melee" then
TriggerEvent("weaponselecter:setmoney", 200)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"pistol", "submachine", "assault", "shotgun", "sniper", "tool", "grenade"}})
elseif weaponMode == "pistol" then
TriggerEvent("weaponselecter:setmoney", 1000)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"submachine", "assault", "shotgun", "sniper", "melee", "tool", "grenade"}})
elseif weaponMode == "submachine" then
TriggerEvent("weaponselecter:setmoney", 2000)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"pistol", "assault", "shotgun", "sniper", "melee", "tool", "grenade"}})
elseif weaponMode == "assault" then
TriggerEvent("weaponselecter:setmoney", 4000)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"pistol", "submachine", "shotgun", "sniper", "melee", "tool", "grenade"}})
elseif weaponMode == "shotgun" then
TriggerEvent("weaponselecter:setmoney", 2000)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"pistol", "submachine", "assault", "sniper", "melee", "tool", "grenade"}})
elseif weaponMode == "sniper" then
TriggerEvent("weaponselecter:setmoney", 5000)
TriggerEvent("weaponselecter:open", {ammo=200, infinite=true, removetype={"pistol", "submachine", "assault", "shotgun", "melee", "tool", "grenade"}})
end
end
end
-- 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["cs_italy"] = {
["mapObj"] = "cs_italy", -- .ydr model to spawn as a map, remove the line if not have.
["spawnblue"] = {-- Random spawn point of blue team
{x=1835.401, y=2723.904, z=114.787},
{x=1826.954, y=2727.675, z=116.705},
{x=1823.932, y=2721.265, z=116.688},
{x=1831.562, y=2718.408, z=114.787},
{x=1832.757, y=2729.151, z=114.787},
},
["spawnred"] = {-- Random spawn point of red team
{x=1864.938, y=2812.522, z=119.971},
{x=1865.075, y=2812.576, z=122.73},
{x=1864.494, y=2808.501, z=122.736},
{x=1867.777, y=2805.024, z=122.736},
{x=1867.435, y=2805.565, z=119.971},
},
["random"] = {-- Random spawn point
{x=1833.483, y=2726.529, z=114.784},
{x=1821.628, y=2762.245, z=116.515},
{x=1815.355, y=2760.318, z=122.908},
{x=1824.992, y=2782.227, z=116.515},
{x=1849.633, y=2777.395, z=116.515},
{x=1858.632, y=2747.969, z=116.515},
{x=1841.52, y=2739.687, z=116.685},
{x=1868.853, y=2777.728, z=115.783},
{x=1860.727, y=2791.052, z=121.008},
{x=1861.648, y=2808.028, z=119.971},
{x=1860.135, y=2810.139, z=122.736},
{x=1852.613, y=2807.012, z=119.971},
{x=1844.658, y=2797.53, z=116.504},
{x=1829.138, y=2775.487, z=123.421},
{x=1839.144, y=2775.38, z=120.126},
{x=1834.302, y=2768.933, z=120.144},
{x=1824.837, y=2722.677, z=116.688},
{x=1823.066, y=2750.444, z=116.688},
{x=1868.895, y=2759.238, z=116.688},
{x=1851.384, y=2768.39, z=116.697},
{x=1822.104, y=2798.137, z=116.688},
{x=1838.065, y=2806.249, z=116.688},
{x=1834.28, y=2806.682, z=120.144},
{x=1839.05, y=2775.465, z=120.144},
{x=1833.951, y=2759.095, z=119.28},
}
}
---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\_CaptureTheFlag:OnSessionStart", function()
NetworkSetFriendlyFireOption(true) -- For PVE server.
end)
-- Call on game end
AddEventHandler("DarkRP\_CaptureTheFlag: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