WOuld one of you guys stand up and write for me how do you make an emoticon system? like when you say
or When you say
? i already have the images. so make it gfx/emoticons/biggrin.pngThanks
Scripts
[Request] Emoticon System
[Request] Emoticon System
1

or When you say
? i already have the images. so make it gfx/emoticons/biggrin.png
a picture of a big grin shows up on top of your head. 































































addhook("say","onsay")
function onsay(id,txt)
freeimage(id)
if (txt==":)") then
id=image("gfx/weiwen/happy.png",1,1,200+id)
end
end
s = {}
function s.c(path, ...)
	local args = {...}
	local id = #s + 1
	s[id] = {p = path, s = args}
end
-- Add new Emoticons here:
-- Like this: s.c(IMAGE_PATH,EMOTICON1,EMOTICON2,...)
--***--
s.c("gfx/weiwen/happy.png",":D",":)","=)")
--***--
addhook([[say]], [[say_hook]], -10)
function say_hook(id, txt)
	for m = 1, #s, 1 do
		local w = nil
		for _,l in ipairs(s[m].s) do
			if txt:find(l) then
				w = l
			end
		end
		if w ~= nil then
			local b = image(s[m].p,player(id,"x"),player(id,"y"),3)
			timer(0,"imagep",b..","..id,0)
			timer(1000,"imagealpha",b..",0.75")
			timer(1200,"imagealpha",b..",0.5")
			timer(1400,"imagealpha",b..",0.25")
			timer(1600,"freeimage",b)
			timer(1600,"freetimer","imagep,'"..b..","..id.."'")
		end
	end
end
function string:totable(m)
	if not m then m = "%s" end
	local tbl = {}
	for w in self:gmatch("[^"..m.."]+") do
		table.insert(tbl,w)
	end
	return tbl
end
_imagealpha = imagealpha
function imagealpha(id, alpha)
	if type(id) == "string" then
		alpha = id:totable(",")[2]
		id = id:totable(",")[1]
	end
	_imagealpha(id, alpha)
end
function imagep(b)
	id = tonumber(b:totable(",")[1])
	pl = tonumber(b:totable(",")[2])
	imagepos(id, player(pl,"x"), player(pl,"y"), 0)
end
1
