The following events are triggered after specific exports are triggered, here's a list of all events and the exports that triggers it.
What's resource:?
resource is the name of the resource to which the group belongs. In other words, if your resource is called "av_boosting", then the event name will be "av_boosting:groupDeleted", for example.
resource:groupDeleted
This client event is triggered when the export deleteGroup() wipes a group, it is triggered to every member of the group, the event doesn't contain any parameter.
resource/client.lua
RegisterNetEvent("av_boosting:groupDeleted", function()print("oops your group got deleted")end
resource:updateGroup
This is a client event and is triggered only to the members from a group when a member gets removed. It contains all group info.
This client event is triggered only if one of the following exports are successful:
createGroups(): If the group is created, the script will update all players in server.
removeMember(): If a member is removed from a group, this will update the removed player and all members from the same group.
leaveGroup(): If a member leaves a group it will update the group members only, BUT if the group doesn't have any members left it will update all players in server.
resource:leaveGroup
This is a client and server event and it gets triggered after one of the following exports are successful:
removeMember(): If member is removed from a group.
-- The event receives all existing groups that belong to that resource
RegisterNetEvent("av_boosting:updateGroups", function(allGroups)
print(json.encode(allGroups, {indent = true}))
end
resource/server.lua
RegisterServerEvent("av_boosting:leaveGroup", function(identifier)
local playerSource = exports['av_laptop']:getSourceByIdentifier(identifier)
if playerSource then
-- Trigger something to client if you want (or not)
end
end)
resource/client.lua
RegisterNetEvent('av_boosting:leaveGroup', function()
print("Player got removed from a group :(")
end)