AddPlayerChatRange: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
28days (talk | contribs)
No edit summary
 
Line 8: Line 8:
{{FuncParam|x|The X axis}}
{{FuncParam|x|The X axis}}
{{FuncParam|y|The Y axis}}
{{FuncParam|y|The Y axis}}
{{FuncParam|range|The Z axis}}
{{FuncParam|range|The range in centimeters}}
{{FuncParam|message|The text message to send.}}
{{FuncParam|message|The text message to send.}}


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


== Example ==
== Example ==

Latest revision as of 19:44, 18 November 2019

AddPlayerChatRange

Type: Function
Context: Server
Introduced: v1.0

Description

Add (or send) a chat message to everyone in the specified range.

Syntax

AddPlayerChatRange(x, y, range, message)

Parameters

  • x
    The X axis
  • y
    The Y axis
  • range
    The range in centimeters
  • message
    The text message to send.

Return Value

  • This function returns nothing.

Example

AddCommand("whisper", function(playerid, ...)
	local message = table.concat({...}, " ")

	if #message < 10 or #message > 128 then
		return AddPlayerChat(playerid, "Invalid specified range of the message.")
	end

	local x, y, z = GetPlayerLocation(playerid)

	AddPlayerChatRange(x, y, 50.0, "[WHISPER] "..GetPlayerName(playerid)..": "message)
end)

See also