Forum

> > CS2D > Scripts > Lua error !!
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua error !!

2 replies
To the start Previous 1 Next To the start

old Lua error !!

Jhony
User Off Offline

Quote
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
addhook("second","ekip")
function ekip(id)
if player(id,"team") == 1 then
for l = 1,49 do
parse("strip "..l)
end
for v = 52,59 do
parse("strip "..v)
end
for y = 61,68 do
parse("strip "..y)
end
for x = 74,81 do
for i = 1,32 do
parse("strip "..x)
parse("strip "..i.." 84")
parse("strip "..i.." 86")
parse("strip "..i.." 87")
parse("strip "..i.." 89")
parse("strip "..i.." 90")
parse("strip "..i.." 91")
parse("strip "..i.." 92")
return l,v,y,x,i,1
end
end
if player(id,"team") == 2 then
parse("strip "..i.." 85")
parse("strip "..i.." 83")
parse("strip "..i.." 69")
parse("strip "..i.." 60")
parse("strip "..i.." 72")
return i,1
end
end
end

fix please

LUA ERROR: sys/lua/yyy.lua:1528: bad argument #1 to 'player' (number expected, got nil)

old Re: Lua error !!

Yates
Reviewer Off Offline

Quote
The second hook does not have an id parameter.
1
if player(id,"team") == 1 then
Will not work.

And tab your code for fuck sake.

old Re: Lua error !!

Powermonger
User Off Offline

Quote
So if I understood correctly, you want players only use weapons 50, 51, 60, 69, 70, 71, 72 and 73 right?
And if player is using something else, it will be stripped.

If thats true, you should try select hook:
1
2
3
4
5
6
7
addhook("select","ekip")
function ekip(id)
local p = player(id,"weapontype")
	if p ~= 50 or p ~= 51 or p ~= 60 or p ~= 69 or p ~= 70 or p ~= 71 or p ~= 72 or p ~= 73 then
		parse("strip "..id.." "..p)
	end
end
Works?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview