Forum

> > CS2D > Scripts > I don't understand , where is the error ?
Forums overviewCS2D overview Scripts overviewLog in to reply

English I don't understand , where is the error ?

7 replies
To the start Previous 1 Next To the start

old I don't understand , where is the error ?

Kirito2K
User Off Offline

Quote
Hi all , today i want to make a script , and i just start , i made all thing but i forgot to check , when i finish i start to test it and it didn;t work , i don;t know why , can any one help me ?

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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
function initArray(m,v)
if not v then  v = 0 end
	local array = {}
	for i = 1, m do
	array[i]=v
	end
	return array
end

table_pick_itens = {64,65,66,67,68}

function totable(t,match)
local cmd = {}
	if not match then match = "%S+" end
		for word in string.gmatch(t, match) do
	table.insert(cmd, word:lower())
	end
return cmd
end

class = initArray(32,"None")
flood = initArray(32)
timer = initArray(32)
no_mute = initArray(32)
muted=initArray(32,false)
local timer_mute = 60
hats = true

addhook("say","_say")
addhook("serveraction","_serveraction")
addhook("menu","_menu")
addhook("walkover","_walkover")
addhook("drop","_drop")
addhook("buy","_buy")
addhook("die","_die")
addhook("team","_team")
addhook("build","_build")
addhook("second","_second")
addhook("leave","_leave")
addhook("join","_join")

_say = function (id,txt)
local p = totable(txt)
local cmd = tostring(p[1])
local pl = tonumber(p[2])
if cmd == "!usgn" then
	msg2(id,"\169050050255Usgn : "..player(pl,"usgn").." ")
	msg2(id,"\169050255050IP : "..player(pl,"ip").." ")
	msg2(id,"\169050050255Ping : "..player(pl,"ping").." ")
	return 1
elseif cmd == "!help" then
	msg2(id,"\169255255255-=Help=-")
	msg2(id,"\169255255255Script made by P!r@te$ k!ller , USGN : 120840")
	msg2(id,"\169255255255Have fun .")
	return 1
elseif cmd == "!class" then
	msg2(id,"\169255255255Your class is "..class[id].."")
	return 1
elseif cmd == "!cmds" then
	msg2(id,"\169255255255-=Cmds=-")
	msg2(id,"\169255255255!usgn : To see your usgn , ip and ping .")
	msg2(id,"\169255255255!help : Just small help ..")
	msg2(id,"\169255255255!cmds : To see the cmds .")
	msg2(id,"\169255255255!class : To see your class .")
	return 1
end
		if flood[id] == 8 then
			msg2(id,"\169255000000Stop Flood or mute@C")
		end
	
		if flood[id] == 15 then
			muted[id] = true
			no_mute[id] = timer_mute
		end
		
		if muted[id] == true then
				msg2(id,"\169255255255You hare muted, for "..timer_mute.." Seconds")
			timer[id] = 5
			return 1
		end
	
			msg("\169255255255"..player(id,"name").." / \169255000000"..class[id].." \169255255255/ : "..txt)
			flood[id] = flood[id] +1
			timer[id] = 5
	return 1
end

_serveraction = function (id,action)
	if action == 1 then
		if player(id,"health") > 0 then
				menu_classe(id)
		else
				msg2(id,"\169255000000Error,you can not open the menu when you're dead")
		end
	elseif action == 2 then
		if player(id,"health") > 0 then
				menu_shop(id)
		else
				msg2(id,"\169255000000Error,you can not open the menu when you're dead")
		end
	elseif action == 3 then
		if hats == true then
			if player(id,"health") > 0 then
				menu_hats(id)
			else
				msg2(id,"\169255000000Error,you can not open the menu when you're dead")
			end
		else
				msg2(id,"\169255000000Error,Hats Desactived for Admin or Moderator")
		end
	end
end

_menu = function (id,title,buton)
	if title == "Menu Class" then
		if buton == 1 then -- Medic
			class[id] = "Medic"
			spawn(id)
			strip(id,0)
			speed(id,15)
			armor(id,204)
			equip (id,10)
			hp(id,100)
		elseif buton == 2 then --Invisible
			class[id] = "Invisible"
			spawn(id)
			strip(id,0)
			speed(id,25)
			armor(id,206)
			equip (id,46)
			hp(id,100)
		elseif buton == 3 then -- Explosive
			class[id] = "Explosive"
			spawn(id)
			strip(id,0)
			speed(id,11)
			armor(id,200)
			equip (id,48,49,51,76,73)
			hp(id,125)
		elseif buton == 4 then -- Rifler
			class[id] = "Rifler"
			spawn(id)
			strip(id,0)
			speed(id,5)
			armor(id,202)
			equip (id,3,30,32,52)
			hp(id,100)
		elseif buton == 5 then -- Sniper
			class[id] = "Sniper"
			spawn(id)
			strip(id,0)
			speed(id,1)
			armor(id,201)
			equip(id,4,34,35)
			hp(id,150)
		elseif buton == 6 then -- Portal
			class[id] = "Portal"
			spawn(id)
			strip(id,0)
			speed(id,31)
			armor(id,200)
			equip (id,1,77,87,88)
			hp(id,250)
		elseif buton == 7 then -- Mito
			class[id] = "Mito"
			spawn(id)
			strip(id,0)
			speed(id,5)
			armor(id,100)
			equip(id,2)
			equip (id,2,20,38,39)
			hp(id,100)
		elseif buton == 8 then -- Construtor
			class[id] = "Construtor"
			spawn(id)
			strip(id,0)
			speed(id,15)
			armor(id,203)
			equip (id,3,6,21,74)
			hp(id,130)
		elseif buton == 9 then -- Titan
			class[id] = "Titan"
			spawn(id)
			strip(id,0)
			speed(id,-15)
			armor(id,205)
			equip (id,51,76,90,91)
			hp(id,120)
		elseif buton == 0 then -- None Class
			class[id] = "None"
			spawn(id)
			strip(id,0)
			speed(id,0)
			armor(id,0)
			hp(id,100)
			return nil
		end
	end
	if title == "Menu Shop" then
		if buton == 1 then
				if player(id,"money") > 4999 then
					equip(id,77,87)
					removemoney(id,5000)
				else
					semgrana(id)
				end
		end
		if buton == 2 then
				if player(id,"money") > 3999 then
					equip(id,65)
					removemoney(id,4000)
				else
					semgrana(id)
				end
		end
		if buton == 3 then
				if player(id,"money") > 6999 then
					equip(id,64)
					removemoney(id,7000)
				else
					semgrana(id)
				end
		end
	end
	if title == "Menu Cap" then
		if buton == 1 then
			freeimage(id)
			cap_1 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_1,255,0,0)
		elseif buton == 2 then
			freeimage(id)
			cap_2 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_2,0,255,0)
		elseif buton == 3 then
			freeimage(id)
			cap_3 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_3,0,0,255)
		elseif buton == 4 then
			freeimage(id)
			cap_4 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_4,255,255,0)
		elseif buton == 5 then
			freeimage(id)
			cap_5 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_5,0,255,255)
		elseif buton == 6 then
			freeimage(id)
			cap_6 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_6,255,0,255)
		elseif buton == 7 then
			freeimage(id)
			cap_7 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_7,0,0,0)
		elseif buton == 8 then
			freeimage(id)
			cap_8 = image("gfx/cap.png",1,0,200+id)
			imagecolor(cap_8,255,255,255)
		elseif buton == 9 then
			freeimage(id)
		end
	end
end

_walkover = function (id,iid,type,ain,a,mode)
for _, j in ipairs(table_pick_itens) do
	if type == j then
		return 0
	end
end
return 1
end

_drop = function (id,iten)
	return 1
end

_buy = function (id)
	msg2(id,"\169255000000Error,Buy weapons desactived")
	return 1
end

_die = function (id)
	class[id] = "None"
	menu_classe(id)
end

_team = function (id,team)
	menu_classe(id)
end

_build = function (id,type,x,y)
for i,j in ipairs({2,4,5,7,9,13,14}) do if type == j then msg2(id,"Building Disabled@C") return 1 end end
end

_second = function (id)
	for id = 1,32 do
		if timer[id] > 0 then
			timer[id] = timer[id] -1
        else
			flood[id] = 0
		    end
		end
    for _,id in pairs(player(0,"table")) do
	      if muted[id] == true then
		  no_mute[id] = no_mute[id]-1
		  end
		  if no_mute[id] == 0 then
		  muted[id] = false
		end
	end
	parse ("sv_gamemode 2 ")
	parse ("mp_infammo 1 ")
	parse ('mp_building_limit "barricade" 1')
	parse ('mp_building_limit "wall I" 2')
	parse ('mp_building_limit "wall II" 2')
	parse ('mp_building_limit "wall III" 2')
	parse ('mp_building_limit "gate field" 4')
	parse ('mp_building_limit "turret" 1')
	parse ('mp_building_limit "dispenser" 1')
	parse ('mp_building_limit "supply" 1')
	parse ('mp_building_limit "Teleporter Entrance" 0')
	parse ('mp_building_limit "Teleporter Exit" 0')
	
end

_leave = function (id)
	muted[id] = false
end

_join = function (id)
	flood[id] = 0
	muted[id] = false
end

strip = function (id,iten)
	parse ("equip "..id.." 50")
	parse ("strip "..id.." "..iten)
end

armor = function (id,armor)
	parse ("setarmor "..id.." "..armor)
end

equip = function(id,...)
 for _,wep in ipairs(arg) do
  parse("equip "..id.." "..wep)
 end
end

speed = function (id,speed)
	parse ("speedmod "..id.." "..speed)
end

spawn = function (id)
	parse ("spawnplayer "..id.." -1 -1")
end

hp = function (id,hp)
	parse ("setmaxhealth "..id.." "..hp)
end

removemoney = function (id,mon)
	parse ("setmoney "..id.." "..(player(id,"money")-mon))
end

menu_classe = function (id)
	menu(id,"Menu Class,Medic,Invisible,Explosivo,Rifler,Sniper,Portal,Mito,Construtor,Titan")
end

menu_shop = function (id)
	menu(id,"Menu Shop,Mines|$5000,+20 HP|$4000,Full HP|$7000")
end

menu_hats = function (id)
	menu (id,"Menu Cap,Cap Red,Cap Green,Cap Blue,Cap Yellow,Cap Cyan,Cap Pink,Cap Black,Cap White,None Cap")
end

semgrana = function (id)
	msg2(id,"\169255000000Error,You no have money")
end

old Re: I don't understand , where is the error ?

Inflexion
User Off Offline

Quote
Hello sir author, I did not understand your error.
Reply with the error that you've got please.
and also , if the script did not run.
copy all files (without removing them from sys/lua)
to sys/lua/autorun, when you copy them exactly. you will have to start the server. if there any errors on the console, post them


- Note: Add me on skype, I can help you with the grammar errors., because you've writed many words with bad english,I can you help you on them.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview