steamworks/RequestPlayerInfo

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m
 
Line 16: Line 16:
 
{{Example
 
{{Example
 
|Description=Gets and prints the steam name of the local player
 
|Description=Gets and prints the steam name of the local player
|Code=steamworks.RequestPlayerInfo( LocalPlayer():SteamID64() )
+
|Code=steamworks.RequestPlayerInfo( LocalPlayer():SteamID64(), function(steamName)
timer.Simple( 1, function()
+
print( steamName )
print( steamworks.GetPlayerName( LocalPlayer():SteamID64() ) )
+
 
end )
 
end )
|Output=The local player's name
 
}}
 
{{Example
 
|Description=Gets and prints the steam name of the local player with callback
 
|Code=steamworks.RequestPlayerInfo(ply:SteamID64(), function(steamName)
 
print(steamName)
 
end)
 
 
|Output=The local player's name
 
|Output=The local player's name
 
}}
 
}}

Latest revision as of 13:09, 28 September 2018

 steamworks.RequestPlayerInfo( )

Contents

Description

Requests information of the player with SteamID64 for later use with steamworks.GetPlayerName.

Arguments

string steamID64

The 64bit Steam ID of player.

Arguments

function callback

A callback function with only 1 argument - string name.

Examples

Example

Gets and prints the steam name of the local player

steamworks.RequestPlayerInfo( LocalPlayer():SteamID64(), function(steamName)
		print( steamName )
end )

Output:

The local player's name
Personal tools
Navigation