@@ -21,6 +21,9 @@
+
+ Voice connection
Connected
+
diff --git a/freeroam-extended/client/html/style.css b/freeroam-extended/client/html/style.css
index da27e51..009d879 100644
--- a/freeroam-extended/client/html/style.css
+++ b/freeroam-extended/client/html/style.css
@@ -34,7 +34,7 @@ body {
.help-keys {
position: absolute;
- top: 10em;
+ top: 12em;
right: 1.5em;
text-align: right;
}
@@ -282,6 +282,28 @@ body {
box-shadow: 0 0 0.5em var(--bg-color) !important;
}
+.voice-server-connection-status > * {
+ color: rgb(255, 255, 255) !important;
+}
+
+.voice-connection-status-connected {
+ --bg-color: rgb(98, 218, 114);
+ background: var(--bg-color) !important;
+ box-shadow: 0 0 0.5em var(--bg-color) !important;
+}
+
+.voice-connection-status-disconnected {
+ --bg-color: rgb(235, 91, 86);
+ background: var(--bg-color) !important;
+ box-shadow: 0 0 0.5em var(--bg-color) !important;
+}
+
+.voice-connection-status-connecting {
+ --bg-color: rgb(255, 247, 0);
+ background: var(--bg-color) !important;
+ box-shadow: 0 0 0.5em var(--bg-color) !important;
+}
+
.streamed-in > * {
}
diff --git a/freeroam-extended/client/src/events.ts b/freeroam-extended/client/src/events.ts
index d047da7..55803f0 100644
--- a/freeroam-extended/client/src/events.ts
+++ b/freeroam-extended/client/src/events.ts
@@ -6,6 +6,7 @@ import { toggleNoclip } from "./noclip"
import { playerData } from "./playerdata"
import { view } from "./view"
import { KeyCode, Permission, PermissionState } from "altv-enums"
+import type { VoiceConnectionState } from "alt-client"
alt.on("connectionComplete", () => {
setTimeout(() => {
@@ -116,3 +117,7 @@ alt.onServer("esp", (state: boolean) => {
// }
// })
})
+
+alt.on("voiceConnection", (state: alt.VoiceConnectionState) => {
+ view.emit("setVoiceConnectionState", state)
+})
\ No newline at end of file
diff --git a/freeroam-extended/client/src/helpers.ts b/freeroam-extended/client/src/helpers.ts
index 1f2e559..88874cc 100644
--- a/freeroam-extended/client/src/helpers.ts
+++ b/freeroam-extended/client/src/helpers.ts
@@ -277,7 +277,7 @@ export function raycast(
const [, hit, pos,, entity] = native.getShapeTestResult(ray)
return hit
- ? { pos: pos, entity }
+ ? { pos, entity }
: null
}
diff --git a/freeroam-extended/client/src/view.ts b/freeroam-extended/client/src/view.ts
index ffa4618..f5cec3d 100644
--- a/freeroam-extended/client/src/view.ts
+++ b/freeroam-extended/client/src/view.ts
@@ -9,7 +9,8 @@ type EventNames =
"setPlayerId" |
"setWeaponsDisabled" |
"focusChatInput" |
- "setStreamedEntities"
+ "setStreamedEntities" |
+ "setVoiceConnectionState"
class View extends alt.WebView {
public override emit(eventName: EventNames, ...args: unknown[]) {
diff --git a/freeroam-extended/server/freeroam-extended/EventHandler.cs b/freeroam-extended/server/freeroam-extended/EventHandler.cs
index 160790b..2fe415e 100644
--- a/freeroam-extended/server/freeroam-extended/EventHandler.cs
+++ b/freeroam-extended/server/freeroam-extended/EventHandler.cs
@@ -135,7 +135,6 @@ public void OnPlayerDisconnect(IAltPlayer player, string reason)
[AsyncScriptEvent(ScriptEventType.PlayerDead)]
public async Task OnPlayerDead(IAltPlayer player, IEntity killer, uint weapon)
{
- if (killer is not IAltPlayer killerPlayer) return;
var spawnPointPool = player.DmMode ? Misc.AirportSpawnPositions : Misc.SpawnPositions;
var randomSpawnPoint = spawnPointPool.ElementAt(_random.Next(0, spawnPointPool.Length));
@@ -146,6 +145,7 @@ public async Task OnPlayerDead(IAltPlayer player, IEntity killer, uint weapon)
StatsHandler.StatsData.PlayerDeaths++;
}
+ if (killer is not IAltPlayer killerPlayer) return;
if (!Misc.BlacklistedWeapons.Contains(weapon)) return;
Alt.Core.LogColored(
$"~r~ Banned Player: {killerPlayer.Name} ({killerPlayer.Id}) for using illegal weapon!");
diff --git a/freeroam-extended/server/freeroam-extended/Factories/PlayerFactory.cs b/freeroam-extended/server/freeroam-extended/Factories/PlayerFactory.cs
index 520c59c..003cfc3 100644
--- a/freeroam-extended/server/freeroam-extended/Factories/PlayerFactory.cs
+++ b/freeroam-extended/server/freeroam-extended/Factories/PlayerFactory.cs
@@ -71,9 +71,13 @@ public void RefreshFace()
this.SetHeadOverlayColor(5, 2, 11, 0);
this.SetHeadOverlayColor(8, 2, 6, 0);
- this.SetClothes(2, 3, 0, 0);
- this.HairColor = 61;
- this.HairHighlightColor = 61;
+ int hairs = Misc.RandomInt(1, 23);
+ int hairsColor = Misc.RandomInt(1, 63);
+ int hairsColor2 = Misc.RandomInt(1, 63);
+
+ this.SetClothes(2, (ushort)hairs, 0, 0);
+ this.HairColor = (byte)hairsColor;
+ this.HairHighlightColor = (byte)hairsColor2;
this.SetEyeColor(2);
float[] featureParams = { -0.78f, 0, 0, -0.07f, 0.03f, 0, 0.07f, -0.44f, 0.07f, 0.02f, -0.95f, -0.74f, -1, -0.09f, -0.57f, 0.02f, -0.1f, -0.19f, -1, -1 };
@@ -102,9 +106,13 @@ public void RefreshFace()
this.SetHeadOverlayColor(5, 2, 32, 0);
this.SetHeadOverlayColor(8, 2, 11, 0);
- this.SetClothes(2, 21, 0, 0);
- this.HairColor = 35;
- this.HairHighlightColor = 35;
+ int hairs = Misc.RandomInt(1, 22);
+ int hairsColor = Misc.RandomInt(1, 63);
+ int hairsColor2 = Misc.RandomInt(1, 63);
+
+ this.SetClothes(2, (ushort)hairs, 0, 0);
+ this.HairColor = (byte)hairsColor;
+ this.HairHighlightColor = (byte)hairsColor2;
this.SetEyeColor(3);
float[] featureParams = { 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1 };
@@ -128,9 +136,8 @@ public async Task RefreshClothes()
ulong[] outfits = await ClothesFitService.GetOutfitsBySex(Sex);
- Random rand = new Random();
- int randomIndex = rand.Next(outfits.Length);
- ulong randomElement = outfits[randomIndex];
+ int index = Misc.RandomInt(0, outfits.Length - 1);
+ ulong randomElement = outfits[index];
await ClothesFitService.Equip(this, (uint)randomElement);
}
diff --git a/freeroam-extended/server/freeroam-extended/Misc.cs b/freeroam-extended/server/freeroam-extended/Misc.cs
index 98395b3..89abe19 100644
--- a/freeroam-extended/server/freeroam-extended/Misc.cs
+++ b/freeroam-extended/server/freeroam-extended/Misc.cs
@@ -5,6 +5,7 @@ namespace Freeroam_Extended
{
public static class Misc
{
+ public static Random random = new Random();
public static HashSet
BlacklistedWeapons = new()
{
125959754, // Compact Grenade Launcher
@@ -325,5 +326,11 @@ public static bool IsResourceLoaded(string resourceName)
var allResources = Alt.GetAllResources();
return allResources.Count(x => x.Name == resourceName) > 0;
}
+
+ public static int RandomInt(int min, int max)
+ {
+ int randomNumber = random.Next(min, max + 1);
+ return randomNumber;
+ }
}
}
\ No newline at end of file