[FREE] [ESX] πŸ‘¨β€πŸ’» Add Clock In/Out for every Job!

πŸ•’ FSOCIETY'S Job Clock


:clipboard: Download Here!


Have other ideas of scripts for me to realese? Let me know in the comments!
Other scripts i have made:
[PAID] [QB / ESX] :man_technologist: Best Drug Dealer Script - 2023
[PAID] [QB / ESX] :man_technologist: LA / NYC Realistic IDs - 2023
[FREE] [STANDALONE] :man_technologist: Discord Presence - 2023
[FREE] [STANDALONE] :man_technologist: Admin/Staff Discord Report Tracker (Manage Staff Activity) - 2023

:thinking: Can you tell me briefly about this resource?

A simple resource that allows you to set yourself clocked in/out in any job!
Using this resource, you’ll be able to add targets through ox_target to clock in/out for any job you’d like!

:gear: Great! What dependencies do i need?

In order to use this resource, you’ll need:

:question: Ok… but how do i use it?

So in order to use this resource and add jobs correctly you’ll need to use the config file provided under shared/config.lua.

In this file you’ll find 2 jobs as an example for how to add jobs to this resource.

Open the config file, and you’ll see this table:

Config.Jobs = {
    Police = {
        ClockedInJob = "police",
        ClockedOutJob = "offdutypolice",
        Locations = {
            vec3(440.8877, -981.1199, 30.6896)
        }
    },

    Ambulance = {
        ClockedInJob = "ambulance",
        ClockedOutJob = "offdutyambulance",
        Locations = {
            vec3(260.9588, -1358.3494, 24.5378)
        }
    },
}

Lets break it down into pieces.

First of all, we can clearly see that there is a table for every job we are adding to the resource.

In order to add a job, we will need to add a table inside it.

For example:

If I’d like to add a fire department job to this clock in/out resource, my new config will look something like this:

Config.Jobs = {
    Police = {
        ClockedInJob = "police",
        ClockedOutJob = "offdutypolice",
        Locations = {
            vec3(440.8877, -981.1199, 30.6896)
        }
    },

    Ambulance = {
        ClockedInJob = "ambulance",
        ClockedOutJob = "offdutyambulance",
        Locations = {
            vec3(260.9588, -1358.3494, 24.5378)
        }
    },

    FireDep = {
        ClockedInJob = "fire",
        ClockedOutJob = "offdutyfire",
        Locations = {
            vec3(-632.5477, -121.8778, 39.2291)
        }
    },
}

Lets take a closer look on the fields inside the added table.

ClockedInJob is the registered job name that you want the player to have when he is clocked in.

ClockedOutJob is the registered job name that you want the player to have when he is clocked out.

Locations is a table of the locations that the players in the added job will be able to go and clock in/out there.

So, after we have successfully setup our new config file. We will need to register the clock-out job in your server (assuming that you already have your clock-in job working inside your server)

In order to do so, I have left examples inside install/job.sql. (If you want to use the police and ambulance exmaples in your server, make sure to run this sql inside your database)

Let’s quickly hover back to our fire dep. example, and i’ll show you know how to register the job correctly.

This is how my sql file will look like after adding the clock-out fire job in.

INSERT INTO `jobs` (`name`, `label`, `whitelisted`) VALUES
    ('offdutypolice', 'Off-Duty Police', 1),
    ('offdutyambulance', 'Off-Duty Ambulance', 1);
    ('offdutyfire', 'Off-Duty Fire Dep.', 1);

INSERT INTO `job_grades` (`job_name`, `grade`, `name`, `label`, `salary`, `skin_male`, `skin_female`) VALUES 
    ('offdutypolice', 0, 'recruit', 'Off-Duty Recruit', 20, '{}', '{}'),
    ('offdutypolice', 1, 'officer', 'Off-Duty Officer', 40, '{}', '{}'),
    ('offdutypolice', 2, 'sergeant', 'Off-Duty Sergeant', 60, '{}', '{}'),
    ('offdutypolice', 3, 'lieutenant', 'Off-Duty Lieutenant', 85, '{}', '{}'),
    ('offdutypolice', 4, 'boss', 'Off-Duty Captain', 100, '{}', '{}'),
    
    ('offdutyambulance', 0, 'ambulance', 'Off-Duty Jr. EMT', 20, '{}', '{}'),
    ('offdutyambulance', 1, 'doctor', 'Off-Duty EMT', 40, '{}', '{}'),
    ('offdutyambulance', 2, 'cheif_doctor', 'Off-Duty Sr. EMT', 60, '{}', '{}'),
    ('offdutyambulance', 3, 'boss', 'Off-Duty EMT Supervisor', 80, '{}', '{}'),
    
    ('offdutyfire', 0, 'recruit', 'Off-Duty Fire Recruit', 20, '{}', '{}'),
    ('offdutyfire', 1, 'novice', 'Off-Duty Fire Fighter', 40, '{}', '{}'),
    ('offdutyfire', 2, 'experienced', 'Off-Duty Fire General', 60, '{}', '{}'),
    ('offdutyfire', 3, 'boss', 'Off-Duty Fire Boss', 80, '{}', '{}');

We can clearly see how offdutypolice, offdutyambulance and offdutyfire are matching our config file!

After taking a look at install/job.sql we can see that in order to register a job inside our server we will need to:

  • Add the job inside our jobs table like shown.
  • Add the same job grades as the regular job to the off-clock job, inside our job_grades table like shown.

Last, add ensure fs_jobclock inside your server.cfg anywhere below es_extended & ox_target

If you have done all of those steps correctly - Congratulations! You got the resource working properly!

:sos: Wait… But what if i need help?

  • Look at the GitHub repo for further information.
Code is accessible Yes
Subscription-based No
Lines (approximately) ~113
Requirements es_extended, ox_target
Support Yes
4 Likes

nice work and if you can add also discord webhook it will be great

2 Likes

Will be added! Thanks for your feedback :smile:

Did this get added?