Compare commits

...

3 Commits

Author SHA1 Message Date
Nexd
b54f5c3dee fix: gamedata update (#631)
Co-authored-by: KillStr3aK <KillStr3aK@users.noreply.github.com>
2024-10-21 09:35:38 +10:00
schwarper
761380dff6 CCSPlayer_ItemServices_CanAcquire and GetCSWeaponDataFromKey signatures update (#636) 2024-10-19 10:07:07 +10:00
Interesting
71ae253e5e Add GetGameframeTime to NativeAPI (#627)
Co-authored-by: Michael Wilson <roflmuffin@users.noreply.github.com>
2024-10-17 03:32:10 +00:00
5 changed files with 33 additions and 17 deletions

View File

@@ -84,22 +84,22 @@
"CCSPlayer_WeaponServices_CanUse": {
"signatures": {
"library": "server",
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC 30 48 8B 01",
"windows": "48 89 5C 24 ? 48 89 6C 24 ? 56 57 41 56 48 83 EC ? 48 8B 01 48 8B FA",
"linux": "55 48 8D 15 ? ? ? ? 48 89 E5 41 55 49 89 FD 41 54 49 89 F4"
}
},
"CCSPlayer_ItemServices_CanAcquire": {
"signatures": {
"library": "server",
"windows": "48 8B C4 44 89 40 18 48 89 48 08 55 56",
"linux": " 55 48 89 E5 41 57 41 56 48 8D 45 CC"
"windows": "48 8B C4 44 89 40 ? 48 89 50 ? 48 89 48",
"linux": "55 48 89 E5 41 57 41 56 41 55 49 89 CD 41 54 53 48 83 EC"
}
},
"GetCSWeaponDataFromKey": {
"signatures": {
"library": "server",
"windows": "48 89 5C 24 CC 48 89 74 24 CC 57 48 83 EC 20 48 8B FA 8B",
"linux": " 55 48 89 E5 41 57 41 56 41 89 FE 41 55 41 54 45"
"windows": "48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC ? 48 8B FA 8B F1 48 85 D2 0F 84",
"linux": "55 48 89 E5 41 57 41 56 41 89 FE 41 55 41 54 45"
}
},
"CCSPlayer_ItemServices_GiveNamedItem": {
@@ -170,8 +170,8 @@
},
"CBasePlayerPawn_CommitSuicide": {
"offsets": {
"windows": 377,
"linux": 377
"windows": 380,
"linux": 380
}
},
"CBasePlayerPawn_RemovePlayerItem": {

View File

@@ -337,6 +337,16 @@ namespace CounterStrikeSharp.API.Core
}
}
public static float GetGameFrameTime(){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();
ScriptContext.GlobalScriptContext.SetIdentifier(0x97E331CA);
ScriptContext.GlobalScriptContext.Invoke();
ScriptContext.GlobalScriptContext.CheckErrors();
return (float)ScriptContext.GlobalScriptContext.GetResult(typeof(float));
}
}
public static void IssueServerCommand(string command){
lock (ScriptContext.GlobalScriptContext.Lock) {
ScriptContext.GlobalScriptContext.Reset();

View File

@@ -46,28 +46,33 @@ namespace CounterStrikeSharp.API
/// </summary>
/// <remarks>Does not increment when server is hibernating</remarks>
public static double TickedTime => NativeAPI.GetTickedTime();
/// <summary>
/// Returns the current map time in seconds, as an interval of the server's tick interval.
/// e.g. 70.046875 would represent 70 seconds of map time and the 4483rd tick of the server (70.046875 / 0.015625).
/// </summary>
/// <remarks>Increments even when server is hibernating</remarks>
public static float CurrentTime => NativeAPI.GetCurrentTime();
/// <summary>
/// Returns the current map tick count.
/// CS2 is a 64 tick server, so the value will increment by 64 every second.
/// </summary>
public static int TickCount => NativeAPI.GetTickCount();
/// <summary>
/// Returns the total time the server has been running in seconds.
/// </summary>
/// <remarks>Increments even when server is hibernating</remarks>
public static double EngineTime => NativeAPI.GetEngineTime();
/// <summary>
/// Returns the time spent on last server or client frame
/// </summary>
public static float FrameTime => NativeAPI.GetGameFrameTime();
public static void PrecacheModel(string name) => NativeAPI.PrecacheModel(name);
/// <summary>
/// <inheritdoc cref="RunOnTick"/>
/// Returns Task that completes once the synchronous task has been completed.
@@ -78,7 +83,7 @@ namespace CounterStrikeSharp.API
NativeAPI.QueueTaskForFrame(tick, functionReference);
return functionReference.CompletionTask;
}
/// <summary>
/// Queue a task to be executed on the specified tick.
/// See <see cref="TickCount"/> to retrieve the current tick.
@@ -108,7 +113,7 @@ namespace CounterStrikeSharp.API
{
NextFrameAsync(task);
}
/// <summary>
/// <inheritdoc cref="NextWorldUpdate"/>
/// Returns Task that completes once the synchronous task has been completed.
@@ -119,7 +124,7 @@ namespace CounterStrikeSharp.API
NativeAPI.QueueTaskForNextWorldUpdate(functionReference);
return functionReference.CompletionTask;
}
/// <summary>
/// Queue a task to be executed on the next pre world update.
/// <remarks>Executes if the server is hibernating.</remarks>
@@ -157,4 +162,4 @@ namespace CounterStrikeSharp.API
public static void PrintToConsole(string s) => NativeAPI.PrintToServerConsole($"{s}\n\0");
}
}
}

View File

@@ -245,7 +245,7 @@ REGISTER_NATIVES(engine, {
ScriptEngine::RegisterNativeHandler("GET_TICK_INTERVAL", GetTickInterval);
ScriptEngine::RegisterNativeHandler("GET_TICK_COUNT", GetTickCount);
ScriptEngine::RegisterNativeHandler("GET_CURRENT_TIME", GetCurrentTime);
ScriptEngine::RegisterNativeHandler("GET_GAMEFRAME_TIME", GetGameFrameTime);
ScriptEngine::RegisterNativeHandler("GET_GAME_FRAME_TIME", GetGameFrameTime);
ScriptEngine::RegisterNativeHandler("GET_ENGINE_TIME", GetEngineTime);
ScriptEngine::RegisterNativeHandler("GET_MAX_CLIENTS", GetMaxClients);
ScriptEngine::RegisterNativeHandler("ISSUE_SERVER_COMMAND", ServerCommand);

View File

@@ -6,6 +6,7 @@ GET_CURRENT_TIME: -> float
GET_TICK_COUNT: -> int
GET_ENGINE_TIME: -> double
GET_MAX_CLIENTS: -> int
GET_GAME_FRAME_TIME: -> float
ISSUE_SERVER_COMMAND: command:string -> void
PRECACHE_MODEL: name:string -> void
PRECACHE_SOUND: name:string, preload:bool -> bool