Esx_showjob

esx_showjob.rar (1.2 KB)
unknown

goto client and then main.lua then change the pyrp_base to esx so its work


this one pyrp_base change this to esx

this is for using mythic_notify

WHAT on EARTH is this mess?!?!?
Ok, I was going to just laugh and leave, but I can’t bring myself to do so without fixing this mess of a thread and this garbage “script”. Let me help you out. I mean no offense, but you are clearly new, yes? I am here to help.

Alright, let’s presume you haven’t used the import file for ESX because you aren’t using the latest ESX Legacy, but rather an older version. That’s fine… We will go with that.

Forget making this a script. This just needs to be added to ANY client side file of ANY script.
If the script you add it to, already uses ESX, then don’t bother putting the thread at the top in. It should already have it.

What we are going to do is;

  • Only get data when the command is used. It’s not in a loop, so no issue with performance doing this
  • Make sure that the job check updates on your job changing, which yours doesn’t
  • Call an export function inside the command, instead of a function that just calls a function
  • Clean up the notification that used to use colours but no longer does, due to mythic_notify (~g~, etc)
  • Remove redundant Citizen. prefixes on threads and waits
  • Remove redundant params for command (source, args & raw are unused & false is default)
  • Call DoHudText instead of DoCustomHudText, because we aren’t passing custom styling

Here is ALL you need;

ESX = nil

CreateThread(function()
	while ESX == nil do
		TriggerEvent("esx:getSharedObject", function(obj) ESX = obj end)
		Wait(10)
	end
end)

RegisterCommand("showjob", function()
	local job = ESX.GetPlayerData().job
	exports["mythic_notify"]:DoHudText("inform", "You are working as a: "..job.name.." - "..job.grade_label)
end)

What I didn’t do is update DoHudText to SendAlert to use the last version of mythic_notify, in case there is an older version being used. In the latest version where everything became SendAlert, DoHudText and the other deprecated exports are still supported, so no error will occur.

Anyway, that’s how you do it. I appreciate you being eager to release something and “help” others, but please spend more time learning before trying to push something out to the public. There is a common problem with new coders thinking something they did that works for them, is worthy of release, despite it’s problems. Hopefully this helps you learn and doesn’t offend you.