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

Thank man,

sure there is, with this script it’s even quite as easy as calling:
exports.XNLRankBar:Exp_XNL_AddPlayerXP(500)

To give them 500XP for example :slight_smile:

You can for example make a timer which keeps track of the hours/minutes they’ve played (Typed HERE and NOT tested though):

PlayerOnlineTime = 0
Citizen.CreateThread(function()
	while true do
		Wait(60000)  -- One minute (NOTE: Do keep in mind that this isn't a very accurate method though but just an example! :) )
		PlayerOnlineTime = PlayerOnlineTime + 1
		if PlayerOnlineTime == 60 then
			exports.XNLRankBar:Exp_XNL_AddPlayerXP(500) -- Give the player 500XP when the hour has been reached
			PlayerOnlineTime = 0 -- Reset the 'hour timer'
		end
	end
end)

Do keep in mind you would have to save the variable if you don’t want players to
lost 57 minutes for example when they disconnect just before having played an whole hour!

You would of course also make it so that it will save (and load) the obtained XP in some way on your server so players can ‘resume’ where they where last time :slight_smile:

On my server I’m using an SQL implementation to keep track of all user stats, you could do something like that :slight_smile:

Hope this has given you some small directions to work on :slight_smile:

NOTE: I DO NOT offer support or help on doing so since I have build my own custom (and fully integrated so not compatible for sharing/release) system and I’m NOT famaliar with frameworks like ESX, vRP or others which people use.

1 Like

ill reduce it too 15 minute 150xp
this way i dont need to save anything.
i apreciae your exemple and ill use it.

i let you know tonight if it work…
i think it will

thx again

Do keep in mind that if you don’t save it, that players will still lose ‘progress’.

Situation Example:
Let’s say i have played 46 minutes on your server, So i would have received
450XP that session.

Then the next day I want to play again but then I will start all over again (since I did not
got “my 450XP back” from the day before).

It CAN work if you use it for special “session perks” or so, but keep in mind that players might become ‘surprised’, ‘confused’ or even ‘frustrated’ if they notice that they ‘earn stats’ but are just as well losing it when logging of :wink: :slight_smile:

i see… i thought it was a database include with the ressource…
didnt download yet…
ok
i just have to save each time they gain xp in the users db…
And retrieve it on player connect

Nope (is also stated though :wink: )
But i will never do so either since then lots of people will start to ‘complain’ that it’s either not compatible with ESX, vRP, Essential mode or any other game, or that i’m using a different type of database which they either don’t wan’t or understand etc :wink:

My releases are (nearly if not all) script I have developed for my own (custom from scratch without using frameworks) server, and the ones that are useful resources (like the working XP bar) I will often convert into ‘stand alone’ resources which are then ‘fully compatible’ with ALL scripts to implement :slight_smile:

Although this does mean that most require a SMALL bit of effort to implement on their own server :slight_smile: (But that isn’t a bad though, since if people want a ‘custom server’, then a bit of own effort and a bit of learning is never a bad thing :slight_smile: )

And indeed you’re right, you have to save it indeed and then retrieve on player connect :smiley:

thx for you time.
You are absolutely right.
There always people complain about everything.

thx for release your work.

1 Like

Thanks, and you’re welcome :slight_smile:
Yeah that’s the world of development: there are and will always be people missing features, not being happy with certain features or styles etc. BUT that also give opportunity’s to improve, learn from and develop yourself on :slight_smile:

Of-course I don’t know your own skill level in scripting, I have taken a look for a simple example:

This one has some basic user stats saving and re-loading.
Although I PERSONALLY don’t find it that effective and ‘quite buggy’ on some aspects (Mainly on unfinished parts though! so don’t flame me on that opinion haha), but it also has been a great resource for one of my friends whom just started to learn scripting and SQL us in FiveM

:slight_smile:

1 Like

I wonder if there is a script hidden there from sitting on the sofa or watching TV in the apartment

1 Like

Nope not ‘hidden’ but a ‘small spoiler’: I’m actually working on a MASSIVE script which re-enables all those features, including sitting in multiplayer apartments, watching TV, using the drinks in the homes and much more single player and multiplayer interactions + several additions which are standard not in the game but ‘should have been there’ to my opinion :slight_smile:

ALTHOUGH: I can’t give an estimate yet on when it will be released since i’m also working on side scripts while working on that one (to make sure it’s all compatible)

But it WILL be released when it’s done :slight_smile:

2 Likes

I loved your features especially your very lovely phone I’m looking for every your script

I’ll be waiting for this script to sit and watch TV and I’ll put your github in the favorites

Thanks for sharing your knowledge with us forum

1 Like

Well thanks man :slight_smile:

But I didn’t released any phone’s myself though :wink:
I THINK you are confusing me with the developer of Venomous_freemode (which i’m not) :slight_smile:

BUT I will introduce LOTS of new features, main game and original online game features back into FiveM wherever i can :slight_smile:

I guess the ‘confusion’ happened due to VenomXNL and venomous in the name of that freemode haha.

offtopic fun fact:
My wife her gamername (yes she’s a gamer to) is actually VenomousXNL (has been for years and a total coincidence with that freemode script) haha

This is great! Would also like to know how to implement the insert to HeidiSQL database (ESX) anyone willing to show an example LUA for a time script to add XP for time spent on the server and save it in to the SQL?

Thanks!

Thanks man :slight_smile:
Sorry I unfortunately can’t help you with that (since I don’t use HeidiSQL or ESX at all),
BUT… I THINK you might have more chance on ‘support/help’ if you make a small post in the https://forum.cfx.re/c/development/scripts section :slight_smile:

Just make a small post regarding the topic (you can even if you like of course just use my ‘tiny xp time reward example’ haha,

I don’t know your ‘skill level’ of course, but some basic pointers on how it works:
(Assuming you already have an database with users but no XP for example):
Adding an extra column to your database in the user settings called ‘userxp’
for example.

And then loading their XP value while they join from that column.
Then during gameplay i would RECOMMEND to update a local variable with the XP
and only save that once in a while (for example every 5 minutes or on level up for example), this prevents “massive datastreams” to your database if someone keeps
gaining XP with a mission for example :slight_smile:

Don’t know if this is ANY help at all since again: don’t know your ddvelopment skills,
BUT i’m fairly certain that there would be people able to help out in the link i’ve provided (since as far as i have noticed by now: “ESX is used quite a lot” haha so plenty
of people (I ASSUME) should know how it works :slight_smile:

1 Like

Hello, I did what had to do to save the XP in the bdd, but when I connect and not the TriggerClientEvent does not work :sob: Here’s the code

AddEventHandler('esx:playerLoaded', function(source)
    local xPlayer        = ESX.GetPlayerFromId(source)

	MySQL.Async.fetchAll('SELECT rank FROM users WHERE identifier = @identifier', {
		['@identifier'] = xPlayer.identifier
	}, function(result)
        print(result[1].rank)
        rankbd = result[1].rank
    end)
    
    TriggerClientEvent('XNL_NET:AddPlayerXP', TargetClient , rankbd)
end)

Screenshot_7

Hey,
First of all when loading stats the first time you should use:
XNL_SetInitialXPLevels(CurrentXP, ShowRankBar, ShowRankBarAnimating ) to prevent issues :wink:
or as netevent:
TriggerClientEvent('XNL_NET:XNL_SetInitialXPLevels', TargetClient , 3600, true, true)

:slight_smile:
Can you DM/PM me more of that log please so i could see where the problem would be :)?

I however strongly suggest something goes wrong in the database or calling script :slight_smile:
Try to change this:

MySQL.Async.fetchAll('SELECT rank FROM users WHERE identifier = @identifier', {

to:

MySQL.Async.fetchAll('SELECT `rank` FROM users WHERE identifier = @identifier', {

And see if that helps :wink: (NOTE: Those are NOT “normal quotes” (’) but the ones that are on the upper left of your keyboard (on the tilde (~) key) :slight_smile:

Thank you, for your help but I do not see or add the line you did not give I did this but nothing more

AddEventHandler('esx:playerLoaded', function(source)
    local xPlayer        = ESX.GetPlayerFromId(source)

	MySQL.Async.fetchAll('SELECT `rank` FROM users WHERE identifier = @identifier', {
		['@identifier'] = xPlayer.identifier
	}, function(result)
        print(result[1].rank)
        rankbd = result[1].rank
    end)
    
    TriggerClientEvent('XNL_NET:XNL_SetInitialXPLevels', TargetClient , 3600, true, true)
    TriggerClientEvent('XNL_NET:AddPlayerXP', TargetClient , rankbd)
end)

Loving this man :slight_smile: btw Heres a screenshot of something I think would be pretty cool :slight_smile:
image

Ahh i missed this one, you will need to set the TargetClient (which is in this case source)
You also only need ONE line, FIRST time on loading/spawning you can use SetInitialXPLevels, from there on you should use AddPlayerXP when they get xp :slight_smile:

Try this one :slight_smile: (BTW! This code is run serversided right?

AddEventHandler(‘esx:playerLoaded’, function(source)
local xPlayer = ESX.GetPlayerFromId(source)

MySQL.Async.fetchAll('SELECT `rank` FROM users WHERE identifier = @identifier', {
	['@identifier'] = xPlayer.identifier
}, function(result)
    print(result[1].rank)
    rankbd = result[1].rank
end)

TriggerClientEvent('XNL_NET:XNL_SetInitialXPLevels', source, 3600, true, true)

end)

Already working on a fully working (EXCEPT player stats since that’s server dependent) character creator :slight_smile:

Or isn’t that what you mean? :slight_smile:

Just specified stats would be a cool thing where we would be able to just have bars like the other stat systems out there just designed in such a fashion with possible HTML backing of it to bring that design to life. Ya know.