[Release] VIP Status [ESX]

Hello,

Here is a small release that I used to use on my server.
It give you the ability to give your player a VIP Status which can enable them to gain access to more features you’ve built into your server. Like a custom vehicle shop where there is addons cars. Limit a certain drug to vip users etc

This has been approuved by Ianthanum on the official Discord of FiveM when receiving for exemple a donation for a certain amount to help you pay for your hosting etc as long as you do not make any profit and use a built-in commerce.

Pretty easy to use and use 0,01% of ressources according to RESMON
Every detail is on the GITHUB.
Enjoy

Requirement: ESX

https://github.com/KingRyuShin/pxrp_vip

*P.S: If you use a system like KASHACTERS where you enable multiple character, you gonna have to add the vip manually in the database or with the command to every single character because the vip status is attached to the users table.

After that… you just have to create a PHP files on your website, portal etc that redirect the player there and enable them to enter their steamid and it will set their vip status to true, pretty easy to do*

21 Likes

very nice resource, i love it
but, this one need to clone resource?

example: esx_vehicleshop (for non-vip) and esx_vehicleshopvip (for vip) (?)
or esx_supermarket (for non-vip) and esx_supermarketvip (for vip) (?)

and i want to ask, how to implement this one without clone resource

example: esx_vehicleshop usable for non-vip and vip
i mean, for non-vip only list 75% add-on cars
and for vip list 100% add-on cars
or
esx_supermarket for non-vip with normal config price
and for vip with cheap config price

No, you don’t need to clone any ressources to use this.
You can simply call the VipCallBack to a new server event from vehicleshop and in that event for the price you can reduce it by 25% using a simple math line.

exemple here for supermarket:

So for exemple using esx_shops in client.lua

-- Key Controls
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		if currentAction then
			ESX.ShowHelpNotification(currentActionMsg)

			if IsControlJustReleased(0, 38) then
				if currentAction == 'shop_menu' then
					OpenShopMenu(currentActionData.zone)
				end

				currentAction = nil
			end
		else
			Citizen.Wait(500)
		end
	end
end)

in the OpenShopMenu you can simply modify this line:

			if data2.current.value == 'yes' then
				ESX.TriggerServerCallback('pxrp_vip:getVIPStatus', function(isVIP)
					if isVIP then
						TriggerServerEvent('esx_shops:buyItemVIP', data.current.item, data.current.value, zone)
					else
						TriggerServerEvent('esx_shops:buyItem', data.current.item, data.current.value, zone)
					end
				end, GetPlayerServerId(PlayerId()), '1')			
			end

in the server.lua you can create this new event:

RegisterServerEvent('esx_shops:buyItemVIP')
AddEventHandler('esx_shops:buyItemVIP', function(itemName, amount, zone)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	local sourceItem = xPlayer.getInventoryItem(itemName)

	amount = ESX.Math.Round(amount)

	-- is the player trying to exploit?
	if amount < 0 then
		print('esx_shops: ' .. xPlayer.identifier .. ' attempted to exploit the shop!')
		return
	end

	-- get price
	local price = 0
	local itemLabel = ''

	for i=1, #ShopItems[zone], 1 do
		if ShopItems[zone][i].item == itemName then
			price = ShopItems[zone][i].price
			itemLabel = ShopItems[zone][i].label
			break
		end
	end

	price = price / 25 * 100 * amount

	-- can the player afford this item?
	if xPlayer.getMoney() >= price then
		-- can the player carry the said amount of x item?
		if xPlayer.canCarryItem(itemName, amount) then
			xPlayer.removeMoney(price)
			xPlayer.addInventoryItem(itemName, amount)
			xPlayer.showNotification(_U('bought', amount, itemLabel, ESX.Math.GroupDigits(price)))
		else
			xPlayer.showNotification(_U('player_cannot_hold'))
		end
	else
		local missingMoney = price - xPlayer.getMoney()
		xPlayer.showNotification(_U('not_enough', ESX.Math.GroupDigits(missingMoney)))
	end
end)

There is a simplier way to do it, but it will work.

2 Likes

omg, thank you so much dude!

I didnt understand a single thing.

1 Like

What did you not understand exactly ?
I agree that my english is not perfect because I mainly speak french, but atleast I’m trying :stuck_out_tongue:

Your english is good but i thought you’d showcase it or something.Thats why i didnt get it.

There is nothing to showcase really.
You use the callback and it unlockthe function for the vip user or you can use it to set price cheaper etc for supermarket like I did in one of my post above yours.

Exemple : Give VIP status to a player that has donated a certain ammount of money to help the community so he can access a new vehicle shop.

^That is against FiveM ToS…

1 Like

Did you read my post ? It’s been approved by Ianthanum that we can do “package” as a donation to help pay the hosting, as long as we do not make profit and use built-in commerce we are aloud.
There is also a pictures to show it.

how can i use this for vehicleshop and any other stuff etc.

Just use the callback, in the 3rd post I did an exemple with esx_shop, the same way apply for any other script.

hey dude stop bullying him !!! Just because of you and people like you , noone share great scripts to our fivem community !!! (sorry for bad english)

1 Like

How can I use it to enable KASHACTERS second account creation only for VIP’s?

2 Likes

Add the callback in the character creation of KASHACTERS with the FirstSpawn function if I remember correctly.

1 Like

20191105190132_1
can you help me

It’s because I made modification but forgot to change the text because i was using the identifier.
if you use the command it’s like that :
/addvipstatus SERVERID

(From the scoreboard)

Exemple: /addvipstatus 134

Can peds be granted to players

1 Like

This resource is very helpful!

Thank you :smiley:

Hi ! I have some problems… first is this, the spam in console:

“pxrp_vip: steam:110000106b56e98 VIP status has been reset for the player!”

And in second, i put it un a vehicleshop, the menu, when we are not VIP, opens anyway…

3 Likes