Forum

> > CS2D > Scripts > Fast kill command
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Fast kill command

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Fast kill command

kch
User Off Offline

Zitieren
hello guys i need again help, again i spend a lot of time for some lua commands and i think for the kill command on my eyes someone can tell me a easier way.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
addhook("say","kill")
function kill(id,env)
	for _, usgn in ipairs(admlist) do
		if player(id,'usgn') == usgn then
			if (env=="!kill 1") then
			parse("killplayer 1")
		end
			if (env=="!kill 2") then
			parse("killplayer 2")
		end
			if (env=="!kill 3") then
			parse("killplayer 3")
		end
			if (env=="!kill 4") then
			parse("killplayer 4")
		end
			if (env=="!kill 5") then
			parse("killplayer 5")
		end
			if (env=="!kill 6") then
			parse("killplayer 6")
		end
			if (env=="!kill 7") then
			parse("killplayer 7")
		end
			if (env=="!kill 8") then
			parse("killplayer 8")
		end
			if (env=="!kill 9") then
			parse("killplayer 9")
		end
			if (env=="!kill 10") then
			parse("killplayer 10")
		end
			if (env=="!kill 11") then
			parse("killplayer 11")
		end
			if (env=="!kill 12") then
			parse("killplayer 12")
		end
			if (env=="!kill 13") then
			parse("killplayer 13")
		end
			if (env=="!kill 14") then
			parse("killplayer 14")
		end
			if (env=="!kill 15") then
			parse("killplayer 15")
		end
			if (env=="!kill 16") then
			parse("killplayer 16")
		end
			if (env=="!kill 17") then
			parse("killplayer 17")
		end
			if (env=="!kill 18") then
			parse("killplayer 18")
		end
			if (env=="!kill 19") then
			parse("killplayer 19")
		end
			if (env=="!kill 20") then
			parse("killplayer 20")
		end
			if (env=="!kill 21") then
			parse("killplayer 21")
		end
			if (env=="!kill 22") then
			parse("killplayer 22")
		end
	end
end
end
1× editiert, zuletzt 22.05.13 09:02:22

alt Re: Fast kill command

Conscience
User Off Offline

Zitieren
You can split your command into two (string.sub), one checking whether the first 5 letters are "!kill" and the rest counting as the ID, this way you don't need to do 1, 32 commands.

1
2
3
4
if string.sub(env,1,5) == "!kill" then
	local envid = env:sub(7)
	parse("killplayer "..envid)
end

Basically replace your whole;
1
2
3
4
5
if (env=="!kill 1") then
	parse("killplayer 1")
end
if (env=="!kill 2 [...]
-- etc
With what I wrote.

alt Re: Fast kill command

kch
User Off Offline

Zitieren
thanks, i made it a bit more special :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
addhook("say","commands")
function commands(id,txt) --- Delete It ! , or the script Dont Work .
for _, usgn in ipairs(admins) do
if player(id,'usgn') == usgn then
     if txt:lower():sub(1,5) == "!kick" then -- Kick
          tokick = txt:sub(7,8)
          toreason = txt:sub(9)
          parse("kick "..tokick.." "..toreason)
     elseif txt:lower():sub(1,7) == "!mct" then -- Counter-Terrorist
          tomake = txt:sub(8)
          parse("makect "..tomake)
     elseif txt:lower():sub(1,6) == "!mtr" then -- Terrorist
          tomake = txt:sub(8)
          parse("maket "..tomake)
     elseif txt:lower():sub(1,5) == "!kill" then -- Kill
          tokill = txt:sub(6)
          parse("killplayer "..tokill)
     elseif txt:lower():sub(1,4) == "!ban" then -- Ban
          toban = txt:sub(5)
          parse("banusgn "..toban)
          parse("banip "..toban)
   elseif txt:lower():sub(1,6) == "!mspec" then -- Spectator
          tospec = txt:sub(8)
          parse("makespec "..tospec)
     elseif txt == "!restart" then -- Restart
          parse("sv_restart 2")
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht