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