Forum
Scripts
Lua Scripts/Questions/Help1
2
2
LUA ERROR:lua 52 attempt to concatenate field "?" a nil value
here is the script :
any help to fix this thing .
when i select fiveseven a laser appears.
but if i wanna have another weapon (M3) with this stuff, only the M3 works and the fiveseven not.
WHERE'S the problem?
PD: Don't FIX MY PROBLEM
I only wanna know where is the PROBLEM, cuz later a guy will trouble me
You also have a beatiful manual explaining the propieties of nil.
But I will repeat you again what blazzing told you:
Nil means that a variable hasn't been declared or has been explicitly assigned to nil (a = nil).
An attempt to concatenate a nil variable (assigned or undeclared) will raise a Lua error.
@Zanahoria:
Your problem is that you haven't read this:
http://www.lua.org/manual/5.1/es/
Edit:
For you guys that find the manual very hard, you could try to read this:
http://www.lua.org/pil/
Then this
http://www.lua.org/manual/5.1/
And finally you can read the garry's mod wiki which has plenty of examples and useful snippets.
Your problem were a "if" that was there
but doesnt works
It's another problem? somebody can see it?
edited 1×, last 23.01.10 05:43:46 am
Zanahoria has written
I read it
That's a lie because you can't make an if- sentence.
http://i48.tinypic.com/2d9a2u.png
Moreover, the whole idea of your script is weird.
Instead of making the laser transparent, which would be the easiest way, you chose to free the image and do some strange stuff.
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("kill","get_score")
function get_score(id)
updatehud(id)
end
function updatescore(id)
parse('hudtxt2 '..id..' 1 "©000255064Score: '..player(id,"score")..'" 3 125 0')
end
some 1 help me fix it. it shows me update error -.-
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("kill","get_score")
function get_score(id)
	[b]updatehud(id)[/b]
end
function [b]updatescore(id)[/b]
	parse('hudtxt2 '..id..' 1 "©000255064Score: '..player(id,"score")..'" 3 125 0')
end
Those BOLD functions didn't match.
thx blazzingxx i didnt see that
Flacko has written
For you guys that find the manual very hard, you could try to read this:
http://www.lua.org/pil/
http://www.lua.org/pil/
Much better :D,it`s a 100times easier than the other lua manual.
m4a1 or ak47?
some 1 help
TicTac has written
Is it possible to make every round gives me new weapon ..
m4a1 or ak47?
some 1 help
m4a1 or ak47?
some 1 help
I made script like that some time ago.
Note: only for standart mode.
Random Weapons Rounds By Blazzingxx1
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
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("startround","fun_startround")
addhook("buy","fun_buy")
addhook("drop","fun_drop")
weapons_table = {{38,21},{11},{24,5},{30,51},{32,51},{34,35},{87,88},{10,47}} -- Multiple Table Of Weapons - [level][Weapons]
speed_table = {0,0,0,0,0,0,0,0,0} -- Table Of Speed For Each Level
function fun_startround()
	local i, m
	local msg_wpn = ""
	local items = math.random(1,#weapons_table)
	for i = 1,32,1 do		
		for m = 1,#weapons_table[items],1 do
			parse("equip "..i.." "..weapons_table[items][m])
		end
		if (speed_table[items] == true) then
			parse('speedmod '..i..' '..speed_table[items])
		end
	end
	for i = 1, #weapons_table[items] do
		if (i > 1) then
			msg_wpn = msg_wpn.." + "
		end
		msg_wpn = msg_wpn..itemtype(weapons_table[items][i],"name")
	end
	msg("©000255000"..msg_wpn.." Round!@C")
end
function fun_buy()
	return 1
end
function fun_drop()
	return 1
end
If it is impossible, then how to get last number from the table?
i only ask for help!
i only wanna know why doesnt works!
IS NOT FAIR!
Zanahoria has written
alright ... No fair! they ask for lua's and people do it!
i only ask for help!
i only wanna know why doesnt works!
IS NOT FAIR!
i only ask for help!
i only wanna know why doesnt works!
IS NOT FAIR!
Only if the idea is completely novel and those who are experienced in Lua find it intellectually stimulating to create such a script would they actually do it. If however they ask for the same mundane set of functionality that are:
1. Easy to write...
2. Already been asked for and/or written
then we would not be so kind to them.
memo has written
can any one give me a site who learn Nil value/global nil ?
See this:
http://www.lua.org/pil/2.1.html
And maybe this:
http://www.lua.org/pil/2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
if gut==nil then gut={} end
gut.hit={}
addhook("hit","gut.hit","team")
function gut.hit(id,source,wpn,hpdmg,apdmg)
	if (wpn == 86) then
	if player(id,"team")==2 then
		parse("sethealth "..id.." "..player(id,"health")-200)
		team = 1
		return 1
		end
	end
end
Is anyone can say me where is the error or what it is, please help me
thanks, bye
RiT has written
Hi, I made this script...
Code:
if gut==nil then gut={} end
gut.hit={}
It hasn't got errors, my idea was, when a zombie throws a gut bomb, the survivor die and go to zombies. But, when the zombie throws it, the survivors just get damaged.
Is anyone can say me where is the error or what it is, please help me
thanks, bye
Code:
if gut==nil then gut={} end
gut.hit={}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook("hit","gut.hit","team")
function gut.hit(id,source,wpn,hpdmg,apdmg)
if (wpn == 86) then
if player(id,"team")==2 then
parse("sethealth "..id.." "..player(id,"health")-200)
team = 1
return 1
end
end
end
It hasn't got errors, my idea was, when a zombie throws a gut bomb, the survivor die and go to zombies. But, when the zombie throws it, the survivors just get damaged.
Is anyone can say me where is the error or what it is, please help me
thanks, bye
wtf is this?
1
addhook("hit","gut.hit",[b]"team"[/b])
I fixed that:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook("hit","gut.hit")
function gut.hit(id,source,wpn,hpdmg,apdmg)
if (wpn == 86) then
if player(id,"team")==2 then
parse("sethealth "..id.." "..player(id,"health")-200)
team = 1
return 1
end
end
end
Lua Scripts/Questions/Help


Offline
