Skip to content

Commit

Permalink
feat(client): Add getServerTime
Browse files Browse the repository at this point in the history
  • Loading branch information
xLuxy committed Jan 12, 2024
1 parent 9199d8f commit 5c0da73
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions client/src/modules/AltModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ static void SetMsPerGameMinute(js::FunctionContext& ctx)
alt::ICore::Instance().SetMsPerGameMinute(msPerGameMinute);
}

static void GetServerTime(js::FunctionContext& ctx)
{
ctx.Return(alt::ICore::Instance().GetServerTime());
}

static void LicenseHashGetter(js::LazyPropertyContext& ctx)
{
ctx.Return(alt::ICore::Instance().GetLicenseHash());
Expand Down Expand Up @@ -529,6 +534,7 @@ static js::Module altModule("@altv/client", "@altv/shared",
module.StaticFunction("setGameControlsActive", SetGameControlsActive);
module.StaticFunction("getMsPerGameMinute", GetMsPerGameMinute);
module.StaticFunction("setMsPerGameMinute", SetMsPerGameMinute);
module.StaticFunction("getServerTime", GetServerTime);
module.StaticFunction("areRmlControlsActive", AreRmlControlsActive);
module.StaticFunction("setRmlControlsActive", SetRmlControlsActive);
module.StaticFunction("getKeyState", GetKeyState);
Expand Down
1 change: 1 addition & 0 deletions types/client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ declare module "@altv/client" {
export function setGameControlsActive(state: boolean): boolean;
export function getMsPerGameMinute(): number;
export function setMsPerGameMinute(ms: number): void;
export function getServerTime(): number;
export function areRmlControlsActive(): boolean;
export function setRmlControlsActive(state: boolean): void;
export function getKeyState(key: altShared.Enums.KeyCode): altShared.KeyStateInfo;
Expand Down
2 changes: 1 addition & 1 deletion types/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@altv/client",
"version": "0.0.20",
"version": "0.0.21",
"description": "This package contains the type definitions for the alt:V JS module v2 client types",
"types": "index.d.ts",
"files": [
Expand Down

0 comments on commit 5c0da73

Please sign in to comment.