> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/easter-event/exports.md).

# Exports

Give Easter eggs from your own scripts.

kossek\_easter has one export. It runs on the **server**.

## rollEasterDrop

Rolls a chance for a player to find a common egg. Call it from any activity that should be able to drop eggs during the event: finishing a job task, robbing a store, catching a fish.

```lua
local dropped = exports.kossek_easter:rollEasterDrop(source, chance)
```

| Parameter | Type   | Required | Description                                                                      |
| --------- | ------ | -------- | -------------------------------------------------------------------------------- |
| `source`  | number | Yes      | Server ID of the player                                                          |
| `chance`  | number | No       | Chance in percent, 1 to 100. Defaults to `Config.PassiveDrop.defaultChance` (15) |

**Returns** `boolean`: `true` when the player received an egg.

What the export does, in order:

1. Returns `false` if the player already got an egg from this export within the last `Config.PassiveDrop.cooldown` seconds (300 by default).
2. Rolls the chance. Returns `false` on a miss.
3. Returns `false` if the player cannot carry the egg.
4. Gives one common egg (`Config.Items.egg_common`), notifies the player and starts the cooldown.

The cooldown starts only after a successful drop, so a missed roll does not block the next one.

### Example

```lua
-- server side of your own resource
RegisterNetEvent('myjob:taskFinished', function()
    local src = source

    -- your own reward logic here

    -- 25% chance for an Easter egg on top
    if GetResourceState('kossek_easter') == 'started' then
        exports.kossek_easter:rollEasterDrop(src, 25)
    end
end)
```

{% hint style="info" %}
The egg from this export is a normal common egg. It still has to be incubated before it can be opened, unless incubation is turned off.
{% endhint %}
