@@ -21,12 +21,11 @@ function aBansTab.Create(tab)
21
21
guiGridListAddColumn (aBansTab .BansList , " Name" , 0.22 )
22
22
guiGridListAddColumn (aBansTab .BansList , " IP" , 0.25 )
23
23
guiGridListAddColumn (aBansTab .BansList , " Serial" , 0.25 )
24
- guiGridListAddColumn (aBansTab .BansList , " Username" , 0.25 )
25
- guiGridListAddColumn (aBansTab .BansList , " Date" , 0.17 )
24
+ guiGridListAddColumn (aBansTab .BansList , " Expires" , 0.17 )
26
25
guiGridListAddColumn (aBansTab .BansList , " Banned by" , 0.22 )
27
- guiGridListAddColumn (aBansTab .BansList , " Temporary" , 0.22 )
28
26
aBansTab .Details = guiCreateButton (0.82 , 0.07 , 0.17 , 0.04 , " Details" , true , aBansTab .Tab )
29
- aBansTab .Unban = guiCreateButton (0.82 , 0.12 , 0.17 , 0.04 , " Unban" , true , aBansTab .Tab , " unban" )
27
+ aBansTab .Ban = guiCreateButton (0.82 , 0.12 , 0.17 , 0.04 , " Add ban" , true , aBansTab .Tab , " ban" )
28
+ aBansTab .Unban = guiCreateButton (0.82 , 0.17 , 0.17 , 0.04 , " Unban" , true , aBansTab .Tab , " unban" )
30
29
aBansTab .BansRefresh = guiCreateButton (0.82 , 0.94 , 0.17 , 0.04 , " Refresh" , true , aBansTab .Tab , " listbans" )
31
30
32
31
addEventHandler (" onClientGUIChanged" , aBansTab .BansListSearch , aBansTab .onBansListSearch )
@@ -41,26 +40,21 @@ function aBansTab.onClientClick(button)
41
40
if (button == " left" ) then
42
41
if (source == aBansTab .Details ) then
43
42
if (guiGridListGetSelectedItem (aBansTab .BansList ) == - 1 ) then
44
- messageBox (" No ban row selected!" , MB_ERROR , MB_OK )
43
+ messageBox (" No ban selected!" , MB_ERROR , MB_OK )
45
44
else
46
- local ip = guiGridListGetItemText (aBansTab .BansList , guiGridListGetSelectedItem (aBansTab .BansList ), 2 )
47
- aBanDetails (ip )
45
+ local banID =
46
+ guiGridListGetItemData (aBansTab .BansList , guiGridListGetSelectedItem (aBansTab .BansList ), 1 )
47
+ aBanDetails .Show (banID , false )
48
48
end
49
+ elseif source == aBansTab .Ban then
50
+ aBan .Show ()
49
51
elseif (source == aBansTab .Unban ) then
50
52
if (guiGridListGetSelectedItem (aBansTab .BansList ) == - 1 ) then
51
- messageBox (" No ban row selected!" , MB_ERROR , MB_OK )
53
+ messageBox (" No ban selected!" , MB_ERROR , MB_OK )
52
54
else
53
- local selected =
54
- guiGridListGetItemText (aBansTab .BansList , guiGridListGetSelectedItem (aBansTab .BansList ), 2 )
55
- if (aBans [" Serial" ][selected ]) then
56
- if (messageBox (" Unban Serial " .. selected .. " ?" , MB_QUESTION , MB_YESNO ) == true ) then
57
- triggerServerEvent ( " aBans" , localPlayer , " unbanserial" , selected )
58
- end
59
- else
60
- if (messageBox (" Unban IP " .. selected .. " ?" , MB_QUESTION , MB_YESNO ) == true ) then
61
- triggerServerEvent ( " aBans" , localPlayer , " unbanip" , selected )
62
- end
63
- end
55
+ local banID =
56
+ guiGridListGetItemData (aBansTab .BansList , guiGridListGetSelectedItem (aBansTab .BansList ), 1 )
57
+ aBanDetails .Show (banID , true )
64
58
end
65
59
elseif (source == aBansTab .BansRefresh ) then
66
60
guiGridListClear (aBansTab .BansList )
@@ -80,7 +74,6 @@ function aBansTab.onBansListSearch()
80
74
((ban .nick and string.find (string.upper (ban .nick ), text )) or
81
75
(ban .ip and string.find (string.upper (ban .ip ), text )) or
82
76
(ban .serial and string.find (string.upper (ban .serial ), text )) or
83
- (ban .username and string.find (string.upper (ban .username ), text )) or
84
77
(ban .banner and string.find (string.upper (ban .banner ), text )))
85
78
then
86
79
aBansTab .AddRow (id , ban )
@@ -117,29 +110,20 @@ function aBansTab.AddRow(id, data)
117
110
guiGridListSetItemText (list , row , 1 , data .nick or " Unknown" , false , false )
118
111
guiGridListSetItemText (list , row , 2 , data .ip or " " , false , false )
119
112
guiGridListSetItemText (list , row , 3 , data .serial or " " , false , false )
120
- guiGridListSetItemText (list , row , 4 , data .username or " " , false , false )
121
- if (data .time ) then
122
- local time = getRealTime (data .time )
123
- guiGridListSetItemText (
124
- list ,
125
- row ,
126
- 5 ,
127
- time .monthday .. " " .. getMonthName (time .month ) .. " " .. (1900 + time .year ),
128
- false ,
129
- false
130
- )
113
+ if (data .unban ) then
114
+ guiGridListSetItemText (list , row , 4 , formatDate (" m/d/y h:m" , nil , data .unban ), false , false )
131
115
else
132
- guiGridListSetItemText (list , row , 5 , " " , false , false )
116
+ guiGridListSetItemText (list , row , 4 , " Never " , false , false )
133
117
end
134
- guiGridListSetItemText (list , row , 6 , data .banner or " " , false , false )
135
- guiGridListSetItemText (list , row , 7 , iif (data .unban , " Yes" , " No" ), false , false )
118
+ guiGridListSetItemText (list , row , 5 , data .banner or " " , false , false )
136
119
137
120
guiGridListSetItemData (list , row , 1 , id )
138
121
end
139
122
140
123
function aBansTab .DeleteRow (id )
141
124
local list = aBansTab .BansList
142
- for i = 1 , guiGridListGetRowCount (list ) do
125
+ -- GridList row ids start at zero, not one
126
+ for i = 0 , guiGridListGetRowCount (list ) do
143
127
local data = guiGridListGetItemData (list , i , 1 )
144
128
if (data == id ) then
145
129
guiGridListRemoveRow (list , i )
0 commit comments