🚒Job Center

for developers

Configuration

Configuration events of files in gksphone/config/jobs

Job list and general settings section of jobs

icon = https://fonts.google.com/icons

MimWorkers = Minimum number of players to work

MaxWorkers = Maximum number of players to work

Location = If there is a position, specify it as vector3 or vector4 if there is no position, make it false

RequiredItem = If there is an item required to see the job, write the item code here, if not, set it to false

IsActive = to set the availability of the job


["sanitation"] = {
        ["Name"] = "Job Code",
        ["Label"] = "Name of the Job",
        ["Description"] = "Job description",
        ["Icon"] = "Icon Name",
        ["IconColor"] = "Icon color",
        ["Rating"] = 2,
        ["MimWorkers"] = 1, 
        ["MaxWorkers"] = 2, 
        ["Location"] = false, 
        ["RequiredItem"] = false, 
},

Events

Sample files are available in gksphone/client/apps/job and gksphone/server/job.

RegisterNetEvent("gksphone:client:JobStartTask", function (jobInfoName, Tasks)
    -- Event running for all group members
    -- jobInfoName ( job code )
    -- Tasks ( tasks assigned for the job )
end)


RegisterNetEvent("gksphone:client:jobStartLeader", function (jobInfoName)
    -- event running for group leader when job starts
    -- jobInfoName ( job code )
end)


RegisterNetEvent("gksphone:client:JobNextTask", function (NewTaskID)
    -- Event running on all group members and when a new task progresses
    -- NewTaskID = task id of the new task
end)

There is no finish event, you have to finish it manually and delete the group using export

Exports - Server

GetJobGroupByLeader

Brings the group information of the person who is the Group Leader.

local playerIdentifier = "Player Identifier" 
local groupData = exports["gksphone"]:GetJobGroupByLeader(playerIdentifier)
print(json.encode(groupData, {indent = true}))

DeleteJobGroup

Delete Group

exports["gksphone"]:DeleteJobGroup("jobcode", groupID)

GetGroupByMember

Returns the information of the group with the player identifier

local playerIdentifier = "Player Identifier" 
exports["gksphone"]:GetGroupByMember(playerIdentifier)

Exports - Client

IsGroupLeader

local isLeader = exports["gksphone"]:IsGroupLeader()
print(isLeader) -- true or false

IsTaskStatus

local TaskID = 1
local isLeader = exports["gksphone"]:IsTaskStatus(TaskID)
print(isLeader) -- true or false

TaskUpdate

local TaskID = 1
local TaskStatus = true -- true or false
local ExtraDone = 0 -- if it is a progressive job, you can change the number accordingly
exports["gksphone"]:TaskUpdate(TaskID, TaskStatus, ExtraDone)

TaskListUpdate

If you want to make changes in Task List Text, you can use

-- TaskList == Send all tasks list after making the exchange
exports["gksphone"]:TaskListUpdate(TaskList)

TaskList

local taskList = exports["gksphone"]:TaskList()

Last updated