> For the complete documentation index, see [llms.txt](https://docs.gkshop.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gkshop.org/gksphone-v1/qb/developers/server-event.md).

# Server Event

### Adding stock market coins

source : Player ID\
coinid : In gksphone\config.lua there is a coinid in "Config.Crytos".\
amount : Coin amount

```lua
local cryptoadd = exports["gksphone"]:cryptoadd(source, coinid, amount)
print(cryptoadd) => as true or false
```

### Remove coins from stock market

source : Player ID\
coinid : In gksphone\config.lua there is a coinid in "Config.Crytos".\
amount : Coin amount

```lua
local cryptoremove = exports["gksphone"]:cryptoremove(source, coinid, amount)
print(cryptoremove) => as true or false
```

### Find player id from phone number <a href="#find-player-id-from-phone-number" id="find-player-id-from-phone-number"></a>

```lua
local FindSource = exports["gksphone"]:GetSourceByPhone("PhoneNumber")
print(FindSource)
```

### Find phone number with source

```lua
-- src => Player's ID
local src = source
local FindPhoneNumber = exports["gksphone"]:GetPhoneBySource(src)
print(FindPhoneNumber)
```

### How to use phone notification?

title : Notification title\
message : Notification message\
img : You can use icons from the phone or use .png or .jpg in a photo\
duration : To set how long the notification stays (You must type the millisecond value) - default duration 5000

```lua
-- src => Player's ID
local src = source
local NotifData = {
    title = "Notification header", 
    message = "Notification Message", 
    img    = '/html/static/img/icons/messages.png', 
    duration = 5000
}
exports["gksphone"]:SendNotification(src, NotifData)
```

#### **If you want a button with notification**

buttonactive : Set to true to enable button\
button : buttonEvent : Which client will be triggered\
button : buttonData : data to add to button

```lua
-- src => Player's ID
local src = source
local NotifData = {
    title = "Notification header", 
    message = "Notification Message", 
    img= '/html/static/img/icons/messages.png', 
    duration = 5000,
    buttonactive = true, 
    button = {
        buttonEvent = "clientevent", 
        buttonData = "Test"
    }
}
exports["gksphone"]:SendNotification(src, NotifData)
```

### Send Mail

```lua
-- src => Player's ID
local src = source
local MailData = {
  sender = 'GKSHOP',
  image = '/html/static/img/icons/mail.png',
  subject = "GKSPHONE",
  message = 'TEST'
}
exports["gksphone"]:SendNewMail(src, MailData)
```

### Send Offline Mail

```lua
-- PlayerId => QB Citizen Id
local PlayerId = source
local MailData = {
  sender = 'GKSHOP',
  image = '/html/static/img/icons/mail.png',
  subject = "GKSPHONE",
  message = 'TEST'
}
exports["gksphone"]:SendNewMailOffline(PlayerId, MailData)
```

### Specific Number

This function is an event that works for the phone numbers you specify "Config.SpecificNumber" in config.lua.

```lua
RegisterNetEvent('gksphone:server:specificNumber', function(source, phoneNumber)
    ---- You can add the function you want to do to this part
end)
```

### New Billing

```lua
-- src => Player's ID
-- label => Billing description
-- society => By which job the billingwas created
-- senderBilling => Who is the person sending the billing?
-- senderID => ESX Identifier of the billing originator
-- amount => Billing price
local src = source
local label = "Excessive Speed"
local society = "police"
local senderBilling = "GKSHOP XENKNIGHT"  -- Player Name
local senderID = "char1:4b110a7811" -- xPlayer.identifier
local amount = 500
exports["gksphone"]:NewBilling(src, label, society, senderBilling, senderID, amount)
```

### Changing Phone Number

Changing the player's phone number

```lua
-- src => Player's ID
-- newNumber => new phone number (phone number must be string)
local src = source
local newNumber = "5555555"
exports["gksphone"]:NumberChange(src, newNumber)
```


---

# 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://docs.gkshop.org/gksphone-v1/qb/developers/server-event.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.
