Open DJJackal opened 1 month ago
What are you trying to achieve here?? The resource already lets players to change their name. you just need to setup the config properly
What are you trying to achieve here?? The resource already lets players to change their name. you just need to setup the config properly
No it didnt without making this change. Kept saying That the Player wasnt on Duty.
Kept saying That the Player wasnt on Duty.
You could just remove the jobs from Config.JobsWithCallsign or set them to false. Easy as that.
Kept saying That the Player wasnt on Duty.
You could just remove the jobs from Config.JobsWithCallsign or set them to false. Easy as that.
We tried this and it did not work. This was the only way to let players change their name for us.
Here is the original code in server/main.lua
if Config.UseRPName then if GetResourceState("es_extended"):find("start") then Framework.Object = exports["es_extended"]:getSharedObject() Framework.Initial = "esx" Framework.GetPlayer = Framework.Object.GetPlayerFromId Framework.GetPlayerName = function(source) local xPlayer = Framework.GetPlayer(source) return xPlayer and xPlayer.getName() or nil end elseif GetResourceState("qb-core"):find("start") then Framework.Object = exports["qb-core"]:GetCoreObject() Framework.Initial = "qb" Framework.GetPlayer = Framework.Object.Functions.GetPlayer Framework.GetPlayerName = function(source) local xPlayer = Framework.GetPlayer(source) return xPlayer and ("%s %s"):format(xPlayer.PlayerData.charinfo.firstname, xPlayer.PlayerData.charinfo.lastname) or nil end isPlayerAllowedToChangeName = function(source, notify) -- override isPlayerAllowedToChangeName local response = Config.LetPlayersSetTheirOwnNameInRadio local xPlayer = Framework.GetPlayer(source) if xPlayer then if Config.JobsWithCallsign[xPlayer.PlayerData?.job?.name] and xPlayer.PlayerData?.job?.onduty then response = false if notify then Config.Notification(source, "You cannot change your name on radio while on duty!", "error") end end end return response end end Framework.Object = nil -- free up the memory end
Change the whole above code to the following;
if Config.UseRPName then if GetResourceState("es_extended"):find("start") then Framework.Object = exports["es_extended"]:getSharedObject() Framework.Initial = "esx" Framework.GetPlayer = Framework.Object.GetPlayerFromId Framework.GetPlayerName = function(source) local xPlayer = Framework.GetPlayer(source) return xPlayer and xPlayer.getName() or nil end elseif GetResourceState("qb-core"):find("start") then Framework.Object = exports["qb-core"]:GetCoreObject() Framework.Initial = "qb" Framework.GetPlayer = Framework.Object.Functions.GetPlayer Framework.GetPlayerName = function(source) local xPlayer = Framework.GetPlayer(source) return xPlayer and ("%s %s"):format(xPlayer.PlayerData.charinfo.firstname, xPlayer.PlayerData.charinfo.lastname) or nil end end Framework.Object = nil -- free up the memory end