Hi guys,
So im trying to change ESX notification to a mythic notification. I got mythic to work, and deleted the ESX notification line from the script. Yet somehow ESX Notifications is still showing.
Any ideas?
Hi guys,
So im trying to change ESX notification to a mythic notification. I got mythic to work, and deleted the ESX notification line from the script. Yet somehow ESX Notifications is still showing.
Any ideas?
Hi There, a bit newbie but will try and help you.
Try these 2 options:
-Re-Check your files and you .cfg maybe it is still running it.
-Also check your events there might be a function were you are calling it.
its for givecarkeys, it looks like this.
-client
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent("esx_givecarkeys:keys")
AddEventHandler("esx_givecarkeys:keys", function()
giveCarKeys()
end)
function giveCarKeys()
local playerPed = GetPlayerPed(-1)
local coords = GetEntityCoords(playerPed)
if IsPedInAnyVehicle(playerPed, false) then
vehicle = GetVehiclePedIsIn(playerPed, false)
else
vehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 7.0, 0, 70)
end
local plate = GetVehicleNumberPlateText(vehicle)
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
ESX.TriggerServerCallback('esx_givecarkeys:requestPlayerCars', function(isOwnedVehicle)
if isOwnedVehicle then
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
if closestPlayer == -1 or closestDistance > 3.0 then
exports['mythic_notify']:SendAlert('inform', 'No players nearby', 5000, { ['background-color'] = '#ffffff', ['color'] = '#000000' })
else
exports['mythic_notify']:SendAlert('inform', 'Car keys has been given', 5000, { ['background-color'] = '#ffffff', ['color'] = '#000000' })
TriggerServerEvent('esx_givecarkeys:setVehicleOwnedPlayerId', GetPlayerServerId(closestPlayer), vehicleProps)
end
end
end, GetVehicleNumberPlateText(vehicle))
end
-server
local cars = {}
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
ESX.RegisterServerCallback('esx_givecarkeys:requestPlayerCars', function(source, cb, plate)
local xPlayer = ESX.GetPlayerFromId(source)
MySQL.Async.fetchAll(
'SELECT * FROM owned_vehicles WHERE owner = @identifier',
{
['@identifier'] = xPlayer.identifier
},
function(result)
local found = false
for i=1, #result, 1 do
local vehicleProps = json.decode(result[i].vehicle)
if trim(vehicleProps.plate) == trim(plate) then
found = true
break
end
end
if found then
cb(true)
else
cb(false)
end
end
)
end)
RegisterServerEvent('esx_givecarkeys:frommenu')
AddEventHandler('esx_givecarkeys:frommenu', function ()
TriggerClientEvent('esx_givecarkeys:keys', source)
end)
RegisterServerEvent('esx_givecarkeys:setVehicleOwnedPlayerId')
AddEventHandler('esx_givecarkeys:setVehicleOwnedPlayerId', function (playerId, vehicleProps)
local xPlayer = ESX.GetPlayerFromId(playerId)
MySQL.Async.execute('UPDATE owned_vehicles SET owner=@owner WHERE plate=@plate',
{
['@owner'] = xPlayer.identifier,
['@plate'] = vehicleProps.plate
},
function (rowsChanged)
TriggerClientEvent('mythic_notify:client:SendAlert', source, { type = 'inform', text = 'Car keys received!', length = 5000, style = { ['background-color'] = '#ffffff', ['color'] = '#000000' } })
end)
end)
function trim(s)
if s ~= nil then
return s:match("^%s*(.-)%s*$")
else
return nil
end
end
TriggerEvent('es:addCommand', 'givekey', function(source, args, user)
TriggerClientEvent('esx_givecarkeys:keys', source)
end)
I’ve had an issue like this before and instead of removing the notification completely I just comment it out and add the new one below it like this:
-- ESX.ShowNotification('No players nearby', 5000, info)
exports['mythic_notify']:SendAlert('inform', 'No players nearby', 5000, { ['background-color'] = '#ffffff', ['color'] = '#000000' })