Forum

> > CS2D > Scripts > [Request] Emoticon System
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [Request] Emoticon System

12 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt [Request] Emoticon System

P0rtal
BANNED Off Offline

Zitieren
Hai All,

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.png

Thanks

alt Re: [Request] Emoticon System

DC
Admin Off Offline

Zitieren
this will not work - at least if you plan to add the emoticons to the chat text. because the chat text scrolls and fades out and stuff and you can't check the positions and fade states etc.

but displaying smiley images over the heads of players or something like that would be quite easy.

alt Re: [Request] Emoticon System

Ax3
User Off Offline

Zitieren
I remember, Tibia mod has this system. So if your text in chat have some smileys, then sign appears near you.

alt Re: [Request] Emoticon System

DragonAwper
User Off Offline

Zitieren
This is the more easy type of emoticon
U have to ajust the time of fadeout or hide the emoticon

••••••••••••••••••••••••••••••••
When you say ": )" w/o quotes, will appear a emoticon
••••••••••••••••••••••••••••••••

1
2
3
4
5
6
7
addhook("say","onsay")
function onsay(id,txt)
freeimage(id) 
if (txt==":)") then
id=image("gfx/weiwen/happy.png",1,1,200+id)
end
end

Obs: I used the weiwen Happy png, if u don't have change the file.

alt Re: [Request] Emoticon System

KimKat
GAME BANNED Off Offline

Zitieren
I went to Hitsu's server and it had this Lua emoticon system implemented weiwen was the scripter for it. I love it, it also fades away after some seconds which is pretty cool.

alt Re: [Request] Emoticon System

Yasday
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht