Syn Society, like any other society, requires employee management, hence it requires to fetch players with the job. To make this work you require to fetch it through our player jobs table.
1) Anywhere within the script, add the following event...
Code:
2) ... then we want to fetch the employees from the server side everytime they open the society menu.
Search for the following: TriggerServerEvent("syn_society:getinvslots") and below it, put the following code...
Code:
TriggerServerEvent("ez_society:server:getEmployees", playerjob)
while ez_employees == nil do
Wait(100)
end
Example:
STEP 2 - Hire player
To make this work you must also hire a player for the job menu.
Search for TriggerServerEvent("syn_society:hire", playerid, playerjob) and put the following line of code either above or below...
To make this work you must also fire player from the job menu.
Search for WarMenu.IsMenuOpened('fire') replace the whole code block which looked like ...
for i = 1, #online do
if WarMenu.Button("ID: " .. online[i].no .. "// " .. online[i].name) then
if Config.vorp then
TriggerServerEvent("syn_society:fire", online[i].charid)
else
TriggerServerEvent("syn_society:fire", online[i].no)
end
WarMenu.CloseMenu()
end
end
with...
for i = 1, #ez_employees do
if WarMenu.Button("ID: " .. ez_employees[i].no .. "// " .. ez_employees[i].name) then
TriggerServerEvent("ez_society:server:fireEmployee", ez_employees[i], Config.jobs[playerjob].recruitmentrank)
end
end
Example:
STEP 4 - Rank Change
To make this work you must also set player rank from the job menu.
Search for WarMenu.IsMenuOpened('setrank') replace the whole code block which looked like ...
for i = 1, #online do
if online[i].jobgrade ~= nil then
if WarMenu.Button("ID: " .. online[i].no .. "// " .. online[i].name .. Config.Language.listrank .. online[i].jobgrade) then
if Config.vorp then
TriggerEvent("syn_inputs:sendinputs", Config.Language.confirm, Config.Language.rank, function(cb)
local rank = tonumber(cb)
TriggerServerEvent("syn_society:setrank", online[i].charid, rank)
end)
elseif Config.redem then
TriggerEvent("syn_inputs:sendinputs", Config.Language.confirm, Config.Language.rank, function(cb)
local rank = tonumber(cb)
TriggerServerEvent("syn_society:setrank", online[i].no, rank)
end)
end
WarMenu.CloseMenu()
end
else
if WarMenu.Button("ID: " .. online[i].no .. "// " .. online[i].name .. Config.Language.listrank) then
if Config.vorp then
TriggerEvent("syn_inputs:sendinputs", Config.Language.confirm, Config.Language.rank, function(cb)
local rank = tonumber(cb)
TriggerServerEvent("syn_society:setrank", online[i].charid, rank)
end)
elseif Config.redem then
TriggerEvent("syn_inputs:sendinputs", Config.Language.confirm, Config.Language.rank, function(cb)
local rank = tonumber(cb)
TriggerServerEvent("syn_society:setrank", online[i].no, rank)
end)
end
WarMenu.CloseMenu()
end
end
end
with...
for i = 1, #ez_employees do
if WarMenu.Button("ID: " .. ez_employees[i].no .. "// " .. ez_employees[i].name .. Config.Language.listrank .. ez_employees[i].grade) then
TriggerEvent("syn_inputs:sendinputs", Config.Language.confirm, Config.Language.rank, function(cb)
local rank = tonumber(cb)
TriggerServerEvent("ez_society:server:changeGrade", ez_employees[i], rank, Config.jobs[playerjob].recruitmentrank)
end)
WarMenu.CloseMenu()
end
end