OnPlayerChat: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Event|Server & Client|1.0}} | {{Info|Event|Server & Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|The event that gets called when you type a message in the chat.}} | ||
{{FuncSyntax|OnPlayerChat(player, text)}} | {{FuncSyntax|OnPlayerChat(player, text)}} | ||
Line 10: | Line 10: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
AddEvent("OnPlayerChat", function(playerid, text) | |||
local x, y, z = GetPlayerLocation(playerid) | |||
AddPlayerChatRange(x, y, 75.0, "<span color=\"#ffffffFF\">"..GetPlayerName(playerid).." says: "..text.."</>") | |||
return false | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ServerEvents}} | {{ServerEvents}} |
Revision as of 16:21, 18 November 2019
Description
The event that gets called when you type a message in the chat.
Syntax
OnPlayerChat(player, text)
Parameters
- player
The player who is texting in chat. - text
Text committed by the player.
Example
AddEvent("OnPlayerChat", function(playerid, text)
local x, y, z = GetPlayerLocation(playerid)
AddPlayerChatRange(x, y, 75.0, "<span color=\"#ffffffFF\">"..GetPlayerName(playerid).." says: "..text.."</>")
return false
end)
See also
Player
- OnPlayerServerAuth
- OnPlayerSteamAuth
- OnPlayerDownloadFile
- OnPlayerStreamIn
- OnPlayerStreamOut
- OnPlayerPickupHit
- OnPlayerJoin
- OnPlayerQuit
- OnPlayerSpawn
- OnPlayerDeath
- OnPlayerWeaponShot
- OnPlayerDamage
- OnPlayerChat
- OnPlayerChatCommand
- OnPlayerInteractDoor
- OnPlayerChangeDimension
Vehicle
- OnPlayerEnterVehicle
- OnPlayerLeaveVehicle
- OnPlayerStateChange
- OnVehicleRespawn
- OnVehicleStreamIn
- OnVehicleStreamOut
- OnVehicleDamage
- OnVehicleChangeDimension
- OnVehicleCreated
- OnVehicleDestroyed
Game
Package
NPC
- OnNPCReachTarget
- OnNPCDamage
- OnNPCSpawn
- OnNPCDeath
- OnNPCStreamIn
- OnNPCStreamOut
- OnNPCChangeDimension
- OnNPCCreated
- OnNPCDestroyed
Object
- OnObjectStopMoving
- OnObjectChangeDimension
- OnObjectCreated
- OnObjectDestroyed
- OnObjectStreamIn
- OnObjectStreamOut