[RELEASE] [ESX] Reputation System

ESX Reputation System

A simple reputation system for ESX V1 Final
Originally this script was created inside my drug script: (TBA)

I decided I wanted to also use these features without rewriting the code for each individual script, so I ended up taking it from my drug script and allowing it to work independently.

I’m not sure if there are any other reputation systems out there but I decided to allow other developers to use my system for their scripts if they wanted to. I created this script using ESX V1 Final, any version above or below that has not been tested. Now, let’s get into the code.

Requirements

Features

  • Add / Remove Reputation Points
  • Check for Reputation

Installation

  • Import esx_reputation.sql in your database.
  • Add this in your server.cfg
ensure esx_reputation

How To Use

When players load into the server esx_reputation will check for an existing reputation. If no reputation is found one will be made.

To add/remove reputation points use the following (Client):

TriggerEvent('esx_reputation:addReputation', value)

To add/remove reputation points use the following (Server):

TriggerClientEvent('esx_reputation:addReputation', source, value)

To check for players reputation use the following:

ESX.TriggerServerCallback('esx_reputation:getReputation', function(reputation)
    -- Insert Code Here --
end)

Here is an example how it can be used:

ESX.TriggerServerCallback('esx_reputation:getReputation', function(reputation)
    local playerReputation = reputation

    if playerReputation >= 70 then   -- If the player's reputation is greater than or equal to 70, do the following
        print('You passed the test!')
    else
        print('You failed the test!')
    end
end)

Download

Version 1.0 (Latest Version)

Github

Note

The minimum reputation value is 0 while the maximum reputation is 100. No need to worry about going over/under the minimum and maximum, when reputation is added or subtracted it will check to make sure it stays above 0 and below 100.

This is my first public release, I’ll be happy to answer any questions you may have, support will be provided.

5 Likes

@DevNaka you got drug script with a reputation system? Is it for sale?

Yes, I have been working on many scripts that use this system. It won’t be available until I finish working on my server (within a few months) and then I will be releasing them.