Skip to content

Instantly share code, notes, and snippets.

@firecatmusic
Created January 3, 2023 08:17
Show Gist options
  • Save firecatmusic/1cbddedec1c13bd2ecc4efc4438524b4 to your computer and use it in GitHub Desktop.
Save firecatmusic/1cbddedec1c13bd2ecc4efc4438524b4 to your computer and use it in GitHub Desktop.
a simple lua auto accept invite party for gamesense.pub
local panorama = panorama.open()
local partyBrowserApi = panorama.PartyBrowserAPI
local gameApi = panorama.GameStateAPI
local competitiveMatchApi = panorama.CompetitiveMatchAPI
local partyListApi = panorama.PartyListAPI
local friendsListApi = panorama.FriendsListAPI
local lobbyApi = panorama.LobbyAPI
local labelStart = ui.new_label("LUA", "B", "----------- Derank -----------")
local autoAcceptFromCode = ui.new_checkbox("LUA", "B", "Auto Accept From Code")
-- local autoInvite = ui.new_checkbox("LUA", "B", "Auto Invite")
-- local enable_button = ui.new_button("LUA", "B", "Invite All", function()
-- client.log("Started")
-- if not competitiveMatchApi.HasOngoingMatch() then
-- if gameApi.IsConnectedOrConnectingToServer() then
-- client.delay_call(1, function()
-- client.exec("disconnect")
-- end)
-- end
-- end
-- end)
local labelEnd = ui.new_label("LUA", "B", "----------- Derank -----------")
local code1 = friendsListApi.GetXuidFromFriendCode("")
local code2 = friendsListApi.GetXuidFromFriendCode("")
local code3 = friendsListApi.GetXuidFromFriendCode("")
local code4 = friendsListApi.GetXuidFromFriendCode("")
client.set_event_callback("paint_ui", function()
if ( ui.get(autoAcceptFromCode) == true ) then
if not competitiveMatchApi.HasOngoingMatch() then
for i = 1, partyBrowserApi.GetInvitesCount() do
local lobby_id = partyBrowserApi.GetInviteXuidByIndex(i-1)
print("inviter: " .. partyBrowserApi.GetPartyMemberXuid(lobby_id, 0))
print("code1: " .. code1)
print("code2: " .. code2)
print("code3: " .. code3)
print("code4: " .. code4)
print(partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code1 or
partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code2 or
partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code3 or
partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code4
)
if gameApi.IsConnectedOrConnectingToServer() then
client.delay_call(1, function()
client.exec("disconnect")
end)
end
if partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code1 or
partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code2 or
partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code3 or
partyBrowserApi.GetPartyMemberXuid(lobby_id, 0) == code4 then
client.delay_call(2, function()
partyBrowserApi.ActionJoinParty(lobby_id)
end)
break
end
end
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment