Give comfirmation message to Banner

Add Unban by database ID ( supplements GUID )
Fixed Wisdom response
Added database ID to whoami response
Added first time setup for users with no config file
default configs updated
This commit is contained in:
RaidMax 2015-03-08 23:28:57 -05:00
parent 3d366e6522
commit 828afc563a
8 changed files with 97 additions and 24 deletions

View File

@ -169,7 +169,10 @@ namespace IW4MAdmin
E.Target.lastEvent = E; // needs to be fixed
String Message = "^1Player Banned: ^5" + E.Target.LastOffense + "^7 (appeal at nbsclan.org)";
if (E.Origin.getLevel() > E.Target.getLevel())
{
E.Target.Ban(Message, E.Origin);
E.Origin.Tell("Successfully banned ^5" + E.Target.getName() + " (^7" + E.Target.getID());
}
else
E.Origin.Tell("You cannot ban " + E.Target.getName());
}
@ -182,7 +185,7 @@ namespace IW4MAdmin
public override void Execute(Event E)
{
if (E.Owner.Unban(E.Data.Trim()))
if (E.Owner.Unban(E.Data.Trim(), E.Target))
E.Origin.Tell("Successfully unbanned " + E.Data.Trim());
else
E.Origin.Tell("Unable to find a ban for that GUID");
@ -196,7 +199,7 @@ namespace IW4MAdmin
public override void Execute(Event E)
{
String You = String.Format("You are {0} at client spot {1} with xuid {2}. You have connected {3} times and are currently ranked {4}", E.Origin.getName(), E.Origin.getClientNum(), E.Origin.getID(), E.Origin.getConnections(), E.Origin.getLevel());
String You = String.Format("You are {0} at client spot {1} with xuid {2} and ID {5}. You have connected {3} times and are currently ranked {4}", E.Origin.getName(), E.Origin.getClientNum(), E.Origin.getID(), E.Origin.getConnections(), E.Origin.getLevel(), E.Origin.getDBID());
E.Origin.Tell(You);
}

View File

@ -12,22 +12,23 @@
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>C:\Users\Michael\Desktop\IW4MAdmin\</PublishUrl>
<IsWebBootstrapper>true</IsWebBootstrapper>
<PublishUrl>ftp://raidmax.org/IW4M/Admin/</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<InstallFrom>Web</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<InstallUrl>http://raidmax.org/IW4M/Admin/</InstallUrl>
<ProductName>IW4M Administration</ProductName>
<PublisherName>RaidMax LLC</PublisherName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>publish.htm</WebPage>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>0.1.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
@ -109,6 +110,10 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="config\maps.cfg" />
<None Include="config\messages.cfg" />
<None Include="config\rules.cfg" />
<None Include="config\servers.cfg" />
<None Include="IW4M ADMIN_TemporaryKey.pfx" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
@ -131,9 +136,7 @@
<ItemGroup>
<Content Include="4D1.ico" />
</ItemGroup>
<ItemGroup>
<Folder Include="Fakes\" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -6,19 +6,31 @@ namespace IW4MAdmin
{
class Program
{
static String IP;
static int Port;
static String RCON;
static void Main(string[] args)
{
Console.WriteLine("=====================================================");
Console.WriteLine(" IW4M ADMIN v");
Console.WriteLine(" by RaidMax ");
Console.WriteLine("=====================================================");
file Config = new file("config\\servers.cfg");
String[] SV_CONF = Config.getParameters(3);
double Version = 0.1;
if (SV_CONF == null || SV_CONF.Length != 3)
{
setupConfig();
SV_CONF = new file("config\\servers.cfg").getParameters(3);
}
if (Config.getSize() > 0 && SV_CONF != null)
{
Console.WriteLine("=====================================================");
Console.WriteLine(" IW4M ADMIN v" + Version);
Console.WriteLine(" by RaidMax ");
Console.WriteLine("=====================================================");
Console.WriteLine("Starting admin on port " + SV_CONF[1]);
Server IW4M;
@ -32,5 +44,19 @@ namespace IW4MAdmin
}
}
static void setupConfig()
{
Console.WriteLine("Hey there, it looks like you haven't set up a server yet. Let's get started!");
Console.Write("Please enter the IP: ");
IP = Console.ReadLine();
Console.Write("Please enter the Port: ");
Port = Convert.ToInt32(Console.ReadLine());
Console.Write("Please enter the RCON password: ");
RCON = Console.ReadLine();
file Config = new file("config\\servers.cfg", true);
Config.Write(IP + ":" + Port + ":" + RCON);
Console.WriteLine("Great! Let's go ahead and start 'er up.");
}
}
}

View File

@ -19,10 +19,10 @@ namespace IW4MAdmin
rcon_pass = password;
clientnum = 0;
RCON = new RCON(this);
logFile = new file("admin_" + address + "_" + port + ".log", true);
logFile = new file("admin_" + port + ".log", true);
Log = new Log(logFile, Log.Level.Production);
players = new List<Player>(new Player[18]);
DB = new Database(port + ".db");
DB = new Database(port + ".dll");
Bans = DB.getBans();
owner = DB.getOwner();
maps = new List<Map>();
@ -66,21 +66,18 @@ namespace IW4MAdmin
return commands;
}
//Returns list of all current players
public List<Player> getPlayers()
{
return players;
}
//Returns list of all active bans (loaded at runtime)
public List<Ban> getBans()
{
return Bans;
}
//Performs update on server statistics read from log.
public void Update()
{
}
//Add player object p to `players` list
public bool addPlayer(Player P)
{
@ -130,6 +127,7 @@ namespace IW4MAdmin
return true;
}
//Get a client from players list by by log line. If create = true, it will return a new player object
public Player clientFromLine(String[] line, int name_pos, bool create)
{
string Name = line[name_pos].ToString().Trim();
@ -156,6 +154,7 @@ namespace IW4MAdmin
}
}
//Should be client from Name ( returns client in players list by name )
public Player clientFromLine(String Name)
{
foreach (Player P in players)
@ -255,7 +254,7 @@ namespace IW4MAdmin
{
if (!intializeBasics())
{
Log.Write("Shutting due to uncorrectable errors..." + logPath, Log.Level.Debug);
Log.Write("Shutting due to uncorrectable errors (check log)" + logPath, Log.Level.Production);
Utilities.Wait(10);
Environment.Exit(-1);
}
@ -351,6 +350,7 @@ namespace IW4MAdmin
}
//Vital RCON commands to establish log file and server name. May need to cleanup in the future
private bool intializeBasics()
{
try
@ -574,7 +574,7 @@ namespace IW4MAdmin
}
}
public bool Unban(String GUID)
public bool Unban(String GUID, Player Target)
{
foreach (Ban B in Bans)
{

30
Admin/config/maps.cfg Normal file
View File

@ -0,0 +1,30 @@
mp_rust:Rust
mp_highrise:Highrise
mp_terminal:Terminal
mp_crash:Crash
mp_nightshift:Skidrow
mp_quarry:Quarry
mp_afghan:Afghan
mp_derail:Derail
mp_estate:Estate
mp_favela:Favela
mp_highrise:Highrise
mp_invasion:Invasion
mp_checkpoint:Karachi
mp_quarry:Quarry
mp_rundown:Rundown
mp_boneyard:Scrapyard
mp_nightshift:Skidrow
mp_subbase:Sub Base
mp_underpass:Underpass
mp_brecourt:Wasteland
mp_overgrown:Overgrown
mp_strike:Strike
mp_vacant:Vacant
mp_abandon:Carnival
mp_trailerpark:Trailer Park
mp_fuel2:Fuel
mp_storm:Storm
mp_complex:Bailout
mp_compact:Salvage
mp_raidmax:^1L^23^33^4T^5M^6A^75^8T^93^0R

View File

@ -0,0 +1,5 @@
60
This server uses ^5IW4M Admin v0.1 ^7get it at ^5raidmax.org
^5IW4M Admin ^7sees ^5YOU!
Cheaters are ^1unwelcome ^7 on this server
Did you know 8/10 people agree with unverified statistics?

6
Admin/config/rules.cfg Normal file
View File

@ -0,0 +1,6 @@
Cheating/Exploiting is not allowed
Respect other players
Administrators have the final say
No Racism or excessive trolling
Keep grenade launcher use to a minimum
Balance teams at ALL times

0
Admin/config/servers.cfg Normal file
View File