GetPlayerBySteamId: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 12: | Line 12: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | <syntaxhighlight lang="Lua"> | ||
AddCommand("steamid", function (playerid, steam64) | |||
local length = string.len(steam64) | |||
if (length < 17 or length > 17) then | |||
return AddPlayerChat(playerid, "Invalid Steam64 length specified.") | |||
end | |||
local lookupid = GetPlayerSteamId(tonumber(steam64)) | |||
if (lookupid == false) then | |||
return AddPlayerChat(playerid, "The specified Steam64 is not in game.") | |||
else | |||
return AddPlayerChat(playerid, "The specified Steam64 is online and their player ID: "..lookupid..".") | |||
end | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ServerPlayerFunctions}} |
Latest revision as of 10:04, 20 January 2020
Description
Gets a player by SteamID.
Syntax
GetPlayerBySteamId(steamid)
Parameters
- steamid
The SteamId64 as an integer.
Return Value
- Returns the player identifier. Returns false if no player has the specified steamid.
Example
AddCommand("steamid", function (playerid, steam64)
local length = string.len(steam64)
if (length < 17 or length > 17) then
return AddPlayerChat(playerid, "Invalid Steam64 length specified.")
end
local lookupid = GetPlayerSteamId(tonumber(steam64))
if (lookupid == false) then
return AddPlayerChat(playerid, "The specified Steam64 is not in game.")
else
return AddPlayerChat(playerid, "The specified Steam64 is online and their player ID: "..lookupid..".")
end
end)
See also
- GetPlayerBySteamId
- SetPlayerRagdoll
- SetPlayerDimension
- GetPlayerDimension
- SetPlayerPropertyValue
- GetPlayerPropertyValue
- IsValidPlayer
- GetPlayerCount
- GetAllPlayers
- GetNearestPlayer2D
- GetPlayersInRange2D
- GetPlayersInRange3D
- GetStreamedPlayersForPlayer
- SetPlayerName
- GetPlayerName
- GetPlayerSteamId
- GetPlayerNetworkStats
- SetPlayerSpawnLocation
- IsPlayerStreamedIn
- SetPlayerVoiceRange
- SetPlayerVoiceChannel
- IsPlayerVoiceChannel
- SetPlayerVoiceEnabled
- IsPlayerVoiceEnabled
- IsPlayerTalking
- AddPlayerChat
- AddPlayerChatRange
- AddPlayerChatAll
- GetPlayerState
- GetPlayerMovementMode
- GetPlayerMovementSpeed
- IsPlayerAiming
- IsPlayerReloading
- GetPlayerVehicle
- GetPlayerVehicleSeat
- SetPlayerInVehicle
- RemovePlayerFromVehicle
- SetPlayerLocation
- GetPlayerLocation
- SetPlayerWeaponStat
- SetPlayerWeapon
- GetPlayerWeapon
- GetPlayerEquippedWeaponSlot
- EquipPlayerWeaponSlot
- GetPlayerEquippedWeapon
- SetPlayerHeading
- GetPlayerHeading
- SetPlayerSpectate
- IsPlayerDead
- SetPlayerHealth
- GetPlayerHealth
- SetPlayerArmor
- GetPlayerArmor
- SetPlayerRespawnTime
- GetPlayerRespawnTime
- GetPlayerIP
- GetPlayerPing
- KickPlayer
- GetPlayerLocale
- GetPlayerGUID
- GetPlayerGameVersion
- SetPlayerAnimation
- AttachPlayerParachute
- SetPlayerHeadSize
- GetPlayerHeadSize