Skip to content

Commit

Permalink
added measurment gameSetting and vehicle class (#85)
Browse files Browse the repository at this point in the history
* added measurment gameSetting and vehicle class

* forgot to add stuff here
  • Loading branch information
Dav-Renz authored Jun 24, 2024
1 parent f601a21 commit de972ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/client/system/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function update() {
inVehicle: alt.Player.local.vehicle ? true : false,
inWater: native.isPedSwimming(alt.Player.local),
isAiming: native.isControlPressed(0, 25) && native.isPedArmed(alt.Player.local, 6),
isMetric: native.shouldUseMetricMeasurements(),
isFlying: native.isPedInFlyingVehicle(alt.Player.local),
isTalking: alt.isKeyDown(alt.Voice.activationKey),
lights: [lights, highbeams],
Expand All @@ -42,6 +43,7 @@ function update() {
stamina: alt.Player.local.stamina,
street: getStreetInfo(alt.Player.local),
time: { hour, minute, second },
vehicleClass: alt.Player.local.vehicle ? native.getVehicleClass(alt.Player.local.vehicle) : -1,
vehicleHealth: alt.Player.local.vehicle ? native.getVehicleEngineHealth(alt.Player.local.vehicle) : 0,
weapon: alt.Player.local.currentWeapon,
weather: getPreviousWeatherType(),
Expand Down
2 changes: 2 additions & 0 deletions src/main/shared/types/playerStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type PlayerStats = {
inWater: boolean;
isAiming: boolean;
isFlying: boolean;
isMetric: boolean;
isTalking: boolean;
lights: [boolean, boolean];
locked: boolean;
Expand All @@ -28,6 +29,7 @@ export type PlayerStats = {
stamina: number;
street: StreetData;
time: { hour: number; minute: number; second: number };
vehicleClass: number;
vehicleHealth: number;
weapon: number;
weather: string;
Expand Down
8 changes: 8 additions & 0 deletions webview/composables/usePlayerStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const data = ref<PlayerStats>({
inWater: false,
isAiming: false,
isFlying: false,
isMetric: true,
gear: 0,
maxGear: 0,
engineOn: false,
Expand All @@ -31,6 +32,7 @@ const data = ref<PlayerStats>({
weather: '',
indicatorLights: 0,
lights: [false, false],
vehicleClass: -1,
zone: '',
});

Expand Down Expand Up @@ -64,6 +66,9 @@ export function usePlayerStats() {
inWater: computed(() => {
return data.value.inWater;
}),
isMetric: computed(() => {
return data.value.isMetric;
}),
gear: computed(() => {
return data.value.gear;
}),
Expand All @@ -79,6 +84,9 @@ export function usePlayerStats() {
seat: computed(() => {
return data.value.seat;
}),
vehicleClass: computed(() => {
return data.value.vehicleClass;
}),
vehicleHealth: computed(() => {
return data.value.vehicleHealth;
}),
Expand Down

0 comments on commit de972ff

Please sign in to comment.