Forum

> > CS2D > Scripts > How to add new commands (Amx2d)
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to add new commands (Amx2d)

9 replies
To the start Previous 1 Next To the start

old How to add new commands (Amx2d)

Roooster
User Off Offline

Quote
Hello, I just want to know how to add new commands in amx2d like banip? , banusgn? , equipall , speedmodall.....
Plz answer.

thanks.

old Re: How to add new commands (Amx2d)

kalis
User Off Offline

Quote
i have some command
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if cmd == "!speedall" or cmd == "@speedall" then
			local iwe = tonumber(p[2])	
			if iwe ~= nil then
				for hd = 1,32 do
					if player(hd,"exists") then
						parse("speedmod "..hd.." "..iwe)
						msg('©128128128'..player(id,'name')..' Use @speedmodall all')
					end
				end
			end
		end
		if cmd == "!equipall" or cmd == "@equipall" then
			local iwe = tonumber(p[2])	
			if iwe ~= nil then
				for hd = 1,32 do
					if player(hd,"exists") then
						parse("equip "..hd.." "..iwe)
						msg('©128128128'..player(id,'name')..' Use @equip all')
					end
				end
			end
		end

old @heocon953

Roooster
User Off Offline

Quote
thankss, this should help me out. buut where do I paste it?

old Re: How to add new commands (Amx2d)

kalis
User Off Offline

Quote
parte it in hook "say"
my hook : :
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
function totable(t,match)
     local cmd = {}
     if not match then
          match = "[^%s]+"
     else
          match = "[^"..match.."]+"
     end
     for word in string.gmatch(t, match) do
          table.insert(cmd, word)
     end
     return cmd
end

addhook("say","cmd_say")
function cmd_say(id,txt)
	local p = totable(txt)
	local cmd = tostring(p[1])
		if cmd == "!makespec" or cmd == "@makespec" then
			local get_spec = tonumber(p[2])		
			if player(get_spec,"exists") then
				parse("makespec "..get_spec)
				msg('©160160160'..player(id,'name')..' used @makespec on '..player(get_spec,'name'))
			end
		end
		if cmd == "!cageall" or cmd == "@cageall" then
			local wal = tonumber(p[2])	
			if wal ~= nil then
				for hd = 1,32 do
				local x = player(hd,"tilex")
				local y = player(hd,"tiley")
					if player(hd,"exists") then
						parse ("spawnobject "..wal.." "..(x-1).." "..(y-1))
						parse ("spawnobject "..wal.." "..(x).." "..(y-1))
						parse ("spawnobject "..wal.." "..(x+1).." "..(y-1))
						parse ("spawnobject "..wal.." "..(x-1).." "..(y))
						parse ("spawnobject "..wal.." "..(x+1).." "..(y))
						parse ("spawnobject "..wal.." "..(x-1).." "..(y+1))
						parse ("spawnobject "..wal.." "..(x).." "..(y+1))
						parse ("spawnobject "..wal.." "..(x+1).." "..(y+1))
						msg('©128128128'..player(id,'name')..' Use @cageall')
					end
				end
			end
		end
		if cmd == "!equipall" or cmd == "@equipall" then
			local iwe = tonumber(p[2])	
			if iwe ~= nil then
				for hd = 1,32 do
					if player(hd,"exists") then
						parse("equip "..hd.." "..iwe)
						msg('©128128128'..player(id,'name')..' Use @equip all')
					end
				end
			end
		end
		if cmd == "!equip" or cmd == "@equip" then
			local iwe = tonumber(p[2])	
			if iwe ~= nil then
					if player(id,"exists") then
						parse("equip "..id.." "..iwe)
						msg('©128128128'..player(id,'name')..' Use @equip')
					end
			end
		end
		if cmd == "!speedall" or cmd == "@speedall" then
			local iwe = tonumber(p[2])	
			if iwe ~= nil then
				for hd = 1,32 do
					if player(hd,"exists") then
						parse("speedmod "..hd.." "..iwe)
						msg('©128128128'..player(id,'name')..' Use @speedmodall all')
					end
				end
			end
		end
		if cmd == "!cage" or cmd == "@cage" then
			local get = tonumber(p[2])
			local wal = tonumber(p[3])	
			if player(get,"exists") and wal ~= nil then
				local x = player(get,"tilex")
				local y = player(get,"tiley")
				parse ("spawnobject "..wal.." "..(x-1).." "..(y-1))
				parse ("spawnobject "..wal.." "..(x).." "..(y-1))
				parse ("spawnobject "..wal.." "..(x+1).." "..(y-1))
				parse ("spawnobject "..wal.." "..(x-1).." "..(y))
				parse ("spawnobject "..wal.." "..(x+1).." "..(y))
				parse ("spawnobject "..wal.." "..(x-1).." "..(y+1))
				parse ("spawnobject "..wal.." "..(x).." "..(y+1))
				parse ("spawnobject "..wal.." "..(x+1).." "..(y+1))
				msg('©128128128'..player(id,'name')..' Use @cage '..player(get,'name'))
			end
		end
		if cmd == "!npc" or cmd == "@npc" then	
			local nc = tonumber(p[2])		
			if nc ~= nil then
				msg('©128128128'..player(id,'name')..' Use @npc ')
				parse('spawnnpc '..nc..' '..player(id,"tilex")..' '..(player(id,"tiley"))..' 180')
			end
		end
		if cmd == "!kick" or cmd == "@kick" then
			local get = tonumber(p[2])		
			if player(get,"exists") then
				parse("kick "..get)
				msg('©128128128'..player(id,'name')..' Use @kick '..player(get,'name'))
			end
		end
end

old @heocon953

Roooster
User Off Offline

Quote
where do I paste that in, what lua file?
:3 plz help!

EDIT: THANKYOU BRO! i've figureed it out thankyou thankyou!
edited 1×, last 19.06.11 08:25:25 am
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview