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 :
->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
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
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
Sure… if you would make an entire vehicle purchase system linked to levels etc
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.
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.
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: