The /do command:
function input_Console ( text ) --when a player types in the console
--split the command by spaces (ASCII 32) and get the first piece of text
local command = gettok ( text, 1, 32 )
--if the first piece of text was "do",
if ( command == "do" ) then
--get the player's name
local playerName = getPlayerName ( source )
-- get the action text by substracting the first three characters do")
local actionText = string.sub ( text, 3 )
-- announce the me command into the chatbox
outputChatBox ( " *" .. actionText .. "* ((" .. getPlayerName( source ) .. "))", root, 255, 40, 80, true )
end
end
addEventHandler ( "onConsole", getRootElement(), input_Console ) -- add an event handler for onConsole
The /my command
The /my command:
function input_Console ( text )
local command = gettok (text, 1, 32 )
if ( command == "my" ) then
local playerName = getPlayerName ( source )
local actionText = string.sub ( text, 3 )
outputChatBox ( " *" .. playerName .. "'s" .. actionText .. " ", root, 255, 40, 80, true )
end
end
addEventHandler ( "onConsole", getRootElement(), input_Console )
The /ad command:
function input_Console ( text )
--split the command by spaces (ASCII 32) and get the first piece of text
local command = gettok ( text, 1, 32 )
--if the first piece of text was "do",
if ( command == "ad" ) then
--get the player's name
local playerName = getPlayerName ( source )
-- get the action text by substracting the first three characters ("ad ")
local actionText = string.sub ( text, 3 )
-- announce the ad command into the chatbox
outputChatBox ( " [AD]: " .. actionText .. " ((" .. getPlayerName( source ) .. "))", root, 150, 40, 80, true )
end
end
addEventHandler ( "onConsole", getRootElement(), input_Console ) -- add an event handler for onConsole
*No rights reserved. Written by me.