INFINITYCORE FRAMEWORK
  • Getting started Infinity Core
  • INTRODUCTION
    • Framework FAQ
    • The World Map
    • Onesync & Txadmin
    • Chat/Vocal & Discord
    • Multi-Characters
    • Moonshiners DLC Remake
    • Performances
    • Zombies Population (add-on)
  • Roleplay Functions
    • Player commands
    • Admin commands
  • Global Functions
    • Player Datas
    • Notifications
    • Economy & jobs
    • Inventory
    • Levels & XP (RPG)
    • Functions Core
    • Permissions
    • Discord Sync API
    • DEBUG TOOLS
  • CORE TEAM & CREDITS
    • Official Team
    • Credits
Powered by GitBook
On this page
  1. Global Functions

Player Datas

Exports functions for manage players in framework

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

-- CALL SOURCE EVENT
_InfinitySource = GetPlayerServerId(PlayerId())
SOURCE DATAS
-- 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
TARGET DATAS
-- 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
GET SOURCE STEAM
local SourceSteamID     = exports.infinity_core:GetPlayerSource(_UndeadSource)
print(SourceSteamID)    
-- return steam:identifier, and check if the user exist and online in the server
GET TARGET STEAM
local TargetSteamID = exports.infinity_core:GetPlayerTarget(PlayerTarget)
print(TargetSteamID)
-- return steam:identifier, and check if the user exist and online in the server
Force refresh session
--- 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)
Get current lvl of player
local PlayerLevel = exports.infinity_core:XpReturn()

Usage example (check is superadmin)

RegisterCommand('checkmyrank', function(source, args, rawCommand)
    -- 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)

PreviousAdmin commandsNextNotifications

Last updated 1 month ago