mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-09-27 20:17:04 +02:00
fix: DefaultServerIP functionality
fix: compile error for example plugin
This commit is contained in:
parent
c4ef3eb550
commit
1baccc9404
2 changed files with 4 additions and 10 deletions
|
|
@ -46,15 +46,7 @@ public class ServerManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string address = CS2_SimpleAdmin.Instance.Config.DefaultServerIP;
|
string address = $"{(!string.IsNullOrWhiteSpace(CS2_SimpleAdmin.Instance.Config.DefaultServerIP) ? CS2_SimpleAdmin.Instance.Config.DefaultServerIP : ConVar.Find("ip")!.StringValue)}:{ConVar.Find("hostport")!.GetPrimitiveValue<int>()}";
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(CS2_SimpleAdmin.Instance.Config.DefaultServerIP) || !CS2_SimpleAdmin.Instance.Config.DefaultServerIP.Contains(":"))
|
|
||||||
{
|
|
||||||
if(!string.IsNullOrWhiteSpace(CS2_SimpleAdmin.Instance.Config.DefaultServerIP) && !CS2_SimpleAdmin.Instance.Config.DefaultServerIP.Contains(":"))
|
|
||||||
CS2_SimpleAdmin._logger?.LogError("DefaultServerIP was set but no port was provided!");
|
|
||||||
|
|
||||||
address = $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";
|
|
||||||
}
|
|
||||||
|
|
||||||
var hostname = ConVar.Find("hostname")!.StringValue;
|
var hostname = ConVar.Find("hostname")!.StringValue;
|
||||||
var rcon = ConVar.Find("rcon_password")!.StringValue;
|
var rcon = ConVar.Find("rcon_password")!.StringValue;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,9 @@ public class CS2_SimpleAdmin_ExampleModule: BasePlugin
|
||||||
[CommandHelper(whoCanExecute: CommandUsage.SERVER_ONLY)]
|
[CommandHelper(whoCanExecute: CommandUsage.SERVER_ONLY)]
|
||||||
public void OnAddBanCommand(CCSPlayerController? caller, CommandInfo commandInfo)
|
public void OnAddBanCommand(CCSPlayerController? caller, CommandInfo commandInfo)
|
||||||
{
|
{
|
||||||
_sharedApi?.IssuePenalty(new SteamID(76561197960287930), null, PenaltyType.Ban, "My super reason", 10);
|
var player = Utilities.GetPlayerFromSteamId(76561197960287930);
|
||||||
|
if(player != null)
|
||||||
|
_sharedApi?.IssuePenalty(player, null, PenaltyType.Ban, "My super reason", 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPlayerPenaltied(PlayerInfo player, PlayerInfo? admin, PenaltyType penaltyType,
|
private void OnPlayerPenaltied(PlayerInfo player, PlayerInfo? admin, PenaltyType penaltyType,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue