Gamemode.PlayerSay

From GMod Wiki

Revision as of 21:43, 27 August 2011 by TheFreeman193 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Event Hook
Hook NamePlayerSay
SyntaxGM:PlayerSay( Player player, String text, Boolean Public chat )
DescriptionCalled when a player types and enters a text message.
ReturnsString The text to display on players' screens
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSay]Gamemode.PlayerSay [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

Descriptionwill put "[Global]" in front of the players message if they type "/all" as the first letters in the chat message
Used onNewerServer.png
Code
 
function ISaid( ply, text, public )
    if (string.sub(text, 1, 4) == "/all") then--if the first 4 letters are /all continue
        return "[Global]"..string.sub( text, 5 );--add [Global] infront of the players text then display
    end
end
hook.Add( "PlayerSay", "ISaid", ISaid );
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox