# Functions

## iCore.player.getData

{% hint style="info" %}
Return player data for using in client-side.
{% endhint %}

```
local player = iCore.player.getData()
print(json.encode(player))
```

## iCore.player.freezee

{% hint style="info" %}
Freezee player at current coords.
{% endhint %}

```
local playerId = PlayerId()
-- freeze
local player = iCore.player.freeze(playerId, true)
-- un freeze
local player = iCore.player.freeze(playerId, false)
```

## iCore.player.spawn

{% hint style="info" %}
Spawn player at coords and set some data.
{% endhint %}

```
-- spawn data
local data = {}
-- required
data['x'] = 0.0; data['y'] = 0.0; data['z'] = 0.0; data['heading'] = 0.0;
-- spawn
iCore.player.spawn(data)
```

## iCore.player.openCharacterCreator

{% hint style="info" %}
Open character creator, we can use it for clothe shop or in some case, not only signup process. In signup process, iCore do it, you don't need to care.
{% endhint %}

```
-- init character creator data
local data = {}
-- camera position: default, head, body, bottom
data['position'] = 'default'
-- list options allow to change
data['allows'] = {'close','models','inheritance','hair','beard','eyeBrown','lipsEye','nose','cheeks','jaw','chimp','neck','blemishes','ageing','blush','makeup','torsos','undershirts','tops','legs','shoes','accessory','masks','hat','glass','ear','watch','bracelet'}
iCore.player.openCharacterCreator(data)
```

## iCore.player.setCharacterData

{% hint style="info" %}
Set player character data like model, skin, clothes....
{% endhint %}

```
-- init character data
local data = {}
data['model'] = 'mp_m_freemode_01'
iCore.player.setCharacterData(data)
```

{% hint style="info" %}
We can set many character data as character creator do it. But remember the data is group by. You can't send data in group alone. **Must** full data of group. List of groups is below.
{% endhint %}

* shapeFirstID, shapeSecondID, skinFirstID, skinSecondID, shapeMix, skinMix

```
-- init character data
local data = {}
data['model'] = 'mp_m_freemode_01'
data['shapeFirstID'] = 1
data['shapeSecondID'] = 1
data['skinFirstID'] = 1
data['skinSecondID'] = 1
data['shapeMix'] = 1.0
data['skinMix'] = 0.5
iCore.player.setCharacterData(data)
```

* hairStyle, hairColor1, hairColor2
* beardStyle, beardOpacity, beardColor
* eyeBrownStyle, eyeBrownOpacity, eyeBrownColor
* eyeOpening, lipThickness, eyeColor, lipstickStyle, lipstickOpacity, lipstickColor
* noseWidth, nosePeakHight, nosePeakLenght, noseBoneHigh, nosePeakLowering, noseBoneTwist
* cheeksBoneHigh, cheeksBoneWidth, cheeksWidth
* chimpBoneLowering, chimpBoneLenght, chimpBoneWidth, chimpHole
* neckThickness
* blemishesStyle, blemishesOpacity
* complexionStyle, complexionOpacity
* ageingStyle, ageingOpacity
* blushStyle, blushOpacity, blushColor
* makeupStyle, makeupOpacity
* torsosStyle, torsosTexture
* undershirtsStyle, undershirtsTexture
* topsStyle, topsTexture
* legsStyle, legsTexture
* shoesStyle, shoesTexture
* accessoryStyle, accessoryTexture
* masksStyle, masksTexture
* hatStyle, hatTexture
* glassStyle, glassTexture
* earStyle, earTexture
* watchStyle, watchTexture
* braceletStyle, braceletTexture

## iCore.blip.create

{% hint style="info" %}
Create blip for current player.
{% endhint %}

```
local data = {name = 'Boxing', color = 1, sprite = 536, scale = 0.6, coords = vector3(185.66, -1272.98, 29.19), flash = true, remove = 6000}
iCore.blip.create(data)
```

## iCore.shared.functions.closestPlayer

{% hint style="info" %}
Create closest player near current player and return **playerServerId**.
{% endhint %}

```
local range = 2.0
local closestPlayer = iCore.shared.functions.closestPlayer(range)
-- result is in playerServerId
print(closestPlayer)
```

## iCore.shared.functions.enumerateObjects

{% hint style="info" %}
Find nearly objects.
{% endhint %}

## iCore.shared.functions.enumeratePeds

{% hint style="info" %}
Find nearly peds.
{% endhint %}

## iCore.shared.functions.enumerateVehicles

{% hint style="info" %}
Find nearly vehicles.
{% endhint %}

## iCore.shared.functions.enumeratePickups

{% hint style="info" %}
Find nearly pickups
{% endhint %}

## iCore.shared.functions.loadModel

{% hint style="info" %}
Load model for ped, entity, object creating.
{% endhint %}

```
-- input is model name string, not hash
iCore.shared.functions.loadModel('mp_m_freemode_01')
```

## iCore.shared.functions.deleteEntity

{% hint style="info" %}
Delete entity by entityId.
{% endhint %}

```
iCore.shared.functions.deleteEntity(1235)
```

## iCore.shared.functions.pedSilent

{% hint style="info" %}
Set ped silent, can not be damaged or ragdoll by everyone. Using it for create default ped in shop, is dealer or something like this.
{% endhint %}

```
iCore.shared.functions.pedSilent(1235)
```

## iCore.shared.functions.playAnim

{% hint style="info" %}
Set ped play animations, can be current ped or others.
{% endhint %}

```
iCore.shared.functions.playAnim({ped = PlayerPedId(), dict = 'anim_casino_b@amb@casino@games@shared@player@', anim = 'sit_enter_left_side', flag = 49, duration = 3000, speed = 1.0, speedMultiplier = 1.0, playbackRate = 1.0})
```

{% hint style="info" %}
In case we don't set the dict this function will know anim as scenario and play it.
{% endhint %}

```
iCore.shared.functions.playAnim({anim = 'WORLD_HUMAN_BINOCULARS'})
```

## iCore.ui.send

{% hint style="info" %}
Send data to iCore NUI. Many features in this function but most is the NUI javascript handle it. For example, we can send notify.
{% endhint %}

```
local data = {}
data['ui] = 'notify'
data['type'] = 'info' -- success, danger, warning, info, dark, secondary
data['sender'] = 'no one or everyone' -- don't set will be System for default
data['message'] = 'can use <strong>html</strong>'
data['duration'] = 10000 -- default is 5000
iCore.ui.send(data)
```

{% hint style="info" %}
Or we can show the countdown.
{% endhint %}

```
iCore.ui.send({ui = 'countdown', message = 'Bet for play or fold', duration = 15000})
```

## iCore.ui.copy

{% hint style="info" %}
Copy string data from game to clipboard. Very helpful when develop or get the coords.
{% endhint %}

```
local coords = GetEntityCoords(PlayrePedId())
iCore.ui.copy(coords.x .. ' ' .. coords.y .. ' ' .. coords.z)
```

## iCore.vehicle.spawn

{% hint style="info" %}
Spawn vehicle with input data.
{% endhint %}

```
local data = {}
data['vehicleId'] = 123 -- unique vehicle id, like same with vehicle id in database
data['metadata'] = {x = 0.0, y = 0.0, z = 0.0, heading = 100.0}
data['customs'] = {model = 'sultan', plate = 'LS999999'} -- and many customs can be unput, the customs auto fire to iCore.vehicle.customs()
```

## iCore.vehicle.customs

{% hint style="info" %}
Customs vehicle appearance.
{% endhint %}

```
iCore.vehicle.customs(entityId, {model = 'sultan', plate = 'LS999999'})
```

{% hint style="info" %}
Many customs data listed below.
{% endhint %}

* maxSpeed
* health
* engine
* petrol
* plate
* plateIndex
* dirtLevel
* colorPrimary, colorSecondary
* colorPearlescent, colorWheel
* colorInterior
* colorDashboard
* windowTint
* neonEnabled
* extras
* neonColor
* modSmokeEnabled
* tyreSmokeColor
* modSpoilers
* modFrontBumper
* modRearBumper
* modSideSkirt
* modExhaust
* modFrame
* modGrille
* modHood
* modFender
* modRightFender
* modRoof
* modEngine
* modBrakes
* modTransmission
* modHorns
* modSuspension
* modArmor
* modNitrous
* modTurbo
* modSubwoofer
* modHydraulics
* modXenon
* xenonColor
* modFrontWheels
* modBackWheels
* modPlateHolder
* modVanityPlate
* modTrimA
* modOrnaments
* modDashboard
* modDial
* modDoorSpeaker
* modSeats
* modSteeringWheel
* modShifterLeavers
* modAPlate
* modSpeakers
* modTrunk
* modHydrolic
* modEngineBlock
* modAirFilter
* modStruts
* modArchCover
* modAerials
* modTrimB
* modTank
* modWindows
* modDoorR
* modLivery
* modLightbar

## iCore.vehicle.isFront

{% hint style="info" %}
Check player is front of vehicle.
{% endhint %}

```
iCore.vehicle.isFront(entityId)
```
