Fixed undefined player issue at connection

This commit is contained in:
Timo Smit 2017-01-16 17:36:57 +01:00
parent 0001bc7a12
commit 7620862fc1

View file

@ -73,11 +73,15 @@ function admin.onconnect(clientId, firstTime, isBot)
stats.set(clientId, "namechangePts", 0) ]] stats.set(clientId, "namechangePts", 0) ]]
local guid = et.Info_ValueForKey(et.trap_GetUserinfo(clientId), "cl_guid") local guid = et.Info_ValueForKey(et.trap_GetUserinfo(clientId), "cl_guid")
local playerId = db.getplayer(guid)["id"] local player = db.getplayer(guid)
local mute = db.getMuteByPlayer(playerId)
if mute then if player then
players.setMuted(clientId, true, mute["type"], mute["issued"], mute["expires"]) local playerId = player["id"]
local mute = db.getMuteByPlayer(playerId)
if mute then
players.setMuted(clientId, true, mute["type"], mute["issued"], mute["expires"])
end
end end
end end
events.handle("onClientConnect", admin.onconnect) events.handle("onClientConnect", admin.onconnect)