31
31
* Version: $Id$
32
32
*/
33
33
34
- void PrepareBan (int client , int target , int time , const char [] reason )
34
+ void PrepareBan (int adminClient , int banTargetUserId , int time , const char [] reason )
35
35
{
36
- int originalTarget = GetClientOfUserId (playerinfo [client ].banTargetUserId );
37
-
38
- if (originalTarget != target )
36
+ if (adminClient == 0 )
39
37
{
40
- if (client == 0 )
41
- {
42
- PrintToServer (" [SM] %t " , " Player no longer available" );
43
- }
44
- else
45
- {
46
- PrintToChat (client , " [SM] %t " , " Player no longer available" );
47
- }
38
+ PrintToServer (" [SM] %t " , " Player no longer available" );
39
+ return ;
40
+ }
48
41
42
+ int target = GetClientOfUserId (banTargetUserId );
43
+ if (target == 0 )
44
+ {
45
+ PrintToServer (" [SM] %t " , " Player no longer available" );
49
46
return ;
50
47
}
51
48
@@ -56,34 +53,34 @@ void PrepareBan(int client, int target, int time, const char[] reason)
56
53
{
57
54
if (reason [0 ] == ' \0 ' )
58
55
{
59
- ShowActivity (client , " %t " , " Permabanned player" , name );
56
+ ShowActivity (adminClient , " %t " , " Permabanned player" , name );
60
57
}
61
58
else
62
59
{
63
- ShowActivity (client , " %t " , " Permabanned player reason" , name , reason );
60
+ ShowActivity (adminClient , " %t " , " Permabanned player reason" , name , reason );
64
61
}
65
62
}
66
63
else
67
64
{
68
65
if (reason [0 ] == ' \0 ' )
69
66
{
70
- ShowActivity (client , " %t " , " Banned player" , name , time );
67
+ ShowActivity (adminClient , " %t " , " Banned player" , name , time );
71
68
}
72
69
else
73
70
{
74
- ShowActivity (client , " %t " , " Banned player reason" , name , time , reason );
71
+ ShowActivity (adminClient , " %t " , " Banned player reason" , name , time , reason );
75
72
}
76
73
}
77
74
78
- LogAction (client , target , " \" %L \" banned \" %L \" (minutes \" %d \" ) (reason \" %s \" )" , client , target , time , reason );
75
+ LogAction (adminClient , target , " \" %L \" banned \" %L \" (minutes \" %d \" ) (reason \" %s \" )" , adminClient , target , time , reason );
79
76
80
77
if (reason [0 ] == ' \0 ' )
81
78
{
82
- BanClient (target , time , BANFLAG_AUTO , " Banned" , " Banned" , " sm_ban" , client );
79
+ BanClient (target , time , BANFLAG_AUTO , " Banned" , " Banned" , " sm_ban" , adminClient );
83
80
}
84
81
else
85
82
{
86
- BanClient (target , time , BANFLAG_AUTO , reason , reason , " sm_ban" , client );
83
+ BanClient (target , time , BANFLAG_AUTO , reason , reason , " sm_ban" , adminClient );
87
84
}
88
85
}
89
86
@@ -103,10 +100,17 @@ void DisplayBanTargetMenu(int client)
103
100
104
101
void DisplayBanTimeMenu (int client )
105
102
{
103
+ int target = GetClientOfUserId (playerinfo [client ].banTargetUserId );
104
+ if (target == 0 )
105
+ {
106
+ PrintToChat (client , " [SM] %t " , " Player no longer available" );
107
+ return ;
108
+ }
109
+
106
110
Menu menu = new Menu (MenuHandler_BanTimeList );
107
111
108
112
char title [100 ];
109
- Format (title , sizeof (title ), " %T : %N " , " Ban player" , client , playerinfo [ client ]. banTarget );
113
+ Format (title , sizeof (title ), " %T : %N " , " Ban player" , client , target );
110
114
menu .SetTitle (title );
111
115
menu .ExitBackButton = true ;
112
116
@@ -123,10 +127,17 @@ void DisplayBanTimeMenu(int client)
123
127
124
128
void DisplayBanReasonMenu (int client )
125
129
{
130
+ int target = GetClientOfUserId (playerinfo [client ].banTargetUserId );
131
+ if (target == 0 )
132
+ {
133
+ PrintToChat (client , " [SM] %t " , " Player no longer available" );
134
+ return ;
135
+ }
136
+
126
137
Menu menu = new Menu (MenuHandler_BanReasonList );
127
138
128
139
char title [100 ];
129
- Format (title , sizeof (title ), " %T : %N " , " Ban reason" , client , playerinfo [ client ]. banTarget );
140
+ Format (title , sizeof (title ), " %T : %N " , " Ban reason" , client , target );
130
141
menu .SetTitle (title );
131
142
menu .ExitBackButton = true ;
132
143
@@ -201,8 +212,8 @@ public int MenuHandler_BanReasonList(Menu menu, MenuAction action, int param1, i
201
212
char info [64 ];
202
213
203
214
menu .GetItem (param2 , info , sizeof (info ));
204
-
205
- PrepareBan (param1 , playerinfo [param1 ].banTarget , playerinfo [param1 ].banTime , info );
215
+
216
+ PrepareBan (param1 , playerinfo [param1 ].banTargetUserId , playerinfo [param1 ].banTime , info );
206
217
}
207
218
}
208
219
@@ -240,7 +251,6 @@ public int MenuHandler_BanPlayerList(Menu menu, MenuAction action, int param1, i
240
251
}
241
252
else
242
253
{
243
- playerinfo [param1 ].banTarget = target ;
244
254
playerinfo [param1 ].banTargetUserId = userid ;
245
255
DisplayBanTimeMenu (param1 );
246
256
}
@@ -264,12 +274,19 @@ public int MenuHandler_BanTimeList(Menu menu, MenuAction action, int param1, int
264
274
}
265
275
else if (action == MenuAction_Select )
266
276
{
267
- char info [32 ];
277
+ if (GetClientOfUserId (playerinfo [param1 ].banTargetUserId ) == 0 )
278
+ {
279
+ PrintToChat (param1 , " [SM] %t " , " Player no longer available" );
280
+ }
281
+ else
282
+ {
283
+ char info [32 ];
268
284
269
- menu .GetItem (param2 , info , sizeof (info ));
270
- playerinfo [param1 ].banTime = StringToInt (info );
285
+ menu .GetItem (param2 , info , sizeof (info ));
286
+ playerinfo [param1 ].banTime = StringToInt (info );
271
287
272
- DisplayBanReasonMenu (param1 );
288
+ DisplayBanReasonMenu (param1 );
289
+ }
273
290
}
274
291
275
292
return 0 ;
@@ -318,7 +335,7 @@ public Action Command_Ban(int client, int args)
318
335
playerinfo [client ].banTargetUserId = GetClientUserId (target );
319
336
320
337
int time = StringToInt (s_time );
321
- PrepareBan (client , target , time , Arguments [len ]);
338
+ PrepareBan (client , playerinfo [ client ]. banTargetUserId , time , Arguments [len ]);
322
339
323
340
return Plugin_Handled ;
324
341
}
0 commit comments