Forum

> > CS2D > Scripts > How do i hide "!kick" in chat?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

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

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

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

phalenkO
User Off Offline

Zitieren
> 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
2× editiert, zuletzt 03.06.18 16:15:28

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

Avo
User Off Offline

Zitieren
user Quattro hat geschrieben
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.

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

Bowlinghead
User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht