mirror of
https://github.com/gmod-integration/lua.git
synced 2025-03-15 17:17:33 +00:00
edit: net Names
This commit is contained in:
parent
c38c473762
commit
4219ebcf12
|
@ -1,5 +1,5 @@
|
|||
local function saveConfig(setting, value)
|
||||
gmInte.SendNet(3, {
|
||||
gmInte.SendNet("saveConfig", {
|
||||
[setting] = value
|
||||
})
|
||||
end
|
||||
|
@ -223,7 +223,7 @@ local buttonsInfo = {
|
|||
{
|
||||
["label"] = "Test Connection",
|
||||
["func"] = function()
|
||||
gmInte.SendNet(1)
|
||||
gmInte.SendNet("testConnection")
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ function gmInte.needRestart()
|
|||
button:SetText("Restart")
|
||||
button.DoClick = function()
|
||||
frame:Close()
|
||||
gmInte.SendNet(5)
|
||||
gmInte.SendNet("restartMap")
|
||||
end
|
||||
button:SetSize(buttonGrid:GetColWide(), buttonGrid:GetRowHeight())
|
||||
buttonGrid:AddItem(button)
|
||||
|
|
|
@ -45,7 +45,7 @@ function gmInte.openVerifPopup()
|
|||
button:SetText("Refresh Verification")
|
||||
button.DoClick = function()
|
||||
gmInte.http.get("/players/" .. LocalPlayer():SteamID64(), function(code, body)
|
||||
gmInte.SendNet(6)
|
||||
gmInte.SendNet("verifyMe")
|
||||
frame:Close()
|
||||
end,
|
||||
function(err)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// Player Finish Init
|
||||
hook.Add("InitPostEntity", "gmInte:Ply:Ready", function()
|
||||
gmInte.SendNet(0)
|
||||
gmInte.SendNet("ready")
|
||||
end)
|
||||
|
||||
hook.Add("OnPlayerChat", "gmInte:OnPlayerChat:AdminCmd", function(ply, strText, bTeamOnly, bPlayerIsDead)
|
||||
|
|
|
@ -39,7 +39,7 @@ function gmInte.openAdminConfig()
|
|||
return
|
||||
end
|
||||
|
||||
gmInte.SendNet(2)
|
||||
gmInte.SendNet("getConfig")
|
||||
end
|
||||
|
||||
//
|
||||
|
|
|
@ -1,36 +1,31 @@
|
|||
//
|
||||
// Network
|
||||
// Send Net
|
||||
//
|
||||
|
||||
/*
|
||||
Upload
|
||||
0 - Say I'm ready
|
||||
1 - Test Connection
|
||||
2 - Get Config
|
||||
3 - Save Config
|
||||
4 - Take ScreenShot
|
||||
5 - Restart Map
|
||||
6 - Verify Me
|
||||
Receive
|
||||
1 - Sync Chat
|
||||
2 - Get Config
|
||||
3 - Test Connection
|
||||
4 - Take ScreenShot
|
||||
5 - Set Public Config
|
||||
6 - Add Chat
|
||||
7 - Open Verif Popup
|
||||
*/
|
||||
local netList = {
|
||||
["ready"] = 0,
|
||||
["testConnection"] = 1,
|
||||
["getConfig"] = 2,
|
||||
["saveConfig"] = 3,
|
||||
["takeScreenShot"] = 4,
|
||||
["restartMap"] = 5,
|
||||
["verifyMe"] = 6,
|
||||
["getSingleUseToken"] = 7,
|
||||
["getMultiUseToken"] = 8
|
||||
}
|
||||
|
||||
// Send
|
||||
function gmInte.SendNet(id, args, func)
|
||||
net.Start("gmIntegration")
|
||||
net.WriteUInt(id, 8)
|
||||
net.WriteUInt(netList[id], 8)
|
||||
net.WriteString(util.TableToJSON(args || {}))
|
||||
if (func) then func() end
|
||||
net.SendToServer()
|
||||
end
|
||||
|
||||
// Receive
|
||||
//
|
||||
// Receive Net
|
||||
//
|
||||
|
||||
local netFunc = {
|
||||
[1] = function(data)
|
||||
gmInte.discordSyncChatPly(data)
|
||||
|
@ -52,6 +47,12 @@ local netFunc = {
|
|||
end,
|
||||
[7] = function()
|
||||
gmInte.openVerifPopup()
|
||||
end,
|
||||
[8] = function(data)
|
||||
gmInte.singleUseToken(data)
|
||||
end,
|
||||
[9] = function(data)
|
||||
gmInte.multiUseToken(data)
|
||||
end
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ end
|
|||
//
|
||||
|
||||
concommand.Add("gmod_integration_screenshot", function()
|
||||
gmInte.SendNet(4)
|
||||
gmInte.SendNet("takeScreenShot")
|
||||
end)
|
||||
|
||||
//
|
||||
|
@ -69,6 +69,6 @@ hook.Add("OnPlayerChat", "gmInteChatCommands", function(ply, text, teamChat, isD
|
|||
text = string.sub(text, 2)
|
||||
|
||||
if (text == "screen") then
|
||||
gmInte.SendNet(4)
|
||||
gmInte.SendNet("takeScreenShot")
|
||||
end
|
||||
end)
|
Loading…
Reference in New Issue
Block a user