---
description: Exports functions for manage players in framework
---

# Player Datas



This var, get all datas from player (Rank, SourceID, Name, Lastname, Years, Nation, Cash, Gold, Inventory, Xp and more..

```lua
-- CALL SOURCE EVENT
_InfinitySource = GetPlayerServerId(PlayerId())
```

{% code title="SOURCE DATAS" overflow="wrap" %}
```lua
-- export for clientside / serverside
local SPlayerDatas  = exports.infinity_core:GetPlayerSession(_InfinitySource)

print(SPlayerDatas._Charid)         -- return CharID used by player
print(SPlayerDatas._Rank)           -- return rank server permissions 
print(SPlayerDatas._Bank)           -- return bank cash value
print(SPlayerDatas._Cash)           -- return cash 
print(SPlayerDatas._Gold)           -- return golds
print(SPlayerDatas._Xp)             -- return xp 
print(SPlayerDatas._Inventory)      -- return all items have the player
print(SPlayerDatas._Firstname)      -- return the firstname
print(SPlayerDatas._Years)          -- return the years 
print(SPlayerDatas._Nation)         -- return the nationality 
print(SPlayerDatas._Lastname)       -- return the lastname
print(SPlayerDatas._Sex)            -- return sex
print(SPlayerDatas._Job)            -- return the job
print(SPlayerDatas._JobGrade)       -- return the jobgrade
print(SPlayerDatas._Gang)           -- return the gangname
print(SPlayerDatas._GangRank)       -- return the gangrank

```
{% endcode %}

{% code title="TARGET DATAS" overflow="wrap" %}
```lua
-- export for clienside / serverside (do not forget "T" in the end call)
local TPlayerDatas  = exports.infinity_core:GetPlayerTargetSession(PlayerTarget)

print(TPlayerDatas._CharidT)         -- return CharID used
print(TPlayerDatas._RankT)           -- return rank server permissions 
print(TPlayerDatas._BankT)           -- return bank cash value
print(TPlayerDatas._CashT)           -- return cash 
print(TPlayerDatas._GoldT)           -- return golds
print(TPlayerDatas._XpT)             -- return xp 
print(TPlayerDatas._InventoryT)      -- return all items have the player
print(TPlayerDatas._FirstnameT)      -- return the firstname
print(TPlayerDatas._SexT)            -- return sex
print(TPlayerDatas._YearsT)          -- return the years 
print(TPlayerDatas._NationT)         -- return the nationality 
print(TPlayerDatas._LastnameT)       -- return the lastname
print(TPlayerDatas._JobT)            -- return the job
print(TPlayerDatas._JobGradeT)       -- return the jobgrade
print(TPlayerDatas._GangT)           -- return the gangname
print(TPlayerDatas._GangRankT)       -- return the gangrank
```
{% endcode %}

{% code title="GET SOURCE STEAM" overflow="wrap" %}
```lua
local SourceSteamID     = exports.infinity_core:GetPlayerSource(_UndeadSource)
print(SourceSteamID)    
-- return steam:identifier, and check if the user exist and online in the server
```
{% endcode %}

{% code title="GET TARGET STEAM" overflow="wrap" %}
```lua
local TargetSteamID = exports.infinity_core:GetPlayerTarget(PlayerTarget)
print(TargetSteamID)
-- return steam:identifier, and check if the user exist and online in the server
```
{% endcode %}

{% code title="Force refresh session" overflow="wrap" %}
```lua
--- Legend Help
TriggerClientEvent('infinitycore:RefreshPlayerDatas', 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11)
-- Legend 

-- 00 = Source
-- 01 = Character ID used by player
-- 02 = Cash Bank amount
-- 03 = Cash amount
-- 04 = Xp amount
-- 05 = Gold Amount
-- 06 = Job
-- 07 = JobGrade 
-- 08 = Gang
-- 09 = GangRank
-- 10 = Inventory 
-- 11 = ActionType (add, remove, refresh, setinv, setjob, setxp, setgold, setcash, setgang)
```
{% endcode %}

{% code title="Get current lvl of player" %}
```lua
local PlayerLevel = exports.infinity_core:XpReturn()
```
{% endcode %}

Usage example (**check is superadmin**)

<pre class="language-lua" data-overflow="wrap"><code class="lang-lua"><strong>RegisterCommand('checkmyrank', function(source, args, rawCommand)
</strong>    -- CALL SOURCE
    _InfinitySource = GetPlayerServerId(PlayerId())
    local PlayerDatas = exports.infinity_core:GetPlayerSession(_InfinitySource)
    if PlayerDatas._Rank == "superadmin" then
      -- granted for superadmin rank user (no need in this example)
    end
end)
</code></pre>

