Fix for MP

This commit is contained in:
Brant Martin
2018-05-16 07:09:05 -04:00
parent d8915d1893
commit 38d2f1b62e
22 changed files with 57 additions and 280 deletions

View File

@@ -10,7 +10,7 @@ using System.Threading.Tasks;
using System.Timers;
using Sandbox.Game.Multiplayer;
using Sandbox.ModAPI;
using SteamSDK;
using Steamworks;
using Torch;
using Torch.API;
using Torch.API.Managers;
@@ -30,11 +30,11 @@ namespace Torch.Commands
[Permission(MyPromoteLevel.None)]
public void GetIP(ulong steamId = 0)
{
var state = new P2PSessionState();
if (steamId == 0)
steamId = Context.Player.SteamUserId;
Peer2Peer.GetSessionState(steamId, ref state);
var ip = new IPAddress(BitConverter.GetBytes(state.RemoteIP).Reverse().ToArray());
SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state);
var ip = new IPAddress(BitConverter.GetBytes(state.m_nRemoteIP).Reverse().ToArray());
Context.Respond($"Your IP is {ip}");
}