Player Clubs resource for FiveM > ESX
SodyFX presents: sody_clubs
A resource for FiveM and ESX. This resources adds an additional layer of society living, clubs! Clubs have a similar structure as ESX jobs. There is an owner who has access to the same basic Boss menu from society and can perform similar actions of the Boss menu. Clubs have multiple features as well and allow players to have day-jobs to go along with their club perks.
treasurer
allows the person to deposit/withdraw club money as well as show current balanceUse /setclub PlayerId ClubName ClubRank
command as jobmaster/admin/superadmin or as club owner, recruit members via the Owner menu
start sody_clubs
In order to use sody_clubs with esx_doorlocks, esx_doorlocks needs to be adjusted to receive club data. To do this, edit the following files or if you're using an unmodified esx_doorlocks, you can grab my fork here: https://github.com/SodyFX/esx_doorlock
Comment out Lines 25-28:
--if not IsAuthorized(xPlayer.job.name, Config.DoorList[doorID]) then
-- print(('esx_doorlock: %s was not authorized to open a locked door!'):format(xPlayer.identifier))
-- return
--end
This is done to avoid having to send club data to the server for every player. You can leave it in if you wish, but when club members try to open a door, it'll show in your server console, up to you.
Insert Line 2 - Add (after ESX = nil):
local PlayerClub, PlayerRankNum = nil, 0
Insert after line 21 (after esx_doorlock:getDoorInfo callback):
ESX.TriggerServerCallback('sody_clubs:getPlayerClub', function(playerdata)
PlayerClub = playerdata.club
PlayerRankNum = playerdata.club_rank
end)
Insert after Line 29 (after esx:setJob event)
RegisterNetEvent('sody_clubs:clubAdded')
AddEventHandler('sody_clubs:clubAdded', function(club)
ESX.TriggerServerCallback('sody_clubs:getPlayerClub', function(playerdata)
PlayerClub = playerdata.club
PlayerRankNum = playerdata.club_rank
end)
end)
RegisterNetEvent('sody_clubs:clubRemoved')
AddEventHandler('sody_clubs:clubRemoved', function()
PlayerClub, PlayerRankNum = nil, 0
end)
Insert after Line 151 (inside IsAuthorized function, below job check but above return false
if door.authorizedClubs ~= nil then
if PlayerClub ~= nil and PlayerRankNum ~= nil then
for _,club in pairs(door.authorizedClubs) do
if club == PlayerClub and door.authorizedClubRank[1] <= PlayerRankNum then
return true
end
end
end
end
Add a new door like any other for esx_doorlocks except add authorizedClubs and authorizedClubRank as well. authorizedClubs is the club name from sody_clubs config and authorizedClubRank is the minimum rank in the club required to use the door. Here's the LMC club example:
{
objHash = GetHashKey('v_ilev_lostdoor'),
objCoords = vector3(981.61, -102.57, 74.85),
textCoords = vector3(981.72, -102.82, 75.85),
authorizedJobs = { },
authorizedClubs = { 'lmc', },
authorizedClubRank = { 0 },
locked = true,
maxDistance = 12,
size = 2
},