Forum

> > CS2D > Scripts > How do i hide "!kick" in chat?
Forums overviewCS2D overview Scripts overviewLog in to reply

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

9 replies
To the start Previous 1 Next To the start

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

phalenkO
User Off Offline

Quote
> https://resmim.net/f/6mSE6R.jpg
> https://resmim.net/f/OXVUec.jpg

Why is this happening?Here is 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

old Re: How do i hide "!kick" in chat?

Avo
User Off Offline

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

old Re: How do i hide "!kick" in chat?

Bowlinghead
User Off Offline

Quote
Use TAB, avoid forum threads
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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview