Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
*bump*
Do not take life too seriously. You will never get out of it alive.
Posts: 1,323
Threads: 24
Joined: Nov 2010
Reputation:
91
Also paste the part where OnSay is.
Posts: 163
Threads: 4
Joined: Oct 2011
Reputation:
14
05-17-2012, 13:05
(This post was last modified: 05-17-2012, 13:05 by bonemind.)
In the kickclient function, remove this line:
ServerSay(kickmessage,false);
The banfunction has a similar line.
For the warnings you will have to check out warnFunction in warnder. There will be a line there that will print the warning
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
05-17-2012, 15:10
(This post was last modified: 05-17-2012, 15:12 by DidUknowiPwn.)
Only place where I found OnSay
Code: using System;
using System.Collections.Generic;
//Add the "addon/dist/addon.dll" as a reference to your project
//Then add "using Addon;" for the namespace (Optional, but preferred)
using System.IO;
using Addon;
using System.Timers;
namespace ServerAdmin
{
//"<class name> : CPlugin" is needed to inherit the functions
public class ServerAdmin : CPlugin
{
Timer mapSwitch = new Timer();
Boolean welcome = true;
CommandClass commander;
//Example overrides for functions
//public override void OnServerFrame()
//{
//ServerPrint("Server frame");
//}
//Displays the plugin version on serverload
//fetches if permissions are to be used and creates commander and permissions objects
public override void OnServerLoad()
{
ServerPrint("Bonemind's ingame RCON v0.7.5 BETA loaded");
commander = new CommandClass();
}
//displays a message when a player connects and adds him to the userwarninglist
public override void OnPlayerConnect(ServerClient Client)
{
String connectmessage = GetServerCFG("ServerAdmin", "connectmessage", "^2<playername> ^7has connected");
connectmessage = connectmessage.Replace("<playername>", Client.Name);
connectmessage = connectmessage.Replace("<rank>", commander.getRankFromPlayername(Client.Name));
ServerSay(connectmessage, true);
commander.clearWarning(Client);
}
//checks if a player is issueing a command and if the commands needs permissions
//also checks the message for bad words
public override ChatType OnSay(string Message, ServerClient Client)
{
Boolean sendChat = commander.execCommand(Message,Client);
if (!sendChat)
{
sendChat = true;
return ChatType.ChatNone;
}
else
{
return ChatType.ChatContinue;
}
}
}
}
Can't I just do this instead?
Code: Boolean sendChat = commander.execCommand(Message,Client);
if (!sendChat)
{
sendChat = false;
return ChatType.ChatNone;
}
else
{
return ChatType.ChatNone;
}
}
}
Do not take life too seriously. You will never get out of it alive.
Posts: 163
Threads: 4
Joined: Oct 2011
Reputation:
14
(05-17-2012, 15:10)DidUknowiPwn Wrote: Only place where I found OnSay
Code: using System;
using System.Collections.Generic;
//Add the "addon/dist/addon.dll" as a reference to your project
//Then add "using Addon;" for the namespace (Optional, but preferred)
using System.IO;
using Addon;
using System.Timers;
namespace ServerAdmin
{
//"<class name> : CPlugin" is needed to inherit the functions
public class ServerAdmin : CPlugin
{
Timer mapSwitch = new Timer();
Boolean welcome = true;
CommandClass commander;
//Example overrides for functions
//public override void OnServerFrame()
//{
//ServerPrint("Server frame");
//}
//Displays the plugin version on serverload
//fetches if permissions are to be used and creates commander and permissions objects
public override void OnServerLoad()
{
ServerPrint("Bonemind's ingame RCON v0.7.5 BETA loaded");
commander = new CommandClass();
}
//displays a message when a player connects and adds him to the userwarninglist
public override void OnPlayerConnect(ServerClient Client)
{
String connectmessage = GetServerCFG("ServerAdmin", "connectmessage", "^2<playername> ^7has connected");
connectmessage = connectmessage.Replace("<playername>", Client.Name);
connectmessage = connectmessage.Replace("<rank>", commander.getRankFromPlayername(Client.Name));
ServerSay(connectmessage, true);
commander.clearWarning(Client);
}
//checks if a player is issueing a command and if the commands needs permissions
//also checks the message for bad words
public override ChatType OnSay(string Message, ServerClient Client)
{
Boolean sendChat = commander.execCommand(Message,Client);
if (!sendChat)
{
sendChat = true;
return ChatType.ChatNone;
}
else
{
return ChatType.ChatContinue;
}
}
}
}
Can't I just do this instead?
Code: Boolean sendChat = commander.execCommand(Message,Client);
if (!sendChat)
{
sendChat = false;
return ChatType.ChatNone;
}
else
{
return ChatType.ChatNone;
}
}
}
It would be easier to remove that boolean and just do return ChatType.ChatNone
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
So remove that whole Boolean and go back to CommandClass and input return ChatType.ChatNone?
Do not take life too seriously. You will never get out of it alive.
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
05-18-2012, 00:24
(This post was last modified: 05-18-2012, 00:26 by DidUknowiPwn.)
Still getting the same error >_>
There are still Boolean's in the CommandClass Code: using System;
using System.Collections.Generic;
using System.Text;
using Addon;
using System.Threading;
namespace ServerAdmin
{
class CommandClass : CPlugin
{
Warner warner;
Langfilter teacher;
Permissions bouncer;
Boolean usePermissions;
Aliaser cloaker;
Immunitizer untouchables;
//Mapper maps;
public CommandClass()
{
bouncer = new Permissions();
usePermissions = bouncer.getPermEnabled();
warner = new Warner();
teacher = new Langfilter();
cloaker = new Aliaser();
untouchables = new Immunitizer();
//maps = new Mapper();
}
public Boolean execCommand (String Message,ServerClient issuer)
{
//Delimiters for splitting of messages
Char[] delimit = { ' ' };
//Splitting the message
String[] split = Message.Split(delimit);
//Makes sure a nullpointerException is not possible in this function
if (split[0] == null)
{
return true;
}
String alias = cloaker.getAlias(split[0].ToLower());
Message = Message.Replace(split[0], alias);
split = Message.Split(' ');
//Checks if a user has permission to issue a command
if (Message.StartsWith("!") && !bouncer.canIssueCommand(issuer, split[0]))
{
TellClient(issuer.ClientNum, "^2You don't have permission to use that", true);
return false;
}
//returns the ping to the issuer, can be given a playername
if (split[0].Equals("!ping"))
{
if (split.Length > 1)
{
ServerClient target = findClient(split[1]);
if (target != null)
{
TellClient(issuer.ClientNum, "^2" + target.Name + "'s ^7ping:^2" + target.Ping, true);
}
else
{
TellClient(issuer.ClientNum, "No player was found, multiple were found", true);
}
}
else
{
TellClient(issuer.ClientNum, "^2Your ping:" + issuer.Ping, true);
}
return false;
}
//adds an admin to the admin list
else if (split[0].Equals("!add"))
{
if (!(split.Length > 2))
{
TellClient(issuer.ClientNum, "Please enter a group and playername, format: !addadmin groupname playername", true);
}
else
{
ServerClient target = findClient(split[2]);
if (target == null)
{
TellClient(issuer.ClientNum,"That user was not found or multiple were found",true);
}
else
{
bouncer.setGroup(issuer, split[1], target);
}
}
return false;
}
//Make a player immune
else if (split[0].Equals("!addimmune"))
{
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername", true);
}
else
{
ServerClient target = findClient(split[1]);
untouchables.addImmune(issuer, target);
}
return false;
}
//reloads the complete config
else if (split[0].Equals("!rel"))
{
bouncer = new Permissions();
usePermissions = bouncer.getPermEnabled();
warner = new Warner();
teacher = new Langfilter();
cloaker = new Aliaser();
untouchables = new Immunitizer();
TellClient(issuer.ClientNum, "Config reloaded", true);
return false;
}
//returns the player with the highest ping
else if (split[0].Equals("!maxping"))
{
maxPing();
return false;
}
//returns the player with the lowest ping
else if (split[0].Equals("!minping"))
{
minPing();
return false;
}
//FastRestart command, sends map restart to the server
else if (split[0].Equals("!fastrestart"))
{
ServerCommand("map_restart");
return false;
}
//Yell command, Displays text to all clients in HUD
else if (split[0].Equals("!yell"))
{
yellCommand(Message, issuer);
return false;
}
//Returns the name, clientnumber and XUID of the target player(s)
else if (split[0].Equals("!pi"))
{
playerInfo(Message, issuer);
return false;
}
//Returns the name, clientnumber and XUID of the target player(s)
/*else if (split[0].Equals("!setmap"))
{
setMap(Message,issuer);
return false;
}
else if (split[0].Equals("!nextmap"))
{
getNextMap();
return false;
}*/
//returns the version of the plugin
else if (split[0].Equals("!ver"))
{
TellClient(issuer.ClientNum, "Bonemind's edit by DidUknowiPwn ingame Rcon, v0.8 BETA w/o Ban/Kick/TB Message LOADED", true);
return false;
}
//returns the players xuid
else if (split[0].Equals("!xuid"))
{
TellClient(issuer.ClientNum, "^2XUID: ^1" + issuer.XUID, true);
return false;
}
//adds a word(s) to the bad language filter
else if (split[0].Equals("!addword"))
{
addToLangFilter(Message, issuer);
return false;
}
//pm's a player with message
else if (split[0].Equals("!pm"))
{
personalMessage(issuer, Message);
return false;
}
//creates an object ruler that tells the issuer the rules
else if (split[0].Equals("!rules"))
{
new Ruler(issuer);
return false;
}
//displays all existing commands
else if (split[0].Equals("!help"))
{
new Helper(issuer);
return false;
}
//issues an rcon command to the server
else if (split[0].Equals("!rcon"))
{
string command = "";
for (int i = 1; i < split.Length; i++)
{
if (split[i] == null)
{
return false;
}
command += split[i] + " ";
}
ServerCommand(command.Trim());
return false;
}
//resets the config
else if (split[0].Equals("!resetconf"))
{
SetServerCFG("ServerAdmin", "kickwarnings", "3");
SetServerCFG("ServerAdmin", "usePermissions", "false");
SetServerCFG("ServerAdmin", "useLangFilter", "false");
SetServerCFG("ServerAdmin", "warningTTL", "12");
SetServerCFG("ServerAdmin", "pmrules", "true");
SetServerCFG("ServerAdmin", "warningtempban", "true");
SetServerCFG("ServerAdmin", "kickmessage", "<playername> has been kicked for <reason> by <issuer>");
SetServerCFG("ServerAdmin", "banmessage", "<playername> has been banned by <issuer>");
SetServerCFG("ServerAdmin", "connectmessage", "<playername> has connected");
SetServerCFG("ServerAdmin", "tmpbanmessage", "<playername> has been tempbanned by <issuer>");
SetServerCFG("ServerAdmin", "warnkickmessage", "<playername> was kicked for <reason>");
SetServerCFG("ServerAdmin", "warnmessage", "<playername> was warned for <reason>");
SetServerCFG("ServerAdmin", "unwarnmessage", "<playername> was kicked for <reason>");
TellClient(issuer.ClientNum, "Config reset", true);
return false;
}
else if (split[0].Equals("!reserved"))
{
kickReserved(issuer);
return false;
}
//Kick command, invokes kickCommand(String, ServerClient)
else if (split[0].Equals("!kick"))
{
kickCommand(Message, issuer);
return false;
}
//Ban command, invokes banCommand(String, ServerClient)
else if (split[0].Equals("!ban"))
{
banCommand(Message, issuer);
return ChatType.ChatNone;
}
//Kicks by clientnumber, no feedback
else if (split[0].Equals("!kickc"))
{
kickCommandClientNum(Message, issuer);
return false;
}
//bans by clientnumber, no feedback
else if (split[0].Equals("!banc"))
{
banCommandClientNum(Message, issuer);
return false;
}
//issues a warning to the player with optional reason
else if (split[0].Equals("!warn"))
{
warnPlayerCommand(Message, issuer);
return false;
}
//tempbans a player with length kickbantime in sv_config
else if (split[0].Equals("!tmpban"))
{
tempBanCommand(Message, issuer);
return false;
}
//removes a warning to the player?+>_>
else if (split[0].Equals("!unwarn"))
{
unWarnPlayerCommand(Message, issuer);
return false;
}
else
{
if (!untouchables.isPlayerImmune(issuer))
{
testLang(Message, issuer);
}
}
return true;
}
//Bans a client by clientnumber
//uses findClient(String name), to find ServerClient
//uses ServerClient to fetch client number
void banCommand(String command, ServerClient issuer)
{
Char[] delimit = { ' ' };
String[] split = command.Split(delimit);
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername", true);
return;
}
ServerClient clientResult = findClient(split[1]);
if (immunityCheck(split[1]))
{
ServerClient target = findClient(split[1]);
TellClient(issuer.ClientNum, target.Name + " is immune to that command.", true);
return;
}
if (clientResult != null)
{
ServerCommand("banClient " + clientResult.ClientNum);
String banmessage = GetServerCFG("ServerAdmin", "banmessage", "^2<playername> ^7has been banned by <issuer>");
banmessage = banmessage.Replace("<playername>", clientResult.Name);
banmessage = banmessage.Replace("<issuer>", issuer.Name);
banmessage = banmessage.Replace("<rank>", bouncer.getUserGroup(issuer.XUID));
}
else if (clientResult == null)
{
TellClient(issuer.ClientNum, "Could not find username, or multiple were found.", false);
}
}
//Iterates through clientnames to find the correct client
//If exactly one client is found, returns ServerClient
//else returns null
public ServerClient findClient(String clientName)
{
clientName = clientName.Trim();
int clientCount = 0;
ServerClient client = null;
System.Collections.Generic.List<ServerClient> clientList = GetClients();
foreach (ServerClient currClient in clientList)
{
if (0 <= currClient.Name.IndexOf(clientName, StringComparison.InvariantCultureIgnoreCase))
{
client = currClient;
clientCount++;
}
}
if (clientCount > 1)
{
return null;
}
else if (clientCount == 1)
{
return client;
}
return null;
}
//Kicks a client by clientnumber
//uses findClient(String name), to find ServerClient
//uses ServerClient to fetch client number
void kickCommand(String command, ServerClient issuer)
{
Char[] delimit = { ' ' };
String[] split = command.Split(delimit);
ServerClient clientResult;
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername", true);
return;
}
clientResult = findClient(split[1]);
/*
if (int.TryParse(split[1], out tmpBanTime))
{
clientResult = findClient(split[2]);
}
else
{
clientResult = findClient(split[1]);
}
*
**/
if (clientResult != null)
{
if (immunityCheck(split[1]))
{
ServerClient target = findClient(split[1]);
TellClient(issuer.ClientNum, target.Name + " is immune to that command.", true);
return;
}
String reason = "";
if (split.Length > 2)
{
for (int i = 2; i < split.Length; i++)
{
reason += " " + split[i];
}
reason = warner.reasonParser(reason.Trim());
ServerCommand("dropclient " + clientResult.ClientNum + " \"" + reason + "\"");
}
else if (split.Length <= 2)
{
ServerCommand("dropclient " + clientResult.ClientNum + " \"See You...\"");
}
String kickmessage = GetServerCFG("ServerAdmin", "kickmessage", "^2<playername> ^7has been kicked for ^3<reason> by <issuer>");
kickmessage = kickmessage.Replace("<playername>", clientResult.Name);
kickmessage = kickmessage.Replace("<issuer>", issuer.Name);
kickmessage = kickmessage.Replace("<reason>", reason);
kickmessage = kickmessage.Replace("<rank>", bouncer.getUserGroup(issuer.XUID));
ServerSay(kickmessage,false);
}
else if (clientResult == null)
{
TellClient(issuer.ClientNum, "Could not find username, or multiple were found.", false);
}
}
//kicks a client by clientnumber
void kickCommandClientNum(String command, ServerClient issuer)
{
Char[] delimit = { ' ' };
String[] split = command.Split(delimit);
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a player number", true);
return;
}
if (split.Length > 2)
{
String reason = "";
for (int i = 2; i < split.Length; i++)
{
reason += " " + split[i];
}
reason = warner.reasonParser(reason.Trim());
ServerCommand("dropclient " + split[1] + " \"" + reason + "\"");
}
else if (split.Length <= 2)
{
ServerCommand("dropclient " + split[1] + " \"See You...\"");
}
}
//bans a client by clientnumber
void banCommandClientNum(String command, ServerClient issuer)
{
Char[] delimit = { ' ' };
String[] split = command.Split(delimit);
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a player number", true);
return;
}
if (split.Length > 2)
{
String reason = "";
for (int i = 2; i < split.Length; i++)
{
reason += " " + split[i];
}
ServerCommand("banclient " + split[1]);
}
else if (split.Length <= 2)
{
ServerCommand("banclient " + split[1]);
}
TellClient(issuer.ClientNum, "Player kicked", false);
}
//yells to a player, or to all players if 'all' is issued
void yellCommand(String command, ServerClient issuer)
{
Char[] delimit = { ' ' };
String[] split = command.Split(delimit);
String yellMessage = "";
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername or all", true);
return;
}
ServerClient clientResult = findClient(split[1]);
for (int i = 2; i < split.Length; i++)
{
yellMessage += " " + split[i];
}
if (split[1].Equals("all"))
{
iPrintLnBold(yellMessage, null);
}
else if (clientResult != null)
{
iPrintLnBold(yellMessage, clientResult);
}
else
{
TellClient(issuer.ClientNum, "Could not find username, or multiple were found.", false);
}
}
//fetches the playerinfo of the entered player, or all players
void playerInfo(String Message, ServerClient issuer)
{
System.Collections.Generic.List<ServerClient> clientList = GetClients();
Char[] delimit = { ' ' };
String[] split = Message.Split(delimit);
String name = "";
for (int i = 1; i < split.Length; i++)
{
name += split[i];
if (i > 1)
{
name += " ";
}
}
if (split.Length == 1)
{
Thread statusThread = new Thread(new ParameterizedThreadStart(statusAll));
statusThread.Start(issuer);
return;
}
foreach (ServerClient currClient in clientList)
{
if (currClient.Name.ToLower().Contains(name) || name=="")
{
if (currClient.Name != "")
{
TellClient(issuer.ClientNum, "^1Name: " + currClient.Name + " ^2Clientnum: " + currClient.ClientNum + " ^3XUID:" + currClient.XUID + " ^1Warnings: " + warner.getWarnings(currClient) + " ^4Group:"
+ bouncer.getUserGroup(currClient.XUID), true);
}
}
}
}
//issues a warning to a player
void warnPlayerCommand(String Message, ServerClient issuer)
{
char[] delimit = {' '};
String[] split = Message.Split(delimit);
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername", true);
return;
}
ServerClient target = findClient(split[1]);
String reason = "";
Boolean kickPlayer = false;
if (target != null)
{
if (immunityCheck(split[1]))
{
ServerClient cmdtarget = findClient(split[1]);
TellClient(issuer.ClientNum, cmdtarget.Name + " is immune to that command.", true);
return;
}
for (int i = 2; i < split.Length; i++)
{
reason += split[i] + " ";
}
reason = warner.reasonParser(reason.Trim());
kickPlayer = warner.warnPlayer(target, reason);
Boolean tempbanAfterKick;
if (!Boolean.TryParse(GetServerCFG("ServerAdmin", "warningtempban", "false"), out tempbanAfterKick))
{
ServerPrint("Could not retrieve warningtempban value, make sure it is true or false");
}
if (kickPlayer && !tempbanAfterKick )
{
ServerCommand("dropclient " + target.ClientNum + " \"" + reason + "\"");
}
else if (kickPlayer && tempbanAfterKick)
{
ServerCommand("tempbanclient " + target.ClientNum + " \"" + reason + "\"");
}
}
else
{
TellClient(issuer.ClientNum, "Could not find player, or multiple were found", true);
}
}
//removes one warning for a player
void unWarnPlayerCommand(String Message, ServerClient issuer)
{
char[] delimit = { ' ' };
String[] split = Message.Split(delimit);
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername", true);
return;
}
ServerClient target = findClient(split[1]);
Boolean unWarnSucces = false;
String reason = "";
if (target != null)
{
for (int i = 2; i < split.Length; i++)
{
reason += split[i] + " ";
}
unWarnSucces = warner.unWarnPlayer(target, reason);
if (!unWarnSucces)
{
TellClient(issuer.ClientNum, "The player does not have any warnings", true);
}
}
else
{
TellClient(issuer.ClientNum, "Could not find player, or multiple were found", true);
}
}
public void clearWarning(ServerClient client)
{
warner.addClient(client);
}
//passes the chatmessage to the teacher object, and issues a warning if teacher returns true
void testLang(String message, ServerClient target)
{
if (teacher.issueWarning(message))
{
String reason = "Bad language";
Boolean kickPlayer = false;
if (target != null)
{
kickPlayer = warner.warnPlayer(target, reason);
Boolean tempbanAfterKick = false;
if (!Boolean.TryParse(GetServerCFG("ServerAdmin", "warningtempban", "false"), out tempbanAfterKick))
{
ServerPrint("Could not retrieve warningtempban value, make sure it is true or false");
}
if (kickPlayer && !tempbanAfterKick)
{
ServerCommand("dropclient " + target.ClientNum + " " + reason);
}
else if (kickPlayer && tempbanAfterKick)
{
ServerCommand("tempbanclient " + target.ClientNum + " " + reason);
}
}
}
}
//adds a word or words to the language filter
void addToLangFilter(String message, ServerClient issuer)
{
Char[] delimit = { ' ' };
String[] split = message.Split(delimit);
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a word or words", true);
return;
}
for (int i = 1; i < split.Length; i++)
{
teacher.addWord(split[i]);
}
TellClient(issuer.ClientNum, "Word(s) Added!", true);
}
//tempbans a player using kickbantime in sv_config
void tempBanCommand(String command, ServerClient issuer)
{
Char[] delimit = { ' ' };
int tmpBanTime = 0;
String[] split = command.Split(delimit);
ServerClient clientResult;
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please enter a playername", true);
return;
}
if (int.TryParse(split[1], out tmpBanTime))
{
clientResult = findClient(split[2]);
}
else
{
clientResult = findClient(split[1]);
}
if (clientResult != null)
{
double tempBanTime;
try
{
tempBanTime = double.Parse(GetDvar("sv_kickbantime")) / 60;
}
catch
{
tempBanTime = 60;
}
if (immunityCheck(split[1]))
{
ServerClient target = findClient(split[1]);
TellClient(issuer.ClientNum, target.Name + " is immune to that command.", true);
return;
}
String reason = "";
if (split.Length > 2)
{
for (int i = 2; i < split.Length; i++)
{
reason += " " + split[i];
}
reason = warner.reasonParser(reason.Trim());
ServerCommand("tempbanclient " + clientResult.ClientNum + " \"" + reason + "\"");
}
else if (split.Length <= 2)
{
ServerCommand("tempbanclient " + clientResult.ClientNum + " \"See You...\"");
}
String tmpbanmessage = GetServerCFG("ServerAdmin", "tmpbanmessage", "^2<playername> ^7has been tempbanned for ^3<reason> by <issuer>");
tmpbanmessage = tmpbanmessage.Replace("<playername>", clientResult.Name);
tmpbanmessage = tmpbanmessage.Replace("<reason>", reason);
tmpbanmessage = tmpbanmessage.Replace("<issuer>", issuer.Name);
tmpbanmessage = tmpbanmessage.Replace("<length>", tmpBanTime.ToString());
tmpbanmessage = tmpbanmessage.Replace("<rank>", bouncer.getUserGroup(issuer.XUID));
ServerSay(tmpbanmessage, false);
}
else if (clientResult == null)
{
TellClient(issuer.ClientNum, "Could not find username, or multiple were found.", false);
}
}
//gets the ping of all players and displays the player with the lowest ping
void minPing()
{
int minping = 10000;
ServerClient lowestping = null;
foreach (ServerClient client in GetClients())
{
if (client.Ping < minping && client.Name != "")
{
lowestping = client;
minping = client.Ping;
}
}
ServerSay("^2" + lowestping.Name + " ^7has the lowest ping: ^2" + lowestping.Ping,true);
}
//gets the ping of all players and displays the player with the highest ping
void maxPing()
{
int maxping = 0;
ServerClient highestping = null;
foreach (ServerClient client in GetClients())
{
if (client.Ping > maxping && client.Name !="")
{
highestping = client;
maxping = client.Ping;
}
}
ServerSay("^2" + highestping.Name + " ^7has the highest ping: ^2" + highestping.Ping, true);
}
//pm's a player with supplied message
void personalMessage(ServerClient issuer, String message)
{
String[] split = message.Split(' ');
ServerClient target;
if (!(split.Length > 1))
{
TellClient(issuer.ClientNum, "Please provide a receiver", true);
return;
}
else if (!(split.Length > 2))
{
TellClient(issuer.ClientNum, "Please provide a message", true);
return;
}
target = findClient(split[1]);
if (target == null)
{
TellClient(issuer.ClientNum, "Player could not be found, or multiple were found", true);
return;
}
else
{
String pmessage = "";
for (int i = 2; i < split.Length; i++)
{
pmessage += split[i];
}
TellClient(target.ClientNum, "^1[PM]^2" + issuer.Name + ":^7 " + pmessage, true);
}
}
Boolean immunityCheck(String name)
{
ServerClient target = findClient(name);
if (target != null && untouchables.isPlayerImmune(target))
{
return true;
}
else
{
return false;
}
}
void statusAll(object Admin)
{
ServerClient issuer = (ServerClient)Admin;
List<ServerClient> clientList = GetClients();
foreach (ServerClient currClient in clientList)
{
if (!(currClient.Name == ""))
{
TellClient(issuer.ClientNum, "^1Name: " + currClient.Name + " ^2Clientnum: " + currClient.ClientNum + " ^3XUID:" + currClient.XUID + " ^1Warnings: " + warner.getWarnings(currClient), true);
Thread.Sleep(1500);
}
}
}
public String getRankFromPlayername(String name)
{
ServerClient client = findClient(name);
String group = "User";
if (client!=null)
{
group = bouncer.getUserGroup(client.XUID);
}
return group;
}
void kickReserved(ServerClient issuer)
{
List<ServerClient> clients = GetClients();
int clientNum = -1;
int ping = 0;
foreach (ServerClient client in clients)
{
if (bouncer.getUserGroup(client.XUID).Equals("User"))
{
if (client.Ping > ping && client.Ping < 999)
{
clientNum = client.ClientNum;
ping = client.Ping;
}
}
}
if (clientNum > -1)
{
ServerCommand("dropclient " + clientNum + " \"Making room for members, sorry\"");
}
else
{
TellClient(issuer.ClientNum, "Could not find suitable client to kick", true);
}
}
/*void setMap(String message, ServerClient issuer)
{
String[] split = message.Split(' ');
if (split.Length >= 2)
{
if (maps.setNextMapCommand(split[1]))
{
TellClient(issuer.ClientNum,"The next map has been set to " + split[1], true);
}
else
{
TellClient(issuer.ClientNum,"That map was not found",true);
}
}
}
public void nextMap()
{
maps.setNextMapFromFile();
}
void getNextMap()
{
String next = maps.getNextMap();
if (next.Equals("DISABLED"))
{
ServerSay("Custom maplist disabled", true);
}
else if (next == "")
{
ServerPrint("The next map's name was not found, Check your recipe");
ServerSay("Next map name not found", true);
}
else
{
ServerSay("The next map is: ^1 " + next,true);
}
}*/
}
}
Do not take life too seriously. You will never get out of it alive.
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
yunohelp D:?
Do not take life too seriously. You will never get out of it alive.
Posts: 1,323
Threads: 24
Joined: Nov 2010
Reputation:
91
@ bonemind already said, remove the ServerSay().
Posts: 1,741
Threads: 93
Joined: Mar 2012
Reputation:
26
Well I tried both, it works it doesn't show the kick/ban/tempban message but it still shows in chat.. :?
Do not take life too seriously. You will never get out of it alive.
|