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

# SERVER

Events can be triggered from client or server using `TriggerServerEvent` or `TriggerEvent`.

#### 1. Add a job to a player

```lua
TriggerServerEvent("xcore_multijob:add_job", {
    playerid = <playerid>,
    name = <jobname>,
    grade = <jobgrade>,
    force_swap_job = false
})
```

#### 2. Remove a job from a player

```lua
TriggerServerEvent("xcore_multijob:del_job", {
    playerid = <playerid>,
    jobname = <jobname>,
    jobgrade = <jobgrade>
})
```

#### 3. Get all jobs for a player

```lua
TriggerServerEvent("xcore_multijob:get_char_jobs", {})
-- Result will be received in the event 'xcore_multijob:receiver_get_char_jobs'
```

#### 4. Get all jobs / organizations

```lua
TriggerServerEvent("xcore_multijob:get_jobs", {})
-- Result will be received in the event 'xcore_multijob:receiver_get_jobs'

TriggerServerEvent("xcore_multijob:get_jobs_org", {})
-- Result will be received in the event 'xcore_multijob:receiver_get_jobs_org'
```

#### 5. Get job slots for a player

```lua
TriggerServerEvent("xcore_multijob:get_slots", {})
-- Result will be received in the event 'xcore_multijob:receiver_get_slots'
```

#### 6. Add slots to a player (server/console only)

```lua
TriggerServerEvent("xcore_multijob:add_slot", <playerid>, <slots>)
```

***

### Example Usage in Another Script

```lua
-- Add a job to a character
local success = exports.xcore_multijob:AddJob(charid, playername, "police", 2)
if success then
    print("Job added!")
end

-- Get all jobs for a character
local jobs = exports.xcore_multijob:GetCharJobs(charid)
for _, job in ipairs(jobs) do
    print(job.jobname, job.jobgrade)
end

-- Trigger event to get slots
TriggerServerEvent("xcore_multijob:get_slots")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://xcore.gitbook.io/xcore-docs/multijob/events/server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
