# Customization

<details>

<summary>Basic options</summary>

```lua
Config = {}

--------------------------
-- Starting Lobby Point --
--------------------------
Config.StartPointEnabled = true
Config.StartPointCoords = vector3(2464.6, 3769.428, 41.432) -- Coords
Config.StartPointSize = 7.5 -- Radius
Config.StartPointColor = {255, 192, 203, 225} -- RGBA
Config.StartPointBlip = { -- Blip
    Enabled = true,
    Id = 1, -- https://docs.fivem.net/docs/game-references/blips/
    Color = 8,
    Scale = 0.75,
    Name = 'Easter Game',
}
Config.StartPointTimeBeforeGameStart = 30000 -- Miliseconds

----------------------
-- General Settings --
---------------------
Config.Fee = 5000 -- Cost of the game ($)
Config.GameDuration = 150000 -- Duration of the game
Config.MinPlayersRequirements = 2 -- Min. players req. to start the game

------------------------
-- Eggs Configutation --
------------------------
Config.Eggs = {
    vec3(8573.506, -1270.127, 533.000),
    vec3(8567.596, -1320.274, 533.000),
    vec3(8585.972, -1312.703, 533.000),
    vec3(8544.750, -1305.383, 533.000),
    vec3(8601.843, -1329.221, 533.000),
    vec3(8543.908, -1285.554, 533.000),
    vec3(8559.904, -1281.739, 533.000),
    vec3(8560.530, -1317.459, 533.000),
    vec3(8583.344, -1319.013, 533.000),
    vec3(8556.828, -1285.514, 533.000),
    vec3(8585.403, -1274.783, 533.000),
    vec3(8535.599, -1301.692, 533.000),
    vec3(8585.591, -1325.226, 533.000),
    vec3(8613.531, -1287.747, 533.000),
    vec3(8577.808, -1340.216, 533.000),
    vec3(8578.807, -1278.222, 533.000),
    vec3(8596.752, -1296.516, 533.000),
    vec3(8590.680, -1305.108, 533.000),
    vec3(8591.901, -1296.113, 533.000),
    vec3(8554.877, -1328.631, 533.000),
    vec3(8586.383, -1283.667, 533.000),
    vec3(8531.645, -1291.002, 533.000),
    vec3(8568.783, -1275.501, 533.000),
    vec3(8575.648, -1320.019, 533.000),
    vec3(8560.860, -1272.109, 533.000),
    vec3(8572.984, -1256.109, 533.000),
    vec3(8604.456, -1278.485, 533.000),
    vec3(8555.910, -1311.136, 533.000),
    vec3(8594.596, -1284.609, 533.000),
    vec3(8538.937, -1317.712, 533.000),
    vec3(8611.263, -1299.427, 533.000),
    vec3(8555.586, -1267.041, 533.000),
    vec3(8593.357, -1266.441, 533.000),
}
Config.EggTakeRadius = 1.0
Config.ShowEggBlips = false

---------------
-- Teleports --
---------------
Config.Teleports = {
    vec3(8580.391, -1255.6, 532.0),
    vec3(8609.77, -1308.565, 532.0),
    vec3(8559.158, -1337.439, 532.0),
    vec3(8533.424, -1283.375, 532.0),
}

------------------------
-- Player Spawnpoints --
------------------------
Config.GameStartedSpawns = {
    vec3(8571.951, -1292.108, 532.303),
    vec3(8564.423, -1292.516, 533.302),
    vec3(8568.237, -1289.335, 533.302),
    vec3(8574.882, -1288.447, 533.302),
    vec3(8577.882, -1290.229, 533.302),
    vec3(8579.945, -1293.395, 533.302),
    vec3(8581.998, -1300.209, 533.302),
    vec3(8578.483, -1305.516, 533.302),
    vec3(8574.16, -1308.196, 533.302),
}
Config.GameStoppedSpawns = {
    vec3(2443.697, 3765.237, 40.999),
}

--------------------------------
-- In Game Tick (Client-Side) --
--------------------------------
Config.InGameTick = function(playerPed)
    -- You can add/remove here buttons to block during the game
    DisableControlAction(2, 37, true) -- Disable Weaponwheel
    DisablePlayerFiring(playerPed, true) -- Disable firing
    DisableControlAction(0, 45, true) -- Disable reloading
    DisableControlAction(0, 24, true) -- Disable attacking
    DisableControlAction(0, 263, true) -- Disable melee attack 1
    DisableControlAction(0, 140, true) -- Disable light melee attack (R button)
    DisableControlAction(0, 142, true) -- Disable left mouse button (istol whack etc)
    DisableControlAction(0, 22, true) -- Disable jump button
    if IsPedInAnyVehicle(playerPed, false) then -- Leave vehicle
        TaskLeaveAnyVehicle(playerPed, 0, 0)
    end
    SetRunSprintMultiplierForPlayer(PlayerId(), 1.0) -- Prevent Fast-Run vMenu
end

------------------------
-- Abilities Settings --
------------------------
Config.AbilitiesSettings = {
    StunAbility = {
        EffectDuration = 3000, -- Miliseconds
        Cooldown = 10000, -- Miliseconds
        CooldownOnGameStart = 5000, -- Miliseconds
    },
    SpeedAbility = {
        EffectDuration = 5000, -- Miliseconds
        Cooldown = 15000, -- Miliseconds
        CooldownOnGameStart = nil, -- Miliseconds
    },
    TeleportAbility = {
        Cooldown = 12000, -- Miliseconds
        CooldownOnGameStart = nil, -- Miliseconds
    },
}

---------------------------------
-- Winner Announcement in chat --
---------------------------------
Config.ShowWinnerMessage = true -- -- Show Top 1 winner message to chat
Config.ShowWinnerMessageGlobally = false -- Show to all players on server
```

</details>

<details>

<summary>Advanced options</summary>

```lua
Config.ParticlesDisabled = true -- Disable particles f.e. for Anticheat bypass
```

</details>

## Events

To manually enable/disable starting point you can use Global Statebag like this:

```lua
-- server.lua
GlobalState['easter-game:startPointEnabled'] = true -- Enable
GlobalState['easter-game:startPointEnabled'] = false -- Disable
```

To receive match results on your side (for example if you'd like to give additional reward):

```lua
-- server.lua
AddEventHandler('easter-game:gameStopped', function(playerResults)
    -- Game stopped
    for k,v in ipairs(playerResults) do
        print(v.playerId, v.name, v.eggs, v.reward)
    end
end)
```

```lua
AddEventHandler('easter-game:gameStarted', function()
    -- Game started
end)
```

## Example

Controls a game mode with a starting point that activates periodically, notifies players, and handles game start/stop events.&#x20;

```lua
local COOLTIME = 1 * 10 * 1000
local PRE_NOTIFY = 1 * 10 * 1000
local isActivationThreadRunning = false

local isGameStarted = false
AddEventHandler('easter-game:gameStarted', function()
    isGameStarted = true
    disableStartingPoint()
end)
AddEventHandler('easter-game:gameStopped', function(playerResults)
    isGameStarted = false
    print('Cooldown 10 seconds')
    Wait(COOLTIME)
    startPointActivationThread()
end)

local startingPointEnabled = false
function enableStartingPoint()
    startingPointEnabled = true
    GlobalState['easter-game:startPointEnabled'] = true
end
function disableStartingPoint()
    startingPointEnabled = false
    GlobalState['easter-game:startPointEnabled'] = false
end

local function notifyAll(text, duration)
    print('notify', text)
end

function startPointActivationThread()
    if isActivationThreadRunning then return end
    isActivationThreadRunning = true
    CreateThread(function()
        while not startingPointEnabled and not isGameStarted do
            if math.random(1, 100) <= 35 then
                notifyAll('Easter game will be available in 10 seconds', 10000)
                Wait(PRE_NOTIFY + 1000)
                notifyAll('Easter game available!', 10000)
                TriggerClientEvent('easter-game-addon:client:sendNotifSound', -1)
                enableStartingPoint()
            end
            Wait(1000)
        end
        isActivationThreadRunning = false
    end)
end

if not startingPointEnabled then
    startPointActivationThread()
end
```
