SetPlayerStat: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Complete Lua function catalog
 
Line 34: Line 34:
* Progression changes are server-authoritative and replicated to the owning client.
* Progression changes are server-authoritative and replicated to the owning client.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Progression Functions]]
[[Category:Progression Functions]]
[[Category:Player Functions]]
[[Category:Player Functions]]

Latest revision as of 09:55, 15 August 2026

setPlayerStat

Sets an authoritative numeric progression stat for a connected player.

Syntax

bool setPlayerStat(int playerId, string statName, number value)

Parameters

Name Type Required Description
playerId int yes The connected player to update.
statName string yes A supported stat key.
value number yes The new value, clamped to the stat's allowed range.

Returns

Returns true when the update is accepted; otherwise returns false.

Examples

Set a player's strength:

if not setPlayerStat(playerId, "strength", 50) then
    outputDebugString("Could not set strength", 1)
end

Notes

  • Available only in server-side resource scripts.
  • Progression changes are server-authoritative and replicated to the owning client.