Skip to content

Commit

Permalink
[GM] Added Server.GetServerTickRate, fixes #295
Browse files Browse the repository at this point in the history
  • Loading branch information
ikkentim committed Jan 20, 2020
1 parent 842b771 commit 3432000
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES-SampSharp.GameMode.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added `BasePlayer.PickUpPickup` event (#319)
- Added `BasePlayer.CameraTargetPlayerObject` (#320)
- Added `BasePlayer.SurfingPlayerObject` (#324)
- Added `Server.GetServerTickRate` (#295)
- Updated `VehicleModelInfo` to include seat count and a missing entry for ID 611, Utility Trailer (#302)
- Updated minimum .NET Standard version to 2.0
- *breaking* Changed `BasePlayer.CameraTargetObject` to `BasePlayer.CameraTargetGlobalObject` (#320)
Expand Down
8 changes: 7 additions & 1 deletion src/SampSharp.GameMode/SAMP/Server.Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ public virtual int GetMaxPlayers()
{
throw new NativeNotImplementedException();
}

[NativeMethod]
public virtual int GetTickCount()
{
throw new NativeNotImplementedException();
}

[NativeMethod]
public virtual int GetServerTickRate()
{
throw new NativeNotImplementedException();
}

[NativeMethod]
public virtual bool ConnectNPC(string name, string script)
{
Expand Down
13 changes: 11 additions & 2 deletions src/SampSharp.GameMode/SAMP/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static T GetConsoleVariable<T>(string varName)

throw new NotSupportedException("Type " + typeof (T) + " is not supported by SA:MP");
}

/// <summary>
/// Returns the uptime of the actual server in milliseconds.
/// </summary>
Expand All @@ -125,7 +125,16 @@ public static int GetTickCount()
{
return ServerInternal.Instance.GetTickCount();
}


/// <summary>
/// Gets the tick rate of the server.
/// </summary>
/// <remarks>The tick rate is 0 if the server just started.</remarks>
public static int GetServerTickRate ()
{
return ServerInternal.Instance.GetTickCount();
}

/// <summary>
/// Prints the specified message to the console.
/// </summary>
Expand Down

0 comments on commit 3432000

Please sign in to comment.