English How do i hide "!kick" in chat?

9 replies
Goto Page
To the start Previous 1 Next To the start
Up
phalenkO
User
Offline Off
> https://resmim.net/f/6mSE6R.jpg
> https://resmim.net/f/OXVUec.jpg

Why is this happening?Here is code

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
admin = {142925}

addhook("say","tekme")
function tekme(id,txt)
if player(id,"usgn") == admin[id] then 
if string.sub(txt, 1, 5) == "!kick" then 
local tekmelenen = string.sub(txt, 7, 8)
parse("kick "..tekmelenen)
msg("\169255255255"..player(tekmelenen,"name").." has been kicked")
return 1
end
elseif string.sub(txt, 1, 4) == "!ban" then
local banlanan = string.sub(txt, 6, 7) 
parse("banid "..banlanan)
msg("\169100200300"..player(banlanan,"name").." has been banned")
return 1
end
end
edited 2×, last 03.06.18 04:15:28 pm
03.06.18 04:07:15 pm
Up
DC
Admin
Offline Off
@user phalenkO: Please choose a proper title. "Why so???" says NOTHING about your problem. Also please describe your problem properly. Otherwise it's impossible to help you.

If you're unable to do so, you're unable to use this forum.
rules §4.1 - Use proper, understandable language and no dialects (and also no translation tools)
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
03.06.18 04:22:12 pm
Up
Masea
Super User
Offline Off
Check whether the player who is gonna be kicked or banned exists or not.
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
03.06.18 05:58:59 pm
Up
phalenkO
User
Offline Off
@user Masea: if you look at the picture you will see the player.
03.06.18 06:39:29 pm
Up
panteon00
User
Offline Off
can you post the console output?
espacilly the red will help everybody who want to help you
loading...
03.06.18 07:11:14 pm
Up
Quattro
User
Offline Off
You must use only 1 say hook...
03.06.18 07:56:55 pm
Up
Avo
User
Offline Off
user Quattro has written:
You must use only 1 say hook...
Not true. If multiple functions for the same type of event are used, the return value of the most important function (according to priority) is used.

So, add priority to your function:
addhook("say","tekme", 1000000)


or merge functions attached to the say hook into one function.
03.06.18 08:21:51 pm
Up
Quattro
User
Offline Off
@user Avo:
Ye, I should've said "just use one say hook to avoid problems" for the sake of simplicity
03.06.18 09:55:07 pm
Up
phalenkO
User
Offline Off
There are no messages about error.
03.06.18 10:01:55 pm
Up
Bowlinghead
User
Offline Off
Use TAB, avoid forum threads
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
admin = {142925}

addhook("say","tekme")
function tekme(id,txt)
     if player(id,"usgn") == admin[id] then 
          if string.sub(txt, 1, 5) == "!kick" then 
               local tekmelenen = string.sub(txt, 7, 8)
               parse("kick "..tekmelenen)
               msg("\169255255255"..player(tekmelenen,"name").." has been kicked")
               return 1
          end
     elseif string.sub(txt, 1, 4) == "!ban" then // WHOOPS
          local banlanan = string.sub(txt, 6, 7) 
          parse("banid "..banlanan)
          msg("\169100200300"..player(banlanan,"name").." has been banned")
          return 1
     end
end


OK - after checking the images. Your "kick" only hide on !kick 1 but not on anything else?
You can check whats in your strings. Just print/msg them out (like tekmelenen, banlanan ??) after everytime you change them.

As you can see, you dont kick the bots. So you dont even enter line 6. So whats the solution? Even more msg. Do a msg after every action.
msg("Player is admin "..id)
msg("Kick command found, kicking: "..tekmelenen).


Actually line 5 is wrong in more ways than I can tell. Learn loops and tables/arrays.
Share time limited free games here
To the start Previous 1 Next To the start