🎮 Steam
Interact with Steam APIs
🗿 Static Functions
GetJoinedFromFriend: string or nil | Gets the SteamID of the Friend whose invite or "Join Game" brought this player to the current server | |
InviteFriend: boolean | Invites a Steam Friend to the current server | |
OpenInviteDialog | Opens the Steam Overlay invite dialog, so the player can invite Friends to the current server | |
SetRichPresence | Sets Steam Rich Presence text | |
TriggerScreenshot | Triggers a Steam screenshot |

GetJoinedFromFriendOptimal
Gets the SteamID of the Friend whose invite or "Join Game" brought this player to the current server
It is nil if they connected any other way.
This value is reported by the client, so a server should not trust it blindly (e.g. ask the Friend to accept before adding the player to a private group)
local ret = Steam.GetJoinedFromFriend()
Examples (1)
-- Client side
local function JoinFriendParty(friend_steam_id)
Events.CallRemote("JoinFriendParty", friend_steam_id)
end
-- If we connected through an invite or "Join Game"
local friend_steam_id = Steam.GetJoinedFromFriend()
if (friend_steam_id) then
JoinFriendParty(friend_steam_id)
end
-- If we accepted an invite to the server we are already on
Steam.Subscribe("FriendJoin", JoinFriendParty)
-- Server side
Events.SubscribeRemote("JoinFriendParty", function(player, friend_steam_id)
for _, other in pairs(Player.GetAll()) do
if (other:GetSteamID() == friend_steam_id) then
-- Adds player to other's party
break
end
end
end)

InviteFriendOptimal
Invites a Steam Friend to the current server
local ret = Steam.InviteFriend(steam_id)
Paramètres
| Name | Type | Description |
|---|---|---|
steam_id | string | The SteamID of the Friend to invite |
Returns
| Type | Description |
|---|---|
| boolean | If the invite was sent |

OpenInviteDialogOptimal
Opens the Steam Overlay invite dialog, so the player can invite Friends to the current server
When a Friend accepts, they join this server and Steam.GetJoinedFromFriend() returns this player's SteamID on their side. If they were already on this server, the FriendJoin event is called instead
Steam.OpenInviteDialog()

SetRichPresenceOptimal
Sets Steam Rich Presence text
Steam.SetRichPresence(text)
Paramètres
| Name | Type | Description |
|---|---|---|
text | string | The new Steam Rich Presence text |
🚀 Events
FriendJoin | Called when this player accepts a Friend's invite or "Join Game" to the server they are already on |

FriendJoin
Called when this player accepts a Friend's invite or "Join Game" to the server they are already on
In this case the player does not reconnect.
When the player connects from another server or from the menus, use Steam.GetJoinedFromFriend() instead
Steam.Subscribe("FriendJoin", function(friend_steam_id)
-- FriendJoin was called
end)
Arguments
| Name | Type | Description |
|---|---|---|
friend_steam_id | string | The SteamID of the Friend |
