AddPlayerChat: Difference between revisions

From Onset Developer Wiki
No edit summary
(Added a example for the client because of different syntax in comparison with the server)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server & Client|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Adds (or sends) the specified player or client a message.
 
The chat is not HTML but it supports the <span> tag to change color, font size and style.}}


{{FuncSyntax|AddPlayerChat(player, message)}}
{{FuncSyntax|AddPlayerChat(player, message)}}
{{FuncSyntaxClient|AddPlayerChat(message)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|__EDIT_ME__}}
{{FuncParam|player|The player indentifier.}}
{{FuncParam|message|__EDIT_ME__}}
{{FuncParam|message|The chat message.}}
 
{{FuncReturnValue|Returns '''true'''.}}


{{FuncReturnValue|__EDIT_ME__}}
== Example (Server) ==
<syntaxhighlight lang="Lua>
AddCommand("commands", function(playerid)
local message = "You just executed a command!"
    AddPlayerChat(playerid, '<span color="#ff0000bb" style="bold" size="10">'..message..'</>')
return
end)
</syntaxhighlight>


== Example ==
== Example (Client) ==
__EDIT_ME__
<syntaxhighlight lang="Lua>
AddCommand("commands", function(playerid)
local message = "You just executed a command!"
    AddPlayerChat('<span color="#ff0000bb" style="bold" size="10">'..message..'</>') -- The Client doesn't neeed any ID
return
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[AddPlayerChat]]
* [[AddPlayerChatAll]]
* [[AddPlayerChatRange]]

Latest revision as of 14:28, 29 December 2021

AddPlayerChat

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Adds (or sends) the specified player or client a message.

The chat is not HTML but it supports the tag to change color, font size and style.

Syntax

AddPlayerChat(player, message)
Client Syntax
AddPlayerChat(message)

Parameters

  • player
    The player indentifier.
  • message
    The chat message.

Return Value

  • Returns true.

Example (Server)

AddCommand("commands", function(playerid)
	local message = "You just executed a command!"
    AddPlayerChat(playerid, '<span color="#ff0000bb" style="bold" size="10">'..message..'</>')
	return
end)

Example (Client)

AddCommand("commands", function(playerid)
	local message = "You just executed a command!"
    AddPlayerChat('<span color="#ff0000bb" style="bold" size="10">'..message..'</>') -- The Client doesn't neeed any ID
	return
end)

See also