OnPlayerLookChange
A player asks for a new look; return false to refuse it.
The player’s game asked for a look - the mode’s client half called RequestLookChange: a character creator’s
done, a barber’s chair. The server has checked it first: every part one of its kind in the catalogue, all of them a
man’s or all a woman’s (look.gender is "female" for a woman’s body), and not more than one ask a second. Returning false refuses it and nothing changes (say why yourself); nothing, nil or
true takes it - the look is the player’s on every screen, as SetPlayerLook would make it. This is the place to
save it.
A mode that does not define this callback takes no look from a player: nobody changes their look on a server whose mode offers no way to.
Syntax
Section titled “Syntax”function OnPlayerLookChange(pid, look) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | who asks |
look |
table | {body, head, hair, beard, gender} - the parts asked for (a part left out is the soul’s own); gender is "female" for a woman’s body, absent for a man’s |
Returns
Section titled “Returns”false refuses the look
Example
Section titled “Example”function OnPlayerLookChange(pid, look) if not creating[pid] then return false end -- only while the creator is open creating[pid] = nil db:Execute("UPDATE players SET look = @l WHERE name = @n", { l = LookToString(look), n = GetPlayerName(pid) }) TogglePlayerControllable(pid, true) return trueendSee also
Section titled “See also”SetPlayerLook · LookToString · GetLookParts · the Looks and character creation group of the index
