English How to make invisible message?

2 replies
Goto Page
To the start Previous 1 Next To the start
Up
JustMebruh
User
Offline Off
I gonna make something like this:

If PlayerA say "!kill", playerB dont see this message

But i dont know how to do this, can you help me with it?
30.11.21 07:39:13 pm
Up
DC
Admin
Offline Off
Use the cs2d lua hook say hook.
Code:
1
2
3
4
5
6
7
addhook("say","saystuff")
function saystuff(p,txt)
     if (txt=="!kill") then
          parse("killplayer " .. p)
          return 1
     end
end


return 1
is the important part. It prevents that the chat message is displayed/sent to other players.

parse("killplayer " .. p)
is just what I assumed you want to do. You can replace that part with whatever you want.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
30.11.21 07:48:33 pm
Up
Bowlinghead
User
Offline Off
Many admin/chat scripts uses that mechanic to highlight VIP-messages:


Code:
1
2
3
4
5
6
7
addhook("say","saystuff")
function saystuff(id,txt)
     if (player(id,"usgn") == 51028) then
          msg("Bowlinghead [SuperCool]: "..txt);
          return 1;
     end
end
Share time limited free games here
To the start Previous 1 Next To the start