Skip to content

SYNO-SY/SY_Notify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SY_Notify

Dependency

Installation

  • Download the file and put it in the resource directory
  • Install Sql
      CREATE TABLE IF NOT EXISTS `sy_notify` (
     `identifier` varchar(65) DEFAULT NULL,
     `position` longtext DEFAULT NULL,
      UNIQUE KEY `identifier` (`identifier`) USING HASH
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  • Rename the Folder to SY_Notify.
  • Add ensure SY_Notify in you're server.cfg
  1. To display a notification you should call it like below:

    1. Using Client Side:
       exports['SY_Notify']:Alert("Title", "Message", Time, 'type')
    1. Using Server Side:
       TriggerClientEvent('SY_Notify:Alert', source, "Title", "Message", Time, 'type')
  2. To set the notification display time, use:

    1. 1000 - [1 second]
    2. 2000 - [2 seconds]
    3. 5000 - [5 seconds]
    4. 10000 - [10 seconds]
    5. etc...
  3. To change the type of notification, use this types of notifications:

    1. success
    2. info
    3. warning
    4. error
    5. announcement
  4. IF YOU NEED TO ADD THIS NOTIFICATION AS DEFAULT IN ESX LEGACY ADD THE GIVEN CODE IN @es_extended/client/function.lua

   function ESX.ShowNotification(message, type, length)
      if GetResourceState("esx_notify") ~= "missing" then
         exports["esx_notify"]:Notify(type, length, message)
      else
         print("[^1ERROR^7] ^5ESX Notify^7 is Missing!")
      end
   end

replace it with

   function ESX.ShowNotification(message, type, length)
      if GetResourceState("SY_Notify") ~= "missing" then
         exports['SY_Notify']:Alert("NOTIFICATION", message, length, type)
      else
         print("[^1ERROR^7] ^5SY_NOTIFY^7 is Missing!")
      end
   end