Skip to content

Commit

Permalink
fix(server/player): update activeCount state when setting active group
Browse files Browse the repository at this point in the history
zzz
  • Loading branch information
thelindat committed Oct 16, 2024
1 parent bb61fa2 commit 4768e8c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/player/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ export class OxPlayer extends ClassInterface {
setActiveGroup(groupName?: string, temp?: boolean) {
if (!this.charId || (groupName && !(groupName in this.#groups))) return false;

SetActiveGroup(this.charId, temp ? undefined : groupName);
const currentActiveGroup = this.get('activeGroup');

if (currentActiveGroup) GlobalState[`${currentActiveGroup}:activeCount`] -= 1;

GlobalState[`${groupName}:activeCount`] += 1;

SetActiveGroup(this.charId, temp ? undefined : groupName);
this.set('activeGroup', groupName, true);
emit('ox:setActiveGroup', this.source, groupName);

Expand Down

0 comments on commit 4768e8c

Please sign in to comment.