mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 22:07:34 +00:00
add: sync kick
This commit is contained in:
parent
c202329f11
commit
7f8e81c909
32
lua/gmod_integration/server/sv_sync_kicks.lua
Normal file
32
lua/gmod_integration/server/sv_sync_kicks.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// Websocket
|
||||||
|
//
|
||||||
|
|
||||||
|
function gmInte.wsSyncKick(data)
|
||||||
|
for _, ply in ipairs(player.GetAll()) do
|
||||||
|
if (ply:SteamID64() == data.steam) then
|
||||||
|
ply:Kick(data.reason || "You have been banned from the server.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
//
|
||||||
|
// Methods
|
||||||
|
//
|
||||||
|
|
||||||
|
function gmInte.playerKick(data)
|
||||||
|
if (data.reason != "Kicked by console" || data.reason != "No reason given") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
gmInte.http.post("/players/" .. util.SteamIDTo64(data.networkid) .. "/kick", data)
|
||||||
|
end
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hooks
|
||||||
|
//
|
||||||
|
|
||||||
|
gameevent.Listen("player_disconnect")
|
||||||
|
hook.Add("player_disconnect", "gmInte:SyncKick:Disconnect", function(data)
|
||||||
|
gmInte.playerKick(data)
|
||||||
|
end)
|
Loading…
Reference in New Issue
Block a user