BUAT DUNIAMU
Sosial
Informasi Pengguna
4mnt
mencari informasi pengguna informasi pengguna dapat dicari menggunakan fungsi zepetoworldhelper getuserinfo fungsi callback yang disertakan dalam userid seperti waktu penyelesaian, waktu terjadinya kesalahan, dan array string diteruskan sebagai argumen berikut adalah contoh pemanggilan fungsi zepetoworldhelper getuserinfo zepetoworldhelper getuserinfo(ids, (info users\[]) => { for (let i = 0; i < info length; i++) { console log(`userid ${info\[i] useroid}, nama ${info\[i] name}, zepetoid ${info\[i] zepetoid}`); } }, (error) => { console log(error); }); berikut adalah contoh kode lengkap untuk mencari informasi pengguna silakan ganti nilai "userid 1","userid 2" dengan nilai userid yang sebenarnya saat menggunakan contoh kode import { zepetoscriptbehaviour } from 'zepeto script'; import { zepetoworldhelper, users } from 'zepeto world'; export default class userinfo extends zepetoscriptbehaviour { start() { let ids string\[] = \["userid 1", "userid 2"]; zepetoworldhelper getuserinfo(ids, (info users\[]) => { for (let i = 0; i < info length; i++) { console log(`userid ${info\[i] useroid}, nama ${info\[i] name}, zepetoid ${info\[i] zepetoid}`); } }, (error) => { console log(error); }); } } mengimpor gambar profil pengguna gunakan fungsi zepetoworldhelper getprofiletexture untuk memuat foto profil pengguna fungsi callback dari waktu penyelesaian hingga waktu terjadinya kesalahan dan userid diteruskan sebagai argumen berikut adalah contoh kode untuk memanggil fungsi zepetoworldhelper getprofiletexture zepetoworldhelper getprofiletexture(this userid, (texture texture) => { this sampleimage sprite = this getsprite(texture); }, (error) => { console log(error); }); berikut adalah contoh kode yang mengimpor foto profil pengguna import { zepetoscriptbehaviour } from 'zepeto script'; import { zepetoworldhelper } from 'zepeto world'; import { texture,texture2d, sprite, rect, vector2 } from 'unityengine'; import { image } from 'unityengine ui'; export default class gettextureexample extends zepetoscriptbehaviour { public userid string; public sampleimage image; start() { zepetoworldhelper getprofiletexture(this userid, (texture texture) => { this sampleimage sprite = this getsprite(texture); }, (error) => { console log(error); }); } getsprite(texture texture) { let rect rect = new rect(0, 0, texture width, texture height); return sprite create(texture as texture2d, rect, new vector2(0 5, 0 5)); } }