AddPlayerChatRange: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|AddPlayerChatRange(x, y, range, message)}} {{FuncParameters}} {{FuncParam|x|__EDIT_ME__}} {{FuncPa..." |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Add (or send) a chat message to everyone in the specified range.}} | ||
{{FuncSyntax|AddPlayerChatRange(x, y, range, message)}} | {{FuncSyntax|AddPlayerChatRange(x, y, range, message)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|x| | {{FuncParam|x|The X axis}} | ||
{{FuncParam|y| | {{FuncParam|y|The Y axis}} | ||
{{FuncParam|range| | {{FuncParam|range|The range in centimeters}} | ||
{{FuncParam|message| | {{FuncParam|message|The text message to send.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|This function returns nothing.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua> | |||
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) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
* [[AddPlayerChat]] | |||
* [[AddPlayerChatAll]] | |||
* [[AddPlayerChatRange]] |
Latest revision as of 19:44, 18 November 2019
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)