Greetings;
I’ve had this running debate as to which is more reliable in preventing “sus” players from joining my server. I could be wrong but, I put a little segment of code in [system]/hardcap/server.lua that looks like this;
local playerCount = 0
local list = {}
RegisterServerEvent(‘hardcap:playerActivated’)
AddEventHandler(‘hardcap:playerActivated’, function()
if not list[source] then
playerCount = playerCount + 1
list[source] = true
end
end)
AddEventHandler(‘playerDropped’, function()
if list[source] then
playerCount = playerCount - 1
list[source] = nil
end
end)
AddEventHandler(‘playerConnecting’, function(name, setReason)
local player = source
local steamIdentifier
local identifiers = GetPlayerIdentifiers(player)
local setKickReason = setReason
local cv = GetConvarInt(‘sv_maxclients’, 64)
for _, v in pairs(identifiers) do
if string.find(v, “steam”) then
steamIdentifier = v
print('Connecting: ’ … name … ’ ’ … steamIdentifier … ‘^7’)
break
end
end
if not steamIdentifier then
CancelEvent()
setKickReason(“Get Steam, please”)
print('No Steam: ’ … name … ‘^7’)
end
if playerCount >= cv then
print(‘Full. :(’)
setReason(‘This server is full (past ’ … tostring(cv) … ’ players).’)
CancelEvent()
end
end)
Naturally, I receive all manner of nasty feedback about, “you don’t have to have to Steam to play Fivem, yada, yada, yada…” but, it seems pretty effective. I am hoping to convert the Steam identifier into HEX and running it against http://www.vacbanned.com/ to see if the person has ever been banned.
What I would like is some feedback from other server owners to see what they think. I’ve already had my share of clowns logging on and running every manner of SQLi you can think of. I’ve been lucky thus far.
Is there a better approach I should consider?
Cheers