-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
107 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
|
||
namespace Sessions; | ||
|
||
public partial class Sessions | ||
{ | ||
private HookResult OnPlayerChat(EventPlayerChat @event, GameEventInfo info) | ||
{ | ||
var player = Utilities.GetPlayerFromUserid(@event.Userid); | ||
|
||
if (!IsValidPlayer(player) || !Players.TryGetValue(player!.Slot, out var value) || value.Session == null) | ||
return HookResult.Continue; | ||
|
||
var messageType = @event.Teamonly ? MessageType.TeamChat : MessageType.Chat; | ||
Database.InsertMessage(value.Session.Id, value.Id, messageType, @event.Text); | ||
|
||
return HookResult.Continue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API; | ||
|
||
namespace Sessions; | ||
|
||
public partial class Sessions | ||
{ | ||
private void OnMapStart(string mapName) | ||
{ | ||
Server!.Map = Database.GetMapAsync(mapName).GetAwaiter().GetResult(); | ||
} | ||
|
||
private void OnClientAuthorized(int playerSlot, CounterStrikeSharp.API.Modules.Entities.SteamID steamId) | ||
{ | ||
var player = Utilities.GetPlayerFromSlot(playerSlot); | ||
|
||
if (!IsValidPlayer(player)) | ||
return; | ||
|
||
OnPlayerConnect(playerSlot, steamId.SteamId64, NativeAPI.GetPlayerIpAddress(playerSlot).Split(":")[0]).GetAwaiter().GetResult(); | ||
CheckAlias(playerSlot, player!.PlayerName).GetAwaiter().GetResult(); | ||
} | ||
|
||
private void OnClientDisconnect(int playerSlot) | ||
{ | ||
if (!Players.TryGetValue(playerSlot, out var value)) | ||
return; | ||
|
||
Database.UpdateSeen(value.Id); | ||
Players.Remove(playerSlot); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters