summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--world/map/conf/permissions.txt1
-rw-r--r--world/map/db/params.txt4
-rw-r--r--world/map/npc/commands/_import.txt1
-rw-r--r--world/map/npc/commands/mute.txt60
4 files changed, 66 insertions, 0 deletions
diff --git a/world/map/conf/permissions.txt b/world/map/conf/permissions.txt
index 7215942c..812c3848 100644
--- a/world/map/conf/permissions.txt
+++ b/world/map/conf/permissions.txt
@@ -10,6 +10,7 @@ CMD_DESTROYNPC 99
CMD_REMOTECMD 40
CMD_WARP 40
CMD_CHARWARP 60
+CMD_MUTE 60
// special permissions below
MAP_LOUNGE 20 // level to enter the GM Lounge & talk to Numa
diff --git a/world/map/db/params.txt b/world/map/db/params.txt
index 66a5f1bb..cc0ac377 100644
--- a/world/map/db/params.txt
+++ b/world/map/db/params.txt
@@ -54,3 +54,7 @@ BL_TYPE 1078 1
CHAR_ID 1079 1
INVISIBLE 1080 1
HIDDEN 1081 1
+MUTE_GLOBAL 1082 1
+MUTE_WHISPER 1083 1
+MUTE_PARTY 1084 1
+//MUTE_GUILD 1085 1
diff --git a/world/map/npc/commands/_import.txt b/world/map/npc/commands/_import.txt
index 1362d66d..4585c052 100644
--- a/world/map/npc/commands/_import.txt
+++ b/world/map/npc/commands/_import.txt
@@ -10,3 +10,4 @@ npc: npc/commands/destroynpc.txt
npc: npc/commands/remotecmd.txt
npc: npc/commands/hug.txt
npc: npc/commands/warp.txt
+npc: npc/commands/mute.txt
diff --git a/world/map/npc/commands/mute.txt b/world/map/npc/commands/mute.txt
new file mode 100644
index 00000000..6b6ea4d9
--- /dev/null
+++ b/world/map/npc/commands/mute.txt
@@ -0,0 +1,60 @@
+-|script|@mute|32767
+{
+ callfunc "argv_splitter";
+ if (GM < CMD_MUTE && GM < G_SYSOP) goto L_GM;
+ if (@argv$[1] == "") goto L_Failed;
+
+ set .@target_id, getcharid(3, @argv$[1]);
+ if (.@target_id < 1 || !(isloggedin(.@target_id))) goto L_Failed;
+
+ if (@argv[0] > 120)
+ set @argv[0], 120; // max 2 hours
+
+ gmlog "@mute " + @args$;
+ if (@argv[0] == 0) goto L_UnMute;
+
+ message strcharinfo(0, .@target_id), "Server : ##BYou have been muted by a GM for "+@argv[0]+" minutes.";
+ set MUTE_GLOBAL, 1, .@target_id;
+ set #MUTE_UNTIL, (gettimetick(2) + (@argv[0] * 60)), .@target_id;
+ addtimer (@argv[0] * 60000) + 100, strnpcinfo(0) + "::OnCheckMute", .@target_id;
+ message strcharinfo(0), "mute : Player `"+strcharinfo(0, .@target_id)+"` has been muted for "+@argv[0]+" minutes.";
+ end;
+
+OnPCLoginEvent:
+ if (#MUTE_UNTIL < 1) end;
+ set .@s, (#MUTE_UNTIL - gettimetick(2));
+ set .@m, .@s / 60;
+ message strcharinfo(0), "Server : ##BYou have been muted for "+ max(1, .@m) +" minutes.";
+ set MUTE_GLOBAL, 1;
+ addtimer (.@s * 1000) + 100, strnpcinfo(0) + "::OnCheckMute";
+ end;
+
+OnCheckMute:
+ if (#MUTE_UNTIL < 1) end;
+ if (gettimetick(2) - #MUTE_UNTIL < 0) end;
+ message strcharinfo(0), "Server : ##BYou have been automatically unmuted.";
+ wgm "=> Player `"+ strcharinfo(0) +"` has been automatically unmuted.";
+ set MUTE_GLOBAL, 0;
+ set #MUTE_UNTIL, 0;
+ end;
+
+L_UnMute:
+ if (get(MUTE_GLOBAL, .@target_id))
+ message strcharinfo(0, .@target_id), "Server : ##BYou have been unmuted by a GM.";
+ set MUTE_GLOBAL, 0, .@target_id;
+ set #MUTE_UNTIL, 0, .@target_id;
+ message strcharinfo(0), "mute : Player `"+strcharinfo(0, .@target_id)+"` has been unmuted.";
+ end;
+
+L_Failed:
+ message strcharinfo(0), "mute : Impossible to attach to the target player. Did you try putting the name in \"quotation marks\"?";
+ end;
+
+L_GM:
+ message strcharinfo(0), "mute : GM command is level "+ CMD_MUTE +", but you are level " + GM;
+ end;
+
+OnInit:
+ registercmd chr(ATCMD_SYMBOL) + "mute", strnpcinfo(0);
+ end;
+}