SetPlayerName: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 9: Line 9:
{{FuncParam|name|The new name to set for the player. Limited to 32 characters.}}
{{FuncParam|name|The new name to set for the player. Limited to 32 characters.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|This function returns nothing.}}


== Example ==
== Example ==
<syntaxhighlight lang="Lua>
AddCommand("superman", function(playerid)
AddCommand("superman", function(playerid)
     SetPlayerName(playerid, "Superman")
     SetPlayerName(playerid, "Superman")
     AddPlayerChat(playerid, "Your name is now Superman.")
     AddPlayerChat(playerid, "Your name is now Superman.")
end)
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
* [[GetPlayerName]]
* [[GetPlayerName]]

Revision as of 15:52, 19 November 2019

SetPlayerName

Type: Function
Context: Server
Introduced: v1.0

Description

Sets a players name which will appear on the nametag. Overrides the Steam nickname.

Syntax

SetPlayerName(player, name)

Parameters

  • player
    The player identifier.
  • name
    The new name to set for the player. Limited to 32 characters.

Return Value

  • This function returns nothing.

Example

AddCommand("superman", function(playerid)
    SetPlayerName(playerid, "Superman")
    AddPlayerChat(playerid, "Your name is now Superman.")
end)

See also