> ## Documentation Index
> Fetch the complete documentation index at: https://docs.jaksam-scripts.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Sold to NPC

> Triggered server side after an NPC selling sale.

Triggered after an NPC selling sale.

```lua Event theme={null}
RegisterNetEvent("drugs_creator:soldToNPC", function(playerId, drugName, drugQuantity, totalDrugPrice, accountName)

end)
```

### Parameters

| Name             | Data Type | Description                                                  |
| ---------------- | --------- | ------------------------------------------------------------ |
| `playerId`       | integer   | Player server ID                                             |
| `drugName`       | string    | Item ID of the drug just sold                                |
| `drugQuantity`   | integer   | Item quantity sold                                           |
| `totalDrugPrice` | integer   | Total money that the player received                         |
| `accountName`    | string    | Account type used for the reward (money, black\_money, etc.) |

## Example

```lua theme={null}
RegisterNetEvent("drugs_creator:soldToNPC", function(playerId, drugName, drugQuantity, totalDrugPrice, accountName)
    local xPlayer = ESX.GetPlayerFromId(playerId)

    local random = math.random(1, 2)

    if(drugName == "weed" and random == 1) then
        xPlayer.addInventoryItem("weed", 3)

        xPlayer.showNotification("Here you have 3 bonus weed")
    end

    print("Player received " .. totalDrugPrice .. " in " .. accountName)
end)
```


## Related topics

- [Sellings](/drugs-creator/server/sellings/index.md)
- [NPC Selling](/drugs-creator/client/npc-selling/index.md)
- [Remove ped from selling blacklist](/drugs-creator/client/npc-selling/remove-ped-from-selling-blacklist.md)
- [Add ped to selling blacklist](/drugs-creator/client/npc-selling/add-ped-to-selling-blacklist.md)
- [Sold in boat](/drugs-creator/server/sellings/sold-in-boat.md)
