How to monetize your fivem server

Hey!
After the great news coming from our community developers, we are finally able to make a profit out of our hard work (Announcing Tebex Partnership - Server Monetization / Commerce '2.0')

But now you might be wondering how do you start doing that!? It’s pretty simple! follow the steps:

  1. Register an account at tebex.io
  2. After registering your account, you should see this:
    so select “Fivem” and click on “continue” then “CREATE MY WEBSTORE”. After reading all the information and the rules click on “accept & continue”
  3. Pick a name for your store then select a currency (the selected currency will be the currency that your players will pay with)
    then click “continue”.
  4. After following all the steps above you should be seeing this: Select " GAME SERVER" and click on “continue”
  5. Now click on “COPY COMMAND” to copy your store’s secret code (this code should not be shared with anyone, I am showing it because it is a fake account which will be deleted afterwards) and paste it in your server.cfg then restart your server and make sure that you are running version #2609 or above.

Once you restart your server it should say “Authenticated with tebex … and your store name…” in green in your console. image

When you see this message you will be able to click on “continue setup process” on tebex.io.

  1. Now you should be seeing this:

all what you see is not necessarily needed (logos/designs/etc…) I will go through the important stuff only like setting up a package which will do an action ingame:

in “Create a package” click on complete this item. You should see this:

Now click on “Add new” then “package”, choose “Game Package” and click on CREATE. Now set all the required description like price, name, etc… and click on “create”.

Now you have your package ready! But there is no automated command linked with it, people can buy now but they won’t get anything in return, what should you do then? Simple! click on the 3 dots symbol next to your package then click on “edit”. Now go to the bottom where you see

And click “ADD COMMAND”

Now you can choose between multiple events, for example choose “When a player purchases this package”. Next to this you will see an edit box where you can set a command to be executed when the event happens. In this case, when a player purchases this package. So for example you can set testingCommand {username} {packageName} {price}

(all special tags can be found at https://docs.tebex.io/store/command-management/an-introduction-to-commands)

and create a server side script and put this in:
image

function testing(_, arg)
	local username = arg[1]
	local packageName = arg[2]
	local price = arg[3]
	print(username…" has just purchased “…packageName…” for "…tostring(price))
end
RegisterCommand(“testingCommand”, testing, true)

Now when a player purchases a package it will print their name, the package they bought and its price in your ingame console. Congratulations, your store is up and running! You can take it from that point and continue to make incredible stuff!

5 Likes

Well written explanation thank you so much it you are awesome.

Not work for me …

Make sure to:

  1. Have the latest server version
  2. delete the old Tebex resource as it is officially integrated now.
  3. Restart the server after adding the sv_tebexSecret line (or you can just paste the line in your server’s console to test instantly without restart)

If nothing works from the above, show me a screenshot of your server’s console to see the issue.

Not work …

Version Fivem server:
image

Console Fivem :

Result :

Your server’s version (Version 2567) is obviously not the latest version. The tutorial says make sure that you are running version #2609 or above.

I have no idea how you can update your server version on zap-hosting game server so you might want to contact them.

EDIT: You might want to remove your screenshots as it shows your secret code…

Hello,
Is it possible to have a store without the need of a CFX.re account ?
tebex
Because not everyone speak english and understand how/why create a fivem account - instead can’t we let players write their player’s name ?

Thanks , no probleme for secret code i reset it …

I had the same issue. I contacted their support and they told me that unfortunately we are forced to use cfx.re authentication although I’d prefer to use steam one…

1 Like

Could you detail more the command party which is not explained anywhere on Tebex for example give money, vehicles, weapons ect …@HassoNFTW

You can get the player from his name OR steam id OR fivem id then do whatever you want to him. Little example related to the example in the tutorial:

-- in tebex
testingCommand {purchaserName}

-- in server side

function testing(_, arg)
	local name = arg[1]
    local player = getPlayerFromName(name) -- you have your player and you can do whatever action to him...
    -- your code !
end
RegisterCommand(“testingCommand”, testing, true)

funciton getPlayerFromName(name)
	for _, player in ipairs(GetPlayers()) do
		if (GetPlayerName(player) == name) then
			return player
		end
	end
	return false
end

Just note that I haven’t tested this and it is just a pure example, I normally use the {hexid} to get the player’s steam id and give them rewards so not sure about the {purchaserName}.

For online commands there’s also {sid} which is the server ID. Don’t do manual name lookup! :man_facepalming:

{sid} wasn’t mentioned anywhere in their documentation. Thanks for the info…

1 Like

frankly very very badly explained your shop system on Fivem nothing tells us how to use the shop to for example give money, vehicle ect …
Me who wanted to invest every month I’ll find another way than Tebex !

Hassony I’m really sorry but I still don’t understand, I ask you a lot but could you do the script as you say to give money to a player and save the order, I will test that on my server and then I think I will start to understand maybe better …
There i am lost

This is not “copy this code and run your server” tutorial. I am not going to explain how you give money because I have absolutely no idea what money system you use… This tutorial was made for those who actually make scripts themselves not for those who run servers with 0 scripting knowledge.

2 Likes

I use es_extented

I haven’t managed to get {sid} to return any results yet :man_shrugging:

Tried manual payments and live environment but doesn’t return anything. Check player is in-game and signed in through cfx.

If you use {id} you will return the CFX account ID that the player associated their Tebex account with. I’ve been using that for my manual payment tests. {hexid} as described in the Tebex docs is probably only applicable to the old FiveM plugin they used to have.

That together with a “must choose server” enabled so the player must select the server. Has worked until now. Unfortunately you don’t seem to be able to trigger a command on more servers though without triggering it on all servers (global command). E.g. you have 3 servers but only want it triggered on 2 doesn’t seem to be possible. That’s quite an edge case though

1 Like