[RELEASE] XNLRankBar ('Fully' working original GTA Rankbar / XP Bar NATIVELY! - with original GTA Levels!)

well thanks to @VenomXNL , @sixsens and @Jules_Lucas it was very easy to set all of this up
thanks for @sixsens for 70% of the server file and @Jules_Lucas for 30% of the server file + some basic knowledge for ESX and the instructions that @VenomXNL mentioned .
so this is my XNLRANKBAR for ESX fully working and saving levels (xp) to database so player levels are saved .
XNLRankBar.rar (13.2 KB)
Steps to make this work :
-download the file and extract to your ressources folder .
-add start XNLRankBar in your config file .
-go to users table in your database -> then columns -> add a column called ‘xp’ with this options .


-now save and start your server .
-now the rank bar will showup if you use NUMPAD8 ( you can change it in client.lua line 110 )
-i set max rank to 5000 but you can change it in client.lua line 154
-> the rank bar is fully working and saving .
-> it’s up to you to use the four lines below in your scripts :

to gain xp :

exports.XNLRankBar:Exp_XNL_AddPlayerXP(100)
TriggerServerEvent(‘AddXp’, 100)

to remove xp :

exports.XNLRankBar:Exp_XNL_RemovePlayerXP(100)
TriggerServerEvent(‘RemoveXp’, 100)

->you can change the value ‘100’ to any other value you want . [note: 100 is the xp]

PS : DON’T FORGET THAT THE RANK BAR WON’T ADD XP ON ITS OWN ! YOU SHOULD USE THE LINES ABOVE TO ADD/REMOVE XP FOR A CERTAIN ACTION IN YOUR SCRIPTS !
NOTE : i forgot to mention that i changed the rankbar color so you can change it back in line 694 .

COLOR NUMBERS :slight_smile:

            PURE_WHITE = 0
	WHITE 		= 1
	BLACK 		= 2
	GREY 		= 3
	GREYLIGHT 	= 4
	GREYDARK 	= 5
	RED 		= 6
	REDLIGHT 	= 7
	REDDARK 	= 8 <- the one i'm  actually using
	BLUE 		= 9
	BLUELIGHT 	= 10
	BLUEDARK 	= 11
	YELLOW 		= 12
	YELLOWLIGHT = 13
	YELLOWDARK 	= 14
	ORANGE 		= 15
	ORANGELIGHT = 16
	ORANGEDARK 	= 17
	GREEN 		= 18
	GREENLIGHT 	= 19
	GREENDARK 	= 20
	PURPLE 		= 21
	PURPLELIGHT	= 22
	PURPLEDARK 	= 23
	PINK 		= 24
	BRONZE 		= 107
	SILVER 		= 108
	GOLD 		= 109
	PLATINUM 	= 110
	FREEMODE 	= 116	-- This is the 'normal blue color' for the Rankbar
4 Likes

yo did you find a solution ?
nvm i was using them on server side instead of clientside xD + I didn’t add the server part to other scripts to use triggerserverevent xD

what is the mistake ?

… better, don’t quote something unrelated and explain what problem you are having.

Can I place a certain level to purchase a vehicle from the showroom?
And how ?

Sure… if you would make an entire vehicle purchase system linked to levels etc :wink:

However, just like explained multiple times in questions now, and in the main post:
This script does NOT store XP, does NOT handle leveling, ranks etc…

It’s ONLY the Graphical interface of the XP bar which has been restored for use with FiveM.

Storing XP, levels, ranks etc etc still needs to be done on or with your own framework.

how i cant add xp for kills?

Is possible to add - earn XP when working and that after you gain eg level 5, then you can use some menus (such as buying weapons in ammunation etc.).

How do I add it in esx_vehicleshop?

Hi, I have a problem with the script.
I am using it with the esx modification to store the xp in the database.
I have added the call to a racing script so that it gives exp when an action is executed but at the moment of having to give the exp nothing happens and it gives me this error.

Does anyone know why this happens?
I can’t get exp to be added or added to the common xp of the database

Thanks.

Lekker gemaakt man, fantastisch werk!

1 Like

Can you please make an database connection for this script?

try this

RegisterNetEvent(“XNLRankBar:client:XNL_GetCurrentPlayerXP”)

AddEventHandler(“XNLRankBar:client:XNL_GetCurrentPlayerXP”, function()

CreateRankBar(XNL_GetCurrentPlayerXP(CurLevel), XNL_GetXPCeilingForLevel(CurLevel), AnimateFrom, XNL_CurrentPlayerXP, CurLevel, false)

end)

i have this fonction has worked with esx_xp but how I can adapte to this XNLRankBar?

function level()

    local xPlayer = ESX.GetPlayerData()

    local playerXP = xPlayer.xp

    local playerRank = xPlayer.rank

    

    return playerRank

end```

did you can help me with the problem below? thank :slight_smile:

How to add Xp in here

RegisterServerEvent(‘coke:pickedUpCannabis’)
AddEventHandler(‘coke:pickedUpCannabis’, function()
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.canCarryItem('crack', 2) then
	xPlayer.addInventoryItem('crack', 2)
else
	xPlayer.showNotification(_U('weed_inventoryfull'))
end

end)

AddEventHandler(‘coke:pickedUpCannabis’, function()
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.canCarryItem('crack', 2) then
	xPlayer.addInventoryItem('crack', 2)
                TriggerClientEvent('XNL_NET:AddPlayerXP', source , 50)
else
	xPlayer.showNotification(_U('weed_inventoryfull'))
end

end)```

Try This :wink:

Could you solve it?

Hello Friend… Thanks for Nice script…
I need ask something… can some help to disable control for xp below 800, 2100, 3800, 6100

Thanks

how can i add level beside player name on esx_scoreboard