Skip to content

Commit

Permalink
Numerous bugfixes and improvements to freeroam-extended gamemode
Browse files Browse the repository at this point in the history
  • Loading branch information
zziger committed Sep 24, 2023
1 parent 3612b5f commit 83de57f
Show file tree
Hide file tree
Showing 25 changed files with 1,451 additions and 1,011 deletions.
2 changes: 1 addition & 1 deletion freeroam-extended/client/html/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function setVoiceConnectionState(state) {
}

alt.on("addString", (text) => addString(colorify(text)));
alt.on("addMessage", (name, text) => addString("<b>" + name + ": </b>" + colorify(text)));
alt.on("addMessage", (name, text) => addString("<b>" + colorify(name) + ": </b>" + colorify(text)));
alt.on("openChat", openChat);
alt.on("closeChat", closeChat);
alt.on("updatePlayersOnline", updatePlayersOnline);
Expand Down
6 changes: 4 additions & 2 deletions freeroam-extended/client/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

<body>
<div class="stress-test-label">
Public Stress Test - v15
<div class="watermark">
Public Stress Test - v15
</div>
</div>
<div class="info">
<div class="players-online">
Expand Down Expand Up @@ -38,7 +40,7 @@

<li><span class="help-keys-command">/tp</span> &lt;1 to 22&gt; (Teleport)</li>
<li><span class="help-keys-command">/model</span> (Change your model between male and female)</li>
<li><span class="help-keys-command">/outfit [outfit_name]</span> (Change outfit to random or entered value)</li>
<li><span class="help-keys-command">/outfit</span> &lt;outfitName&gt; (Change outfit to random or entered value)</li>
<li><span class="help-keys-command">/veh</span> &lt;modelName&gt; (Spawn a vehicle)</li>
<li><span class="help-keys-command">/clearvehicles</span> (Clear your vehicles)</li>
<li><span class="help-keys-command">/tune</span> &lt;index> &lt;value&gt; (Tune vehicle)</li>
Expand Down
27 changes: 19 additions & 8 deletions freeroam-extended/client/html/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,7 @@ body {
}

.stress-test-label {
top: .2em;
left: 50%;
transform: translateX(-50%);
text-align: center;
width: 100%;
font-size: .8em;
position: absolute;
color: rgba(255, 255, 255, 0.628);
font-size: 16px;
}

.weapons-enabled > * {
Expand Down Expand Up @@ -307,3 +300,21 @@ body {
.streamed-in > * {

}

.watermark {
pointer-events: none;
position: fixed;
color: rgba(255, 255, 255, 0.75);
font-weight: 500;
padding: 1em;
font-size: 0.9em;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
z-index: 201;
opacity: 1;

font-family: 'Inter';
top: 0;
left: 50%;
transform: translateX(-50%);
text-align: center;
}
6 changes: 3 additions & 3 deletions freeroam-extended/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"main": "index.js",
"license": "MIT",
"devDependencies": {
"@altv/types-client": "^2.9.2",
"@altv/types-client": "^2.9.7",
"@altv/types-natives": "^1.5.4",
"@altv/types-server": "^2.9.5",
"@altv/types-shared": "^1.6.0",
"@altv/types-server": "^3.0.1",
"@altv/types-shared": "^1.6.5",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"altv-esbuild": "^0.4.3",
Expand Down
5 changes: 2 additions & 3 deletions freeroam-extended/client/src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ view.on("chatloaded", () => {
})

view.on("chatmessage", (text: string) => {
if (playerData.chatState)
alt.emitServer("chat:message", text)
alt.emitServer("chat:message", text)

alt.toggleGameControls(true)
view.unfocus()
Expand All @@ -65,4 +64,4 @@ view.on("chatmessage", (text: string) => {
}, 200)
})

pushLine("<b>alt:V Multiplayer has started</b>")
pushLine("alt:V Multiplayer has started")
18 changes: 9 additions & 9 deletions freeroam-extended/client/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ alt.on("connectionComplete", () => {
}, 1000)
})

alt.on("localMetaChange", (key: string, newValue: any) => {
if (key == "godmode")
native.setEntityInvincible(alt.Player.local, newValue);
})

alt.onServer("airport_state", setWeaponsUsage)

alt.onServer("chat:message", chat.pushMessage)

alt.onServer("noclip", toggleNoclip)

alt.onServer("set_chat_state", (state: boolean) => {
playerData.chatState = state
})

alt.onServer("draw_dmzone", (
centerX: number,
centerY: number,
radius: number,
count: number,
radius: number
) => {
drawDMZone(centerX, centerY, radius, count)
drawDMZone(centerX, centerY, radius)
})

alt.onServer("announce", (header: string, body: string, time: number) => {
Expand Down Expand Up @@ -84,9 +84,9 @@ alt.on("keyup", (key) => {
})

alt.onServer("get_pos", () => {
const state = alt.getPermissionState(Permission.ClipboardAccess)
const state = alt.getPermissionState(Permission.CLIPBOARD_ACCESS)

if (state !== PermissionState.Allowed) {
if (state !== PermissionState.ALLOWED) {
alt.log("get_pos clipboard access is not allowed, state:", state)
return
}
Expand Down
17 changes: 6 additions & 11 deletions freeroam-extended/client/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,18 +132,13 @@ export function drawDMZone(
centerX: number,
centerY: number,
radius: number,
count: number,
): void {
const steps = 2 * Math.PI / count
for (let i = 0; i < count; i++) {
const blipX = radius * Math.cos(steps * i) + centerX
const blipY = radius * Math.sin(steps * i) + centerY

const blip = new alt.PointBlip(blipX, blipY, 0)
blip.sprite = 310
blip.shortRange = true
native.setBlipHiddenOnLegend(blip.scriptID, true)
}
const blip = new alt.RadiusBlip(centerX, centerY, 0, radius);
blip.sprite = 10;
blip.shortRange = true;
blip.color = 5;
blip.isHiddenOnLegend = false;
blip.name = "DM zone";
}

let adminMessageEveryTick: number | null = null
Expand Down
24 changes: 12 additions & 12 deletions freeroam-extended/client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
# yarn lockfile v1


"@altv/types-client@^2.9.2":
version "2.9.2"
resolved "https://registry.npmjs.org/@altv/types-client/-/types-client-2.9.2.tgz"
integrity sha512-LMGD1EBebN6BjFohhvPijR1Rq8BnU24IGdPb2It7NGFhHXxX/688XnlfX+tquIKlUkQPR8D54imNzZKBUG+BWA==
"@altv/types-client@^2.9.7":
version "2.9.7"
resolved "https://registry.yarnpkg.com/@altv/types-client/-/types-client-2.9.7.tgz#9082db1af8dbd7f04bc5f33e8ad67adcf6d9afba"
integrity sha512-VCuo56pzGLJedu6oiesAoKtFc7O5ZhAHH7W/WOX1dGU+PXWIM0B6OYbYuIOr6AOLwTCVTv+QpUrKgkN+38WCyA==

"@altv/types-natives@^1.5.4":
version "1.5.4"
resolved "https://registry.npmjs.org/@altv/types-natives/-/types-natives-1.5.4.tgz"
integrity sha512-N4jtJ4f8KFOCi0sxlVvTWF7I7Nz/ylq136sIJMpsHIcBWIlysWF6zdJFdBW5bkquDGWgY8aBYPQ4TU+ayQhukw==

"@altv/types-server@^2.9.5":
version "2.9.5"
resolved "https://registry.npmjs.org/@altv/types-server/-/types-server-2.9.5.tgz"
integrity sha512-Io4UkkJcbo9e6XqQd/dtQyQfOucko+vYmivQPJC/WemCCrQuMBWd4teqW3AUxcpT81psOnnJkHEVxfth386zmw==
"@altv/types-server@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@altv/types-server/-/types-server-3.0.1.tgz#83b41032cab2522cc62ffc6441c5fef08440229e"
integrity sha512-dVEGQUCj/IiFAw2oC1jQ3Iiacqtk5ciA2BNXJIETFcY2tz0uVaNMFAszR4B4xNBctWnXY12RDCJRrrvcxrPTMg==

"@altv/types-shared@^1.6.0":
version "1.6.0"
resolved "https://registry.npmjs.org/@altv/types-shared/-/types-shared-1.6.0.tgz"
integrity sha512-OURm829uVVxKFMPtWx/ZUR9K7cw7ZISCt5qdFzRO0MUdd+HAX3hymJqyy3euksTkxlBpGQXox432I0Sk02aurg==
"@altv/types-shared@^1.6.5":
version "1.6.5"
resolved "https://registry.yarnpkg.com/@altv/types-shared/-/types-shared-1.6.5.tgz#f3cd941a2706065e284cd0b053936fc0d0856024"
integrity sha512-gOil0Is/T26XCAJ+96H3qEjq7zLc9sG7vGp14UVZD09Vn0ClxUx3EG1xapJcobUuJHUd1uI24j1ODSzZ/pSMtA==

"@esbuild/[email protected]":
version "0.14.53"
Expand Down
Loading

0 comments on commit 83de57f

Please sign in to comment.