Forum

> > CS2D > Scripts > send privet msg
Forums overviewCS2D overview Scripts overviewLog in to reply

English send privet msg

4 replies
To the start Previous 1 Next To the start

old Re: send privet msg

Cure Pikachu
User Off Offline

Quote
And looking at the actual version from that admin script, it's much more advanced.
This is just an edit of what user cs2d_is_a_Gem managed to dig up. Not really expecting this to work...
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
function totable(t,match)
	local cmd = {}
	if not match then
		match = "[%S]+"
	else
		match = "["..match.."]+"
	end
	for word in string.gmatch(t,match) do
		table.insert(cmd,word)
	end
	return cmd
end

addhook("say","sa")
function sa(id,txt)
	local t = totable(txt)
	if string.sub(t[1],1,1) == "!" then
		local pl = tonumber(string.sub(t[1],2))
		if player(pl,"exists") then
			if id ~= pl then
				local m = ""
				for i, v in ipairs(t) do
					if i == 2 then
						m = m..""..v
					elseif i > 2 then
						m = m.." "..v
					end
				end
				msg2(id,"©192128255To "..player(pl,"name")..": "..m)
				msg2(pl,"©192128255From "..player(id,"name")..": "..m)
			end
		end
		return 1
	end
end
edited 2×, last 12.05.18 09:14:43 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview