General > Developers Corner

My custom chat command does not work :(

<< < (2/2)

fubar:
yes I am getting that same error

addons/custom/lua/ulx/modules/sh/u_custom.lua

Timmy:
The function signature for Player:Say:

--- Code: ---Player:Say( string text, boolean teamOnly=false )
--- End code ---

When a parameter is followed by an equal sign and a value (e.g. "teamOnly=false"), that value is regarded as the default value. As a result, the second parameter in Player:Say defaults to false.

If you don’t want to send the message in team chat, you can write:

--- Code: ---ply:Say( "We were bested. So be it.", false )
--- End code ---
or

--- Code: ---ply:Say( "We were bested. So be it." )
--- End code ---

If you do want to send the message in team chat, you must set the second parameter to true:

--- Code: ---ply:Say( "We were bested. So be it.", true )
--- End code ---

The following is invalid:

--- Code: ---ply:Say( "We were bested. So be it.", teamOnly=false ) -- invalid
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version