[RELEASE] SQZ_SWITCHJOB - Switch between multiple jobs

SQZ_SWITCHJOB

This is an another my simple resource which allows you to have multiple jobs, switch them using command /changejob and log it to the admin team - to room at the Discord server where admin team will has access to.

Features

  • Easy install and edit
  • Have double jobs (be a gangester and waiter)
  • Change jobs using command
  • Log it for admins
  • Allow admins change players second job directly from game

You can read the docs here

Docs

Installation

Is is quite simple, there are only few simple steps.

  • Import sql.sql to your database
  • Go to /server/main.lua and edit local webhook = 'xxx' to your likings.
  • Go to /client/main.lua and edit all by your’s liking :slight_smile: Mainly the notifications. Optional
  • Go to /server/main.lua and edit allowedAdminGroups which contains allowed admin groups

You can edit it or use like you like, but you are not allowed to publish it as yours, rename it (other names then sqz_switchjob) or sell/resell it. These are the simple rules.

Source code (Github)

Changelog

1.0.1:

  • Updated MySQL queries & optimised
  • Rewrote Discord Webhook solution

1.0.2:

  • Added /setjob2 command

Our other paid scripts

Our free scripts

15 Likes

Anyone can use this command?

Its a way to set that only mafia can use the command, with only certain jobs?

1 Like

Must i have discord?

1 Like

Nope :slight_smile: Why? :smiley: You can remove Webhook sending part :slight_smile:

1 Like

Yes, anyone can use this command. The point of this script is if for example a mafia member has job mafia to allow him to change his job for a bar and be a barman like.

But if you want, you can restrict it for certain jobs like:

local allowedJobs = {
'mafia',
'gang'
-- Add jobs allowed to use this command here, each job to its own line
} 

RegisterCommand("changejob", function (src, args, raw)
for _, allowedJob in pairs(allowedJobs) do
if ESX.PlayerData.job.name == allowedJob then
    if timer == 0 and allowCommand then
        TriggerServerEvent('sqz_switchjob:getSecondJob')
        timer = 30
        allowCommand = false
    else
        ESX.ShowNotification('You have to wait 30 seconds between switching jobs, now you have to wait: (time in seconds) '..timer) -- Here you can change whatewer you want
    end
else
-- Some way to inform player he is not allowed to use it.
end
end
end, false)

This editor is not the best for editting lua code, so I hope it is legible and you can read it :slight_smile:

Have a nice day

2 Likes

So just comment out the cell?

1 Like

Just comment out the function Performing Http Reuqest to Discord webhook :slight_smile:

2 Likes

Nice release! Very good job dude :wink:

2 Likes

Great release. I really appreciate that!!

Keep going on !

2 Likes

Ey, hi, is there a way that only admins can give the second job?
So i can give to a band their role and they can still change their first job in the jobs place.
Any way, thanks a lot and sorry if something is bad written

1 Like

You can make

  • Database whitelist (making a column in users table, called e.g. secondJobAllowed - default will be 0 and if is 1, he will be able to do that)
  • Group whitelist (only certain groups have it - admin etc)
  • Steam ID whitelist (make in config allowed Steam IDs and if yours player is whitelisted, he will be able to switch his job)
  • Any other way :smiley:
2 Likes

Thanks mate, have a nice day and continue doing this awesome scripts

2 Likes

This is so helpfull mate! Thanks for this release!! :smiley:
Let me drop an idea, add a /setjob2 command that gives the second job to the player so you dont need to do it manualy in the database.

1 Like

@squizer squizere co je local webhook?
Předem díky za odpověď

1 Like

Hello, thats cool idea, I can do it. So admin types:

/setjob2 playerID jobName jobGrade and it sets his job.

Thats cool suggestion, thank you for it, I will add it.

2 Likes

local webhook je webhook, kam se posílá info o tom, jak si hráč mění jeho práci.

1 Like

Hello nice release I Have a question can i put it in the hud to show the second job that i have??

1 Like

Yes, of course you can.

1 Like

do you have the code or a ready hud??

1 Like

No, I do not

1 Like