• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Run Eluna from the chat

Nyll

Enthusiast
Run Eluna function from the ingame chat.

Preview: https://youtu.be/y1UZ6hEiwb4

Example:
Code:
Player:SendBroadcastMessage("Test Message")
Target:SendUnitSay("Test Message", 0)

Code:
Code:
function CMD_Handler( event, player, msg )
	if (player:GetGMRank() >= 1) and string.sub(msg, 1, 1) == "#" then
		local chunk, errors = load(string.sub(msg, 2, msg:len()))

		if errors then
			print(errors)
			player:SendBroadcastMessage("[ERROR]: "..errors)
		else
			Player = player or nil
			Target = player:GetSelection() or nil
			xpcall(chunk, function(ok, errors) print(ok, errors) end)
		end

		return false
	end
end

RegisterPlayerEvent(18, CMD_Handler)
RegisterPlayerEvent(19, CMD_Handler)
RegisterPlayerEvent(20, CMD_Handler)
RegisterPlayerEvent(21, CMD_Handler)
RegisterPlayerEvent(22, CMD_Handler)
or http://paste2.org/3K4LkY3v
 

Tommy

Founder
Thanks for sharing with us! However, instead of spam registering all the chat functions why not use the actual player command event?

Code:
PLAYER_EVENT_ON_COMMAND                 =     42,       // (event, player, command)

For this, it already uses "." for the initiation of a specific command so it lifts the purpose of other symbols like "#", and this event overall is ideal and recommended for player commands.
 

Tommy

Founder
Tommy, It is possible and so. I am used to "#" :)

Heh, didn't ask if it was possible (confused? D:), just pointed out that you could use that event and not register so many other events since it isn't more efficient the current way you have it. Regardless, as I said, I was pointing it out as another approach/option.

Nonetheless, thanks for sharing, it is appreciated. :p
 
Top