CM Shop
  • 👋Welcome to CM Documentation
  • CM Scripts
    • 🎦CM CCTV
    • ℹ️CM Notification
Powered by GitBook
On this page
  • -----INSTALLATION------
  • STEP 1 - Drag And Drop
  • STEP 2 - Add SQL
  • STEP 3 - Edit Functions Lua
  • STEP 4 - Find Function
  • STEP 5 - Replace Code
  • -----INFORMATION------
  • Information - 1 How to use events or exports
  • Information - 2 Notification Types
  • Preview
  • TEBEX
  • Discord
  1. CM Scripts

CM Notification

CM Notification Documentation

-----INSTALLATION------

STEP 1 - Drag And Drop

Drag cm-notification into your resources folder.

STEP 2 - Add SQL

CREATE TABLE IF NOT EXISTS `cm_notify` (
  `identifier` varchar(65) DEFAULT NULL,
  `position` longtext DEFAULT NULL,
  UNIQUE KEY `identifier` (`identifier`) USING HASH
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

STEP 3 - Edit Functions Lua

IF Framework is QB Core - Go to qb-core/client/functions.lua

IF Framework is ESX - Go to es_extended/client/functions.lua

STEP 4 - Find Function

IF Framework is QB Core - Find this function QBCore.Functions.Notify

IF Framework is ESX - Find this function ESX.ShowNotification

STEP 5 - Replace Code

  • FOR QB Core

Replace QBCore.Functions.Notify function with the code down below

function QBCore.Functions.Notify(text, texttype, length)

function QBCore.Functions.Notify(text, texttype, length)
    if type(text) == "table" then
        local ttext = text.text or 'Placeholder'
        local caption = text.caption or 'Placeholder'
        texttype = texttype or 'info'
        length = length or 5000
        exports['cm-notification']:Alert(caption, ttext, length, texttype)
    else
        texttype = texttype or 'info'
        length = length or 5000
        exports['cm-notification']:Alert("NOTIFICATION", text, length, texttype)
    end
end
  • FOR ESX

Replace ESX.ShowNotification function with the code down below

function ESX.ShowNotification(text, texttype, length)

function ESX.ShowNotification(text, texttype, length)
    if type(text) == "table" then
        local ttext = text.text or 'Placeholder'
        local caption = text.caption or 'Placeholder'
        texttype = texttype or 'info'
        length = length or 5000
        exports['cm-notification']:Alert(caption, ttext, length, texttype)
    else
        texttype = texttype or 'info'
        length = length or 5000
        exports['cm-notification']:Alert("NOTIFICATION", text, length, texttype)
    end
end

-----INFORMATION------

Information - 1 How to use events or exports

IMPORTANT NOTE : This requires lua knowledge and a bit html, css knowledge (only if you want to color some texts )

  • If you want to trigger the notification from the client side you can use the example down below According to this example

  • 1st parameter is the title of notify you want to display

  • 2nd parameter is the text you want to display

  • 3rd parameter is how long time notification will be displayed on the screen

  • 4th parameter is the notification type (more types can be find in notification types category)

exports['cm-notification']:Alert("Title", "Message", Time, 'type')
  • If you want to trigger the notification from server side use the example down below Only things change here are TriggerEvent needs to be replaced with TriggerClientEvent and source (id) of a player you want to show notification

TriggerClientEvent('cm-notification:Alert', source, "Title", "Message", Time, 'type')

Information - 2 Notification Types

  • success

  • info

  • warning

  • error

  • announcement

Preview

TEBEX

Discord

PreviousCM CCTV

Last updated 5 months ago

ℹ️
https://shopcm.tebex.io/category/cm-series
https://discord.gg/vgHzAv7u