@@ -74,13 +74,13 @@ local formatTime = function(time)
74
74
if time :find (' P' ) then
75
75
banTime = os.time () + (60 * 60 * 24 * 7 * 52 * 100 )
76
76
elseif time :find (' M' ) then
77
- banTime = os.time () + (60 * MSK .Split (time , ' M' )[1 ])
77
+ banTime = os.time () + (60 * MSK .String . Split (time , ' M' )[1 ])
78
78
elseif time :find (' H' ) then
79
- banTime = os.time () + (60 * 60 * MSK .Split (time , ' H' )[1 ])
79
+ banTime = os.time () + (60 * 60 * MSK .String . Split (time , ' H' )[1 ])
80
80
elseif time :find (' D' ) then
81
- banTime = os.time () + (60 * 60 * 24 * MSK .Split (time , ' D' )[1 ])
81
+ banTime = os.time () + (60 * 60 * 24 * MSK .String . Split (time , ' D' )[1 ])
82
82
elseif time :find (' W' ) then
83
- banTime = os.time () + (60 * 60 * 24 * 7 * MSK .Split (time , ' W' )[1 ])
83
+ banTime = os.time () + (60 * 60 * 24 * 7 * MSK .String . Split (time , ' W' )[1 ])
84
84
end
85
85
86
86
return banTime , os.date (' %d-%m-%Y %H:%M' , banTime )
@@ -230,50 +230,34 @@ exports('UnbanPlayer', MSK.UnbanPlayer)
230
230
exports (' unbanPlayer' , MSK .UnbanPlayer ) -- Support for old Scripts
231
231
232
232
if Config .BanSystem .enable and Config .BanSystem .commands .enable then
233
- for i = 1 , # Config .BanSystem .commands .groups do
234
- local group = Config .BanSystem .commands .groups [i ]
235
- ExecuteCommand ((' add_ace group.%s command.%s allow' ):format (group , Config .BanSystem .commands .ban ))
236
- ExecuteCommand ((' add_ace group.%s command.%s allow' ):format (group , Config .BanSystem .commands .unban ))
237
- end
238
-
239
- local IsPlayerAllowed = function (playerId , command )
240
- return IsPlayerAceAllowed (playerId , (' command.%s' ):format (command ))
241
- end
242
-
243
- RegisterCommand (Config .BanSystem .commands .ban , function (source , args , raw )
233
+ MSK .RegisterCommand (Config .BanSystem .commands .ban , function (source , args , raw )
244
234
local playerId = source
245
- local targetId , time , reason = args [1 ], args [2 ], args [3 ]
246
-
247
- if not targetId or not time then return end
248
- if not reason then reason = ' Unknown' end
235
+ local targetId , time , reason = args .playerId , args .time , args .reason ,
249
236
250
- if playerId == 0 then
251
- MSK .BanPlayer (nil , targetId , time , reason )
252
- return
237
+ if not reason then
238
+ reason = ' Unknown reason'
253
239
end
254
240
255
- if IsPlayerAllowed (playerId , Config .BanSystem .commands .ban ) then
256
- MSK .BanPlayer (playerId , targetId , time , reason )
257
- else
258
- MSK .Notification (playerId , ' MSK Bansystem' , ' You don\' t have permission to do that!' )
259
- end
260
- end )
261
-
262
- RegisterCommand (Config .BanSystem .commands .unban , function (source , args , raw )
263
- local playerId = source
264
- local banId = args [1 ]
265
-
266
- if not banId then return end
267
-
268
- if playerId == 0 then
269
- MSK .UnbanPlayer (nil , banId )
270
- return
271
- end
272
-
273
- if IsPlayerAllowed (playerId , Config .BanSystem .commands .unban ) then
274
- MSK .UnbanPlayer (playerId , banId )
275
- else
276
- MSK .Notification (playerId , ' MSK Bansystem' , ' You don\' t have permission to do that!' )
277
- end
278
- end )
241
+ MSK .BanPlayer (playerId , targetId , time , reason )
242
+ end , {
243
+ allowConsole = true ,
244
+ restricted = Config .BanSystem .commands .groups ,
245
+ help = ' Ban a Player' ,
246
+ params = {
247
+ {name = " playerId" , type = ' playerId' , help = " Target players server id" },
248
+ {name = " time" , type = ' string' , help = " 1M = 1 Minute / 1H = 1 Hour / 1D = 1 Day / 1W = 1 Week / P = Permanent" },
249
+ {name = " reason" , type = ' string' , help = " Ban Reason" , optional = true },
250
+ }
251
+ })
252
+
253
+ MSK .RegisterCommand (Config .BanSystem .commands .unban , function (source , args , raw )
254
+ MSK .UnbanPlayer (source , args .banId )
255
+ end , {
256
+ allowConsole = true ,
257
+ restricted = Config .BanSystem .commands .groups ,
258
+ help = ' Unban a Player' ,
259
+ params = {
260
+ {name = ' banId' , type = ' number' , help = ' Banned players BanId' }
261
+ }
262
+ })
279
263
end
0 commit comments