Functions

Server-side functions

iCore.player.getPlayerByLicense

Get player database by license. Use when player is offline and don't have player server id.

local player = iCore.player.getPlayerByLicense(license)
print('json.encode(player))

iCore.player.getData

Return player data for using in server-side.

local id = source
local player = iCore.player.getData(id)
print(json.encode(player))

iCore.player.setData

Set player data for using in server-side and client-side, auto sync.

local id = source
iCore.player.setData(id, {fakeName = 'Julia'})

iCore.player.save

Save player data to database.

AddEventHandler('playerDropped', function(reason)
	local id = source
	local player = iCore.player.getData(id)
	if player and player.userId then
		iCore.player.save(player)
		print('Player disconnect (User ID: ' .. player.userId .. ') (Name: ' .. player.name .. ') (Reason: ' .. reason .. ')')
	end
end)

iCore.player.item

Give or minus player item and amount.

local id = source
iCore.player.item(id, {item = 'cash', amount = 30})
local id = source
iCore.player.item(id, {item = 'cash', amount = -30})

Last updated