Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added feature to automatically make route to call postal #115

Merged
merged 9 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions integrations/sync/client/flows/911-call-attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,29 @@ onNet(
SetNuiFocus(true, true);
},
);

const POSTAL_COMMAND = GetConvar("snailycad_postal_command", "null");
onNet(ClientEvents.AutoPostalOnAttach, (postal: string) => {
const postalCodeAsInt = parseInt(postal);

if (POSTAL_COMMAND === "null") {
console.info(`
---------------------------------------

[${GetCurrentResourceName()}] Not automatically setting postal code for call. There was no postal command set.:
\`setr snailycad_postal_command "<your-command-here>" \`

---------------------------------------`);
return;
}

if (postalCodeAsInt > 0) {
ExecuteCommand(`${POSTAL_COMMAND} ${postalCodeAsInt}`);
} else {
emit("chat:addMessage", {
color: [255, 0, 0],
multiline: true,
args: ["SnailyCAD", "An error occured while making route to call postal"],
});
}
});
1 change: 1 addition & 0 deletions integrations/sync/server/flows/911-call-attach.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ onNet(
),
],
});
emitNet(ClientEvents.AutoPostalOnAttach, source, updatedCall.postal);
} else {
emitNet("chat:addMessage", source, {
args: [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@
"printWidth": 100,
"tabWidth": 2
}
}
}
2 changes: 2 additions & 0 deletions src/types/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ export enum ClientEvents {
RequestTrafficStopFlow = "sna-sync:request-traffic-stop-flow",

CreateNotification = "sna-sync:create-notification",

AutoPostalOnAttach = "sna-sync:attach-postal",
}

export enum NuiEvents {
Expand Down
Loading