PointsService

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

ไม่สามารถสร้าง
บริการ
เลิกใช้แล้ว

คลาส PointsService จัดการจุด

แต้มเป็นระบบรางวัลที่ใช้เพื่อแสดงความโดดเด่นและการมีส่วนร่วมของผู้เล่นทั่ว Roblox ระบบจะมอบรางวัลแต้มผ่านบริการนี้ตามดุลยพินิจของผู้พัฒนาเกม

สรุป

อีเวนต์

  • PointsAwarded(userId : number,pointsAwarded : number,userBalanceInGame : number,userTotalBalance : number):RBXScriptSignal

    จะเกิดขึ้นเมื่อผู้เล่นได้รับแต้มสำเร็จแล้ว โดยมีการส่งผ่านจากผลลัพธ์การปรับแต่งของผู้เล่นในเกมปัจจุบันและเกมทั้งหมด

คุณสมบัติ

วิธีการ

อีเวนต์

PointsAwarded

เหตุการณ์นี้จะเกิดขึ้นเมื่อมอบตำแหน่งให้กับผู้เล่นได้สำเร็จและยังส่งผ่านสมดุลที่ปรับปรุงแล้วของจุดที่ผู้เล่นมีในเกมปัจจุบันและทุกเกม

ยอดคงเหลือหาก, ตัวอย่างเช่น, บัญชี Roblox ได้รับสามสิบแต้ม (และไม่มีอะไรเพื่อเริ่ม)

ผู้ใช้: 1 ได้รับ 30 (+30) คะแนนในเกมปัจจุบัน, ยอดคงเหลือ

จะพิมพ์


local function pointsAwarded(userId, pointsAwarded, userBalanceInGame, userTotalBalance)
print("User: " .. userId .. " has now earned " .. userBalanceInGame .. " (+" .. pointsAwarded ..") points in the current game, now making their total balance " .. userTotalBalance)
end
game:GetService("PointsService").PointsAwarded:Connect(pointsAwarded)

พารามิเตอร์

userId: number
pointsAwarded: number
userBalanceInGame: number
userTotalBalance: number

ตัวอย่างโค้ด

When a player is awarded points successfully the below example would print the userId and their new point balance. If, for example, the Roblox account was awarded thirty points (and had none to begin with) "User: 1 has now earned 30 (+30) points in the current game, now making their total balance 30" would be printed.

PointsService.PointsAwarded

local PointsService = game:GetService("PointsService")
local function onPointsAwarded(userId, pointsAwarded, userBalanceInGame, userTotalBalance)
print(
"User:",
userId,
"has now earned",
userBalanceInGame,
"(+",
pointsAwarded,
") points in the current game, now making their total balance",
userTotalBalance
)
end
PointsService.PointsAwarded:Connect(onPointsAwarded)