Release Warn & Status Plugin
#1
This plugin lets the admin warn players. You can also see the status of players. It requires @Nukem's dedicated server addon V1.190

@Pozzuh's Permission Plugin Support



sv_config.ini entries:

To add people who are authorized to use the command, see @Pozzuh's thread here

InGame admin commands:


Warn a player:
!warn playername <optional>reason
Example: Player zxz is hacking
Code:
!warn z YOU ARE HAXING
[Image: 2012010600001.jpg]
This would be my second warning. You can use any part of the name. You can also use clientID, then just write !warnid <id> <reason>

Remove warnings from a player:
!rmwarn playername
You can use any part of the name. You can also use clientID, then just write !rmwarnid <id> <reason>

See status of players:
!status playername
Output is ClientNum, Name, warnings, XUID
If you want to see all players, write !status all

InGame client commands:


See status of yourself
!status
[Image: 2012010600002j.jpg]
Dont forget to edit the User_commands variable in sv_config.ini

How to use:
Download the MW3_Warn_Support.zip file from attachement and put the MW3_Warn.dll together with aaaPermissionPlugin.dll in your plugins folder.


Stand-alone Plugin

If you don't want to use @Pozzuh's Permission plugin you can use this stand-alone version.
The commands are the same like in the version above. But be sure to set the following entries in sv_config.ini.

sv_config.ini entries:

Code:
[ADMIN] admin_xuids=xuid1,xuid2,xuid3 //XUID of clients allowed to use admin commands max_warnings=x //[default=3] How many warnings for kick warn_not_authorized=1/0 //[default=0] Warn if non-admins use admin commands notify_not_authorized=1/0 //[default=1] Notify if non-admins use admin commands //If warn_not_authorized is set to 1, notify_not_authorized also needs to be 1!

How to use:
Download the MW3_Warn.zip file from attachement and put the MW3_Warn.dll in your plugins folder.



Source:
Code:
using System; using System.Collections.Generic; using Addon; using System.Threading; namespace MW3_Warn { public class zxz_warnPlugin : CPlugin { int max_warnings; List<string> admin_table = new List<string>(); string warn_not_authorized; bool notify_not_authorized; Dictionary<string, Int32> warnings = new Dictionary<string, Int32>(); public override void OnServerLoad() { ServerPrint("\n Warn Plugin loaded \n Author: zxz0O0 \n Thanks to Nukem, Jariz, Pozzuh\n"); max_warnings = Convert.ToInt32(GetServerCFG("ADMIN", "max_warnings", "3")); string admin = GetServerCFG("ADMIN", "admin_xuids", ""); warn_not_authorized = GetServerCFG("ADMIN", "warn_not_authorized", "0"); if (Convert.ToInt32(GetServerCFG("ADMIN", "notify_not_authorized", "1")) == 1) notify_not_authorized = true; else notify_not_authorized = false; string[] admins = admin.Split(','); for (int i = 0; i < admins.Length; i++) { admin_table.Add(admins[i]); } } public override ChatType OnSay(string Message, ServerClient Client) { if (Message.StartsWith("!warn")) { if (checkAdmin(Client)) { string[] split = Message.Split(' '); if (Message.StartsWith("!warnid")) { if (split.Length < 2 || !isNum(split[1])) TellClient(Client.ClientNum, "PM: Invalid parameter. Usage: !warnid clientID <optional>reason", true); else { string reason = ""; for (int z = 2; z < split.Length; z++) reason += split[z] + " "; if (GetClient(Convert.ToInt32(split[1])).XUID != "") AddWarning(GetClient(Convert.ToInt32(split[1])), reason); else TellClient(Client.ClientNum, "Player not available", false); } } else { if (split.Length < 2) TellClient(Client.ClientNum, "PM: Invalid parameter. Usage: !warn clientname <optional>reason", true); else { ServerClient victim = getClientByName(split[1], Client); if (victim != null) { if (split.Length >= 3) { string reason = ""; for (int z = 2; z < split.Length; z++) reason += split[z] + " "; AddWarning(victim, reason); } else if (split.Length == 2) AddWarning(victim); } } } } return ChatType.ChatNone; } else if (Message.StartsWith("!rmwarn")) { if (checkAdmin(Client)) { string[] split = Message.Split(' '); if (Message.StartsWith("!rmwarnid")) { if (split.Length == 1 || !isNum(split[1])) TellClient(Client.ClientNum, "PM: Invalid parameter. Usage: !rmwarnid clientID", true); else { ServerClient victim = GetClient(Convert.ToInt32(split[1])); if (victim.XUID != "") { if (warnings.ContainsKey(victim.XUID)) { warnings[victim.XUID] = 0; TellClient(victim.ClientNum, "Warnings cleared", false); } } else TellClient(Client.ClientNum, "Player not available", false); } } else { if (split.Length == 1) TellClient(Client.ClientNum, "PM: Invalid parameter. Usage: !rmwarn clientname", true); else { ServerClient victim = getClientByName(split[1], Client); if (victim != null) { if (warnings.ContainsKey(victim.XUID)) { warnings[victim.XUID] = 0; TellClient(victim.ClientNum, "Warnings cleared", false); } } } } } return ChatType.ChatNone; } else if (Message.StartsWith("!status")) { string[] split = Message.Split(' '); if (split.Length == 1) { if (!warnings.ContainsKey(Client.XUID)) { TellClient(Client.ClientNum, "Num: " + Client.ClientNum + "; Name: " + Client.Name + "; Warnings: ^10^7; XUID: " + Client.XUID, true); } else { int checkWarnings = warnings[Client.XUID]; TellClient(Client.ClientNum, "Num: " + Client.ClientNum + "; Name: " + Client.Name + "; Warnings: ^1" + checkWarnings + "^7; XUID: " + Client.XUID, true); } } else { if (checkAdmin(Client)) { if (split[1].ToLower() == "all") { Thread statusAll = new Thread(new ParameterizedThreadStart(StatusAllClients)); statusAll.Start(Client); } else { ServerClient victim = getClientByName(split[1], Client); if (victim != null) { if (!warnings.ContainsKey(victim.XUID)) { TellClient(Client.ClientNum, "Num: " + victim.ClientNum + "; Name: " + victim.Name + "; Warnings: ^10^7; XUID: " + victim.XUID, true); } else { int checkWarnings = warnings[victim.XUID]; TellClient(Client.ClientNum, "Num: " + victim.ClientNum + "; Name: " + victim.Name + "; Warnings: ^1" + checkWarnings + "^7; XUID: " + victim.XUID, true); } } } } } return ChatType.ChatNone; } return ChatType.ChatContinue; } //Check if integer public bool isNum(string value) { try { int num; bool check = int.TryParse(value, out num); return check; } catch { } return false; } public void StatusAllClients(object admin) { ServerClient Admin = (ServerClient)admin; List<ServerClient> clients = GetClients(); foreach (ServerClient client in clients) { if (client.XUID != "") { int checkWarnings = 0; if (warnings.ContainsKey(client.XUID)) checkWarnings = warnings[client.XUID]; TellClient(Admin.ClientNum, "Num: " + client.ClientNum + "; Name: " + client.Name + "; Warnings: ^1" + checkWarnings + "^7; XUID: " + client.XUID, true); Thread.Sleep(4000); } } } ServerClient getClientByName(string name, ServerClient admin) { List<ServerClient> clients = GetClients(); int possibilities = 0; ServerClient Client4return = null; foreach (ServerClient client in clients) { if(client.Name.ToLower().Contains(name.ToLower())) { possibilities++; Client4return = client; } } if (possibilities > 1) TellClient(admin.ClientNum, "Too many possibilities, use ClientID or more specific name", false); else if (possibilities == 0) TellClient(admin.ClientNum, "Player not available", false); else return Client4return; //Too many alternatives return null; } bool checkAdmin(ServerClient client) { if (admin_table.Contains(client.XUID)) return true; else { if (notify_not_authorized) { if (warn_not_authorized != "0") AddWarning(client, "not_authorized"); else TellClient(client.ClientNum, "You are not authorized to use admin commands", false); } return false; } } void AddWarning(ServerClient client, string reason = "warn") { if (!warnings.ContainsKey(client.XUID)) warnings.Add(client.XUID, 1); else warnings[client.XUID] = warnings[client.XUID] + 1; int checkWarnings = warnings[client.XUID]; if (checkWarnings == max_warnings) { warnings[client.XUID] = 0; ServerCommand("kickClient " + client.ClientNum + " \"Kick: Too many warnings (^1" + checkWarnings + "^7)\""); } else { if (reason == "warn") TellClient(client.ClientNum, "Warning (^1" + checkWarnings + "^7)", false); else if (reason == "not_authorized") TellClient(client.ClientNum, "Warning (^1" + checkWarnings + "^7): You are not authorized to use admin commands", false); else TellClient(client.ClientNum, "Warning (^1" + checkWarnings + "^7): " + reason, false); } } } }


Attached Files
.zip   MW3_Warn.zip (Size: 4.09 KB / Downloads: 262)
.zip   MW3_Warn_Support.zip (Size: 3.81 KB / Downloads: 233)
[Image: azuw.jpg]
Reply

#2
didnt see that. thats a good plugin!
Reply

#3
Yes thats true! And its a good solution for using the !status -command to get the player-IDs. Good work!!!


Edit:
Is it possible to make the output from the !status -command visible in the ingame-console? Because the Chat is not the best solution if there are more player on the server. Only for the admin who typed the !status -command of course. xD

Thank you

Edit 2:
Ohhh fuck Sad
I just saw that i only can see my status Sad
Would be nice if this can be changed.
Reply

#4
(01-11-2012, 00:14)Mauser Wrote: Yes thats true! And its a good solution for using the !status -command to get the player-IDs. Good work!!!


Edit:
Is it possible to make the output from the !status -command visible in the ingame-console? Because the Chat is not the best solution if there are more player on the server. Only for the admin who typed the !status -command of course. xD

Thank you

Edit 2:
Ohhh fuck Sad
I just saw that i only can see my status Sad
Would be nice if this can be changed.

If you want it to output in the ingame console you need to login to rcon. Otherwise it's not possible.

You can see the status from others if you type their name (or the beginning or ending).
Ex: If your name is Mauser then you can type !status Mau (in case you are the only one beginning with "Mau")
[Image: azuw.jpg]
Reply

#5
Very nice plugin zxzzz!
Reply

#6
Heya,

Installed this plugin today on my server, running the latest version of the addon by nukem.

But when i try to warn someone, lets say myself like : !warn snowy test

then it says player snowy not found (or something like that)
It only works when i type out the full name, and that quite irritating with some names.

is this a bug?

with kind regards,
Snowy Leopard
Reply

#7
(01-13-2012, 17:00)Snowy Leopard Wrote: Heya,

Installed this plugin today on my server, running the latest version of the addon by nukem.

But when i try to warn someone, lets say myself like : !warn snowy test

then it says player snowy not found (or something like that)
It only works when i type out the full name, and that quite irritating with some names.

is this a bug?

with kind regards,
Snowy Leopard
I named myself Snowy Leopard, joined my server and typed
Code:
!warn sno test
It worked so you may do something wrong.
[Image: azuw.jpg]
Reply

#8
(01-13-2012, 18:23)zxz0O0 Wrote:
(01-13-2012, 17:00)Snowy Leopard Wrote: Heya,

Installed this plugin today on my server, running the latest version of the addon by nukem.

But when i try to warn someone, lets say myself like : !warn snowy test

then it says player snowy not found (or something like that)
It only works when i type out the full name, and that quite irritating with some names.

is this a bug?

with kind regards,
Snowy Leopard
I named myself Snowy Leopard, joined my server and typed
Code:
!warn sno test
It worked so you may do something wrong.

tested again. My exact in-game name is: |HSO| Snowy Leopard

!warn sno test - doesn't work
!warn |hso| test - does work
!warn hso test - doesn't work
!warn leo test - does work

running on linux btw
Reply

#9
(01-13-2012, 18:57)Snowy Leopard Wrote: tested again. My exact in-game name is: |HSO| Snowy Leopard

!warn sno test - doesn't work
!warn |hso| test - does work
!warn hso test - doesn't work
!warn leo test - does work

running on linux btw

Ah ok. Yes I coded it so you either need to type the start of your name or the ending.
[Image: azuw.jpg]
Reply

#10
Installed the "Warn & Status Plugin" and the "Permissions Plugin".
Setup my my xuid in the config.

If I type: !warn <myplayer name> reason
nothing happens; no message, no nothing.

If any other player tries it, they get a message that tells them
that they are not authorized to use that command. So, since
I'm not getting that message, means that I'm authorized,
and since I'm authorized it should work, or yield an error, no?

Here is what my sv_config.ini looks like:
[SERVER]
Ranked=1
//Control if the server is ranked or not by default [0-1]
TimedMessages=1
//Enable or disable timed messages [0-1]
SpecsFix=0
//Disable the CPU/Bandwidth check [0-1]

[LOG]
ConsoleLog=1
//Enable logging to the 'console.log' file [0-1]

[SCRIPT]
Enabled=0
//Enable the server script [0-1]
Script=example.script
//Server script to run

[DEBUG]
ExceptionLogging=1
//Enable logging of crashes [Turn off to prevent false detections] [0-1]

[UPDATER]
Enable=1
//Enable checking for updates [0-1]
[Permission]
Usergroups=SrAdmin,Admin,User
SrAdmin_xuids=<myxuid>
SrAdmin_commands=*ALL*
Admin_xuids=xuid1,xuid2,xuid3
Admin_commands=*ALL*
User_commands=!help,!getxuid,!gettype,!fov,!rules
User_xuids=*EVERYONE*
Moderator_xuids=xuid1,xuid2,xuid3
Moderator_commands=!help,!getxuid,!gettype

[ADMIN]
admin_xuids=<myxuid> //XUID of clients allowed to use admin commands
max_warnings=3 //[default=3] How many warnings for kick
warn_not_authorized=1/0 //[default=0] Warn if non-admins use admin commands
notify_not_authorized=1/0 //[default=1] Notify if non-admins use admin commands
//If warn_not_authorized is set to 1, notify_not_authorized also needs to be 1!
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Wink Plugin with !ban !kick and !tampban clemi555 3 6,492 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 7,592 11-08-2013, 19:13
Last Post: clemi555
  [Release] Bunker Plugin 1.3 archit 68 55,806 10-30-2013, 11:59
Last Post: clacki
  Help Modifying plugin maverigh 5 7,643 10-19-2013, 10:29
Last Post: Nekochan
Shocked [Request] Switch plugin axel-le-meilleur 6 8,295 10-19-2013, 06:59
Last Post: iRoNinja
  [Release] Yurio Map Plugin Yurio 101 82,113 09-26-2013, 13:38
Last Post: First_Semyon
Brick [Release] v1.1 ChangeMap/NextMap Plugin without any configuration milchshake 23 25,160 09-23-2013, 13:18
Last Post: SgtLegend
  Help !say Plugin (like the !say from GodPlugin) Hallla 0 3,655 09-13-2013, 09:31
Last Post: Hallla
Rainbow [Release] MW3: Random Weapon Plugin V1 Nekochan 50 44,653 09-11-2013, 15:11
Last Post: EnVi Sweden Rocks
  Search Plugin Fluid Killcam N3xT_974 1 3,975 09-10-2013, 20:27
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.