Funkcje


User:GetIdentifier(source)

Odpowiada za pobieranie głównego identyfikatora gracza - DiscordID.

Syntax
--- source: number
local identifier = User:GetIdentifier(source)
--- identifier: string
Example
local accountId = User:GetIdentifier(source)
print(accountId) -- example: 462560945827479562

User:GetAllUserCharactersFullData

Odpowiada za pobieranie wszystkich danych na temat wszystkich postaci gracza.

Syntax
--- identifier: string
--- limit?: number
local charactersFullData = User:GetAllUserCharactersFullData(identifier, limit)
--- charactersFullData: CharacterFullData[]
Example
local userCharactersData = User:GetAllUserCharactersFullData('462560945827479562')

print(json.encode(userCharacterData, { indent = true }))
Przykładowa odpowiedź
[
  {
    "sex": "male",
    "lastname": "Lipiński",
    "appearance": {
      "model": 1885233650,
      "head_overlay": "{\"moles\":[255,2,0,0,0.0],\"body_blemishes_1\":[255,2,0,0,0.0],\"eyebrows\":[0,1,4,0,1.0],\"beard\":[1,1,0,0,1.0],\"body_blemishes_2\":[255,2,0,0,0.0],\"lipstick\":[255,2,0,0,0.0],\"makeup\":[0,0,0,0,1.0],\"chest_hair\":[0,1,0,0,1.0],\"complexion\":[255,2,0,0,0.0],\"skin_age\":[255,2,0,0,0.0],\"sun_damage\":[255,2,0,0,0.0],\"face_blemishes\":[255,2,0,0,0.0],\"blush\":[255,2,0,0,0.0]}",
      "head_blend": "{\"shape_second\":21,\"skin_second\":21,\"skin_first\":7,\"shape_third\":0,\"third_mix\":0.0,\"skin_third\":0,\"shape_first\":7,\"shape_mix\":0.0,\"skin_mix\":1.0}",
      "face_features": "{\"cheekbone_depth\":2.0,\"chin_height\":-1.0,\"jaw_width\":-1.0,\"neck_width\":0.0,\"nose_tip_lenght\":2.0,\"eyebrows_depth\":1.0,\"jaw_shape\":-1.0,\"eyebrows_height\":-1.0,\"chin_depth\":-1.0,\"eye_size\":2.0,\"nose_tip_height\":1.0,\"cheekbone_height\":-1.0,\"nose_width\":1.0,\"chin_width\":0.0,\"lips_thicknes\":2.0,\"cheekbone_width\":1.0,\"nose_broken\":0.02,\"nose_bridge_depth\":-1.0,\"chin_indent\":0.0,\"nose_bottom_height\":1.0}",
      "eye_color": 7,
      "hair_color": "[53,7]",
      "clothes": "{\"tshirt\":[45,0],\"watches\":[34,0],\"mask\":[0,0],\"bags\":[3,0],\"helmet\":[2,0],\"decals\":[0,0],\"shoes\":[101,1],\"bproof\":[0,0],\"pants\":[105,0],\"arms\":[1,0],\"chain\":[0,0],\"ears\":[41,0],\"glasses\":[13,0],\"hair\":[49,0],\"bracelets\":[6,0],\"torso\":[108,0]}"
    },
    "cid": 1,
    "birthplace": "Białystok",
    "dateofbirth": "2004-02-11",
    "firstname": "Adrian",
    "bank": 76,
    "nationality": "Polska",
    "middlename": "Kuba"
  },
  {
    "sex": "male",
    "lastname": "Aasdads",
    "appearance": {
      "model": 1885233650,
      "head_overlay": "{\"skin_age\":[255,2,0,0,0.0],\"chest_hair\":[255,1,0,0,0.0],\"moles\":[255,2,0,0,0.0],\"body_blemishes_2\":[255,2,0,0,0.0],\"beard\":[255,1,0,0,0.0],\"sun_damage\":[255,2,0,0,0.0],\"blush\":[255,2,0,0,0.0],\"complexion\":[255,2,0,0,0.0],\"eyebrows\":[1,1,0,0,1.0],\"lipstick\":[255,2,0,0,0.0],\"body_blemishes_1\":[255,2,0,0,0.0],\"makeup\":[255,0,0,0,0.0],\"face_blemishes\":[255,2,0,0,0.0]}",
      "head_blend": "{\"third_mix\":0.0,\"shape_first\":0,\"skin_second\":21,\"skin_mix\":0.5,\"skin_first\":0,\"shape_third\":0,\"shape_second\":21,\"skin_third\":0,\"shape_mix\":0.5}",
      "face_features": "{\"nose_tip_height\":0.0,\"chin_depth\":0.0,\"cheekbone_depth\":1.0,\"eyebrows_height\":0.0,\"jaw_width\":0.0,\"nose_tip_lenght\":1.0,\"nose_bridge_depth\":0.0,\"eyebrows_depth\":0.0,\"neck_width\":0.0,\"chin_width\":1.0,\"jaw_shape\":0.0,\"cheekbone_width\":0.0,\"nose_width\":0.0,\"chin_height\":0.0,\"chin_indent\":0.0,\"nose_broken\":0.0,\"cheekbone_height\":0.0,\"nose_bottom_height\":0.0,\"eye_size\":1.0,\"lips_thicknes\":1.0}",
      "eye_color": 0,
      "hair_color": "[5,7]",
      "clothes": "{\"bproof\":[0,0],\"bracelets\":[-1,-1],\"mask\":[0,0],\"bags\":[0,0],\"helmet\":[2,0],\"torso\":[15,0],\"decals\":[0,0],\"pants\":[21,0],\"arms\":[15,0],\"chain\":[0,0],\"hair\":[22,0],\"tshirt\":[15,0],\"glasses\":[-1,-1],\"shoes\":[34,0],\"watches\":[-1,-1],\"ears\":[-1,-1]}"
    },
    "cid": 74,
    "birthplace": "Aasdads",
    "dateofbirth": "2009-02-19",
    "firstname": "Aasdads",
    "bank": 0,
    "nationality": "Afgańska",
    "middlename": "Aasdads"
  }
]
Types
CharacterAppearance = {
    model: number,
    head_blend: table,
    head_overlay: table,
    face_features: table,
    hair_color: { number, number },
    eye_color: number,
    clothes: table,
}
CharacterFullData = {
    cid: number,
    bank: number,
    firstname: string,
    middlename?: string,
    lastname: string,
    nationality: string,
    dateofbirth: string,
    birthplace: string,
    sex: 'male' | 'female',
    appearance?: CharacterAppearance
}

User:GetPlayerMulicharacterSlots

Pobiera ilość slotów na postać dla podanego accountId.

Syntax
--- accountId: string
local userCharacterSlots = User:GetPlayerMulicharacterSlots(accountId)
--- userCharacterSlots: number
Example
local accountId = User:GetIdentifier(source)
local playerMulicharacterSlots = User:GetPlayerMulicharacterSlots(accountId)
print(playerMulicharacterSlots) --- example: 3

User:LoadPlayer(source, cid)

Funkcja odpowiedzialna za wczytanie gracza.

Syntax
--- source: number
--- cid: number
User:LoadPlayer(source, cid)
Example
User:LoadPlayer(4, 20)

User:LoadCharacter

Główna funkcja odpowiedzialna za załadowanie postaci gracza.

Syntax
--- source: number
--- cid: number
--- isNewCharacter?:boolean
User:LoadCharacter(source, cid, isNewCharacter)
Example
RegisterCommand('loadchar', function(source, args, raw)
    assert(Debug:IsDebugModeEnabled(), 'This command should only be used in debug mode')

    local cid = tonumber(args[1])

    if (not cid) then
        return
    end

    User:LoadCharacter(source, cid)
end, true)

User:UnloadCharacter

Funckja odpowiadająca za wyładowanie postaci gracza.

Syntax
--- source: number
User:UnloadCharacter(source)
Example
User:UnloadCharacter(1)

User:GetPlayerFromServerId

Funkcja odpowiedająca za pobieranie obiektu gracza korzystając z serverId.

Syntax
--- serverId: number
local user = User:GetPlayerFromServerId(serverId)
--- usdr: User
Example
local cid = User:GetPlayerFromServerId(2)?.cid
print(cid) -- example: 1
Types
User = {
    identifier: string,
    name: string,
    cid: number
}

User:GetPlayerSourceFromCid

Funkcja pozwalająca na pobranie serverId gracza poprzed CID.

Gracz musi być online. W przeciwnym wypadku funkcja zwróci nil.
Syntax
--- cid: number
local source = User:GetPlayerSourceFromCid(cid)
--- source?: number
Example
local source = User:GetPlayerSourceFromCid(sourceCid)
local target = User:GetPlayerSourceFromCid(targetCid)

if sourceCid and source then
    SendPhoneNotification(source, 'remove', amount)
end

if targetCid and target then
    SendPhoneNotification(target, 'add', amount)
end