Forum

> > CS2D > Scripts > i need scripts pm msg
Forums overviewCS2D overview Scripts overviewLog in to reply

English i need scripts pm msg

4 replies
To the start Previous 1 Next To the start

old here beb

Scott
BANNED Off Offline

Quote
Here have 3 codes.

Code 1:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function totable(txt,mt)
     local tbl = {}
     if not mt then mt = "%s" end
     mt = "[^"..mt.."]+"
     for w in string.gmatch(txt,mt)
          table.insert(tbl,w)
     end
     return tbl
end

addhook([[say]],[[sayer]])
function sayer(id,txt)
     cmds = totable(txt)
     if cmds[1] == [[!pm]] then
          local pl = tonumber(cmds[2])
          local msg = string.sub(txt,7)
          msg2(pl,"©255255255"..player(id,"name"..": "..msg.."!C")
          msg2(id,"©255255255Sent message!@C")
          return 1
     end
end

Code 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook ("say","pmsent")
function pmsent(id,txt)
if string.find(txt,"!pm") then
local to4=txt:sub(5,6)
msg2 (id,"©000255000You have sent a pm to "..player(to4,"name").."!")
return 1;
end
end

addhook ("say","pmrecieve")
function pmrecieve(id,txt)
local to1=txt:sub(1,3)
local to2=txt:sub(5,6)
local to3=txt:sub(8)
if to1=="!pm" then
msg2 (to2,"©000255255"..player(id,"name").."(pm): "..to3)
end
end

Code 3:
1
2
3
4
5
6
7
8
9
10
11
12
addhook("say","action43")
function action43(id,txt)
     if string.sub(txt,0,3) == "!pm" then
     local pl = string.sub(txt,5,6)
     if player(pl,"exists") then
          local msg = string.sub(txt,7,99)
          msg2(pl,"©235143041"..player(id,"name").." (PRIVATE): "..msg)
          msg2(id,"©000255000Your message has been succesful sent!")
          return 1
     end
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview