Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2144 145 146338 339 Next To the start

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
omg this massage keep coming no matter what i do ...

1
2
LUA ERROR:lua 52 attempt to concatenate field "?" a
 nil value

here is the script :
Spoiler >


any help to fix this thing .

old Re: Lua Scripts/Questions/Help

Zanahoria
User Off Offline

Quote
here's my problem
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?
Spoiler >

PD: Don't FIX MY PROBLEM
I only wanna know where is the PROBLEM, cuz later a guy will trouble me

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
@Memo: Blazzing alredy told you like four times what does nil mean.
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.

old Re: Lua Scripts/Questions/Help

Zanahoria
User Off Offline

Quote
I read it
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 06:43:46 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

TicTac
BANNED Off Offline

Quote
1
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 -.-

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
1
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.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
TicTac has written
Is it possible to make every round gives me new weapon ..
m4a1 or ak47?
some 1 help


I made script like that some time ago.
Note: only for standart mode.

• Random Weapons Rounds By Blazzingxx
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("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

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
How to get ID of the last created weapon? I mean, hook "build" does not work for "spawnobject" command.
If it is impossible, then how to get last number from the table?

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
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!


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.

old Re: Lua Scripts/Questions/Help

Zeik
User Off Offline

Quote
Hi, I made this script...
1
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
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

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
RiT has written
Hi, I made this script...
Code:
if gut==nil then gut={} end
gut.hit={}

1
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])
you specified the hook wrong

I fixed that:
1
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
To the start Previous 1 2144 145 146338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview