-
Notifications
You must be signed in to change notification settings - Fork 8
/
UServer.Banning.pas
69 lines (56 loc) · 1.42 KB
/
UServer.Banning.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
unit UServer.Banning;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls,
HGM.Controls.SpinEdit;
type
TFormBan = class(TForm)
Label1: TLabel;
Label2: TLabel;
SpinEditDays: TlkSpinEdit;
SpinEditHours: TlkSpinEdit;
SpinEditMins: TlkSpinEdit;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Panel1: TPanel;
ButtonCancel: TButton;
ButtonOK: TButton;
EditReason: TComboBox;
procedure ButtonOKClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormBan: TFormBan;
implementation
{$R *.dfm}
procedure TFormBan.ButtonOKClick(Sender: TObject);
begin
if SpinEditDays.Value + SpinEditHours.Value + SpinEditMins.Value <= 0 then
begin
MessageBox(Handle, 'Íåëüçÿ çàáàíèòü èãðîêà íà 0 ìèíóò!', 'Ïðîâåðêà', MB_ICONWARNING or MB_OK or MB_DEFBUTTON1);
Exit;
end;
ModalResult:=mrOk;
end;
procedure TFormBan.FormCreate(Sender: TObject);
var D, H, M, Lost:Cardinal;
begin
Lost:=7;
D:=Lost div SecsPerDay;
Lost:=Lost - D * SecsPerDay;
H:=Lost div SecsPerHour;
Lost:=Lost - H * SecsPerHour;
M:=Lost div SecsPerMin;
Lost:=Lost - M * SecsPerMin;
if Lost > 0 then Inc(M);
SpinEditDays.Value:=D;
SpinEditHours.Value:=H;
SpinEditMins.Value:=M;
end;
end.