Skip to content

Commit 0eebbf6

Browse files
committed
admin2: Fix some whowas mistakes
1 parent f17a4a9 commit 0eebbf6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

[admin]/admin2/server/admin_whowas.lua

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ addEventHandler("onPlayerChangeNick", root, function(old, name)
3131
return true
3232
end
3333
end
34-
local acc = getPlayerAccount(plr)
34+
local acc = getPlayerAccount(source)
3535
if isGuestAccount(acc) then
3636
acc = nil
3737
else
@@ -49,7 +49,7 @@ function cmdWhoWas(plr, cmd, name)
4949
outputChatBox("Players who had "..name.." in their name/serial/account/IP:", plr, 0, 255, 0)
5050
for i, data in pairs(info) do
5151
if string.find(data[1], name, 1, true) or string.find(data[2], name, 1, true) or string.find(data[3], name, 1, true) or string.find(data[4], name, 1, true) then
52-
outputChatBox(data[1].." #F7FF00"..data[2].." #FDC11C"..data[3].." #FD581C"..data[4], plr, 0, 255, 0, true)
52+
outputChatBox(data[1].." #F7FF00"..data[2].." #FDC11C"..(data[3] or "guest").." #FD581C"..data[4], plr, 0, 255, 0, true)
5353
found = found + 1
5454
if (found > 100) then
5555
outputChatBox("Reached limit of 100 returns, refine your search.", plr, 0, 255, 0, true)
@@ -80,7 +80,6 @@ for i, plr in pairs(getElementsByType("player")) do
8080
end
8181
end
8282

83-
local function onStop()
83+
addEventHandler("onResourceStop", resourceRoot, function()
8484
setElementData(root, "WhoWas", info, false) -- This preserves whowas data from resource restarts.
85-
end
86-
addEventHandler("onResourceStop", resourceRoot, onStop)
85+
end)

0 commit comments

Comments
 (0)