Trigger-/Exports-/ Functions

Notification Types:

  • police

  • medic

  • error

  • success

  • info

  • teamchat

Triggers:

Notify:

client examples:

TriggerEvent('b-notify:notify', 'success', 'SUCCESS', 'You have enough Money')
TriggerEvent('b-notify:notify', 'error', 'ERROR', 'You don't have enough money')
TriggerEvent('b-notify:notify', 'info', 'INFO', 'You received a SMS from Skurllex')
TriggerEvent('b-notify:notify', 'teamchat', 'TEAMCHAT', 'Please check the Player ID 8', 'Bvrtck')
TriggerEvent('b-notify:notify', 'police', 'POLICE', 'PoliceDepartment called')
TriggerEvent('b-notify:notify', 'medic', 'MEDIC', 'Medical Department called')

server examples:

TriggerClientEvent('b-notify:notify', source, 'success', 'SUCCESS', 'You have enough Money')
TriggerClientEvent('b-notify:notify', source, 'error', 'ERROR', 'You don't have enough money')
TriggerClientEvent('b-notify:notify', source,'info', 'INFO', 'You received a SMS from Skurllex')
TriggerClientEvent('b-notify:notify', source,'teamchat', 'TEAMCHAT', 'Please check the Player ID 8', 'Bvrtck')
TriggerClientEvent('b-notify:notify', source,'police', 'POLICE', 'PoliceDepartment called')
TriggerClientEvent('b-notify:notify', source,'medic', 'MEDIC', 'Medical Department called')

Parameters:

Parameter
Type
Example

type

string

"success"

title

string

"INFO"

message

string

"TEST"

playername (only teamchat type)

string

"Skurllex#0911@Bvrtck#0911"

Lifeinvader Notify:

client example:

TriggerEvent('b-notify:lifeinvader', title, message, playername, number, control)

server example:

TriggerClientEvent('b-lifeinvader', -1, title, message, playername, number, control)

Parameters:

Parameter
Type
Example

title

string

"LIFEINVADER"

message

string

"MADE BY B-DEV"

playername

string

"BVRTCK"

number (phone number)

string

"722-333"

control

string

"E"

Snippet:

-- serverside code example | not made by us.
function get_phone_number(identifier)
    MySQL.Async.fetchScalar("SELECT phone_number FROM users WHERE identifier = @identifier", {['@identifier'] = identifier}, function(result)
        return result
    end)
end

ESX.RegisterServerCallback("b-notify:getPhoneNumber", function(source, cb)
    local src = source
    local identifier = ESX.GetPlayerFromId(src).identifier
    cb(get_phone_number(identifier) or nil, xPlayer.name or nil)
end)


-- clientside code example | not made by us.

ESX.TriggerServerCallback("b-notify:getPhoneNumber", function(number, name)
    TriggerEvent('b-lifeinvader', "LIFEINVADER", "TEST AD", name, number, "E")
end)

Teamchat

Snippet

-- serverside code example | not made by us.
local groups = {
    "superadmin",
}

function isAllowed(group)
    for k, v in pairs(groups) do
        if v == group then
            return true
        end
    end
    return false
end

RegisterCommand("tc", function(source, args, rawCMD)
    local src = source
    local msg = table.concat(args, " ")
    local xPlayer = ESX.GetPlayerFromId(src)
    if isAllowed(xPlayer.getGroup()) then
        for key, value in pairs(GetPlayers()) then
            local xPlayers = ESX.GetPlayerFromId(value)
            if isAllowed(xPlayers.getGroup()) then
                TriggerClientEvent('b-notify:notify', xPlayers.source, 'teamchat', 'TEAMCHAT', msg, xPlayer.getName())
            end
        end
    else
        TriggerClientEvent('b-notify:notify', source, 'error', 'TEAMCHAT', 'You are not allowed to use this command')
    end
end)

Last updated

Was this helpful?