Player.SendLua

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:SendLua( String txt )
Description:
Sends LUA command to player (Can be used to send Client Commands from Server to individual clients)
Returns: nil
In Object: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.SendLua]Player.SendLua [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDisplays notify hud display saying "You removed the prop." This is what Garry's Mod uses to tell you when you delete something.
Used onNewerServer.png
Code
function SendMessage ( user, text, sound )
	user:SendLua("GAMEMODE:AddNotify(\"" .. text .. "\", NOTIFY_CLEANUP, 5); surface.PlaySound( \"" .. sound .. "\" )")
end
Output
SendMessage(1, "You removed the prop.", "ambient/water/drip" .. math.random(1, 4) .. ".wav")


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox