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 2143 144 145338 339 Next To the start

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
Yea thanks Flacko i will learn it and help you to answer the newbie who ask here ... i will become a nerd just like you

EDIT: i am good at English but dose there any Lua manual on Arabic ??

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
It seems like it's only in english, spanish, portuguese, russian and hungarian.

Edit:
Zanahoria has written
Can somebody fix my problem?

Yes, the best person to fix your problem is yourself, so read your stuff instead of copying it, because you are completely unable to make an if statement.
And, as I said, read the fucking manual
http://www.lua.org/manual/5.1/
edited 2×, last 22.01.10 04:03:39 am

old Re: Lua Scripts/Questions/Help

Zanahoria
User Off Offline

Quote
I dont copy and paste, i see the problem to dont make it again
I just wanna know, why is my lua not workin!
edited 1×, last 22.01.10 04:23:17 am

old Re: Lua Scripts/Questions/Help

Homer
User Off Offline

Quote
Zana, It's not that you just copy and paste, Just don't paste your script and ask them to fix it People seem to like it better when you ask how to do something and they can tell you. Not that I'm the best by far, but it might help :D. And a Question, How can you find a value in a table, like I didn't find a table.find and so, I was curious on how to do this. Like this.
table={1,2,3,4}
addhook("say","Random")
function Random(txt,id)
if (txt == "!Ran") then
table.insert(table,id)
Randomint = table[i = id] No Idea how to do this.
if (Randomint == 5) then
Bla bla bla. Help? I don't know really what to do, could you use the string.find? I don't really know if you can even do this.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
uhm... I don't really understand what you are trying to do but you can use this:
1
2
3
4
5
6
7
8
function table.find(t,v) --t is the table you want to search and v is the value
	for i,value in ipairs(t) do --loop through the table
		if value == v then --check if the value is the one whe are looking for
			return i --return the index where we found the value
		end
	end
	return nil --the value hasn't been found, so we return nil
end
It will return the index where it has been found.
Note that it will return when it has been found for first time.
edited 1×, last 22.01.10 05:47:57 am

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
memo has written
Yea thanks Flacko i will learn it and help you to answer the newbie who ask here ... i will become a nerd just like you

Don`t think you know lua scripting more than me,you are just a newbie at lua scripting as I am.
Flacko has written
@Redefinder: (I'm mad)
It's always the same shit here.
You guys don't even bother at looking at your own piece of code, just "let the nerds solve this shit". I wouldn't be surprised if most of you haven't read the manual.

Yes I haven`t read the tutorial,it`s a difficult tutorial ,but now I will read it and try very hard to understand it.

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
I think i sucks at this timers.
What do i wrong?

The timer should free the image that is inside fad[p] after 8 seconds. And the readme is too hard too understand about the timers too.
1
timer(8000,"",freeimage(fad[p])

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@redefinder
Everyday, people asks same questions.
Everyday, people wants us to fix same their bugs!

Why? Why the h**l they can't learn it?
Lua - easiest scripting/programming language ever!

Like you, redefinder.
I think you are asking questions for about two months... (or even more)
Why are you still asking same things?

@wups,
Hmm, I think "freeimage" function shouldn't be on ["p"] string parameter at all...

I checked...
Yes, you are using it completely wrong.
That's example of use:
1
2
3
4
5
6
7
8
9
10
11
12
13
counts = 5
milisecs = 1000 -- (1 second)

timer(milisecs,"CS2D_TIME",0,counts)

function CS2D_TIME()
	counts = counts - 1
	if (counts > 0) then
		print("Timer working - It's going to be removed after "..counts.." times!")
	else
		print("Timer is removed!")
	end
end

I suggest to make own image removing functions, so it's easier to use them on timers.

Output Screenshot:
http://img121.imageshack.us/img121/3506/59134530.png
edited 4×, last 22.01.10 02:24:29 pm

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
@blazzingxx
Yeh i fixed it. And now something is really weird with the code. I fixed so the timer starts, but that doesn't end. So i put own function too stop the timer. And now the timer doesn't work after that little fix.

And when i put "1" after the code, it didn't stop the timer at all.

Like this: timer(2000,"timer2",fad[p],1)


And here is the example of you code.
If you write hi one time, its works exactly like you have write.

But if we add "p" to the timer, that i should take the player. And use one time, it works perfectly.

But if we use it again, you will get 4 message about removing.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("say","tst")
function tst(p,t)
	if t == "hi" then 
	counts = 4
		timer(1000,"CS2D_TIME",p,counts)
	end
end

function CS2D_TIME(p)
     counts = counts - 1
     if (counts > 0) then
          print("Timer working - It's going to be removed after "..counts.." times! "..p)
     else
          print("Timer is removed!")
     end
end





But here is the code. And i don't know how i can fix it.

The code highlighted
http://pastebin.com/m36aa9310

The code
Spoiler >
edited 1×, last 22.01.10 03:07:51 pm

old HELP

TicTac
BANNED Off Offline

Quote
Help me plz. i su*k at lua

1
2
3
4
5
6
7
8
9
10
function updatescore(id)
parse('hudtxt2 ')
end

addhook("kill","get_score")
function get_score(id)
updatehud(id)
end 

parse('hudtxt2 '..id..' 1 "©000255000Score: '..player(id,"score")..'" 150 10')

what i do wrong?

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
1
2
3
4
5
6
7
8
function updatescore(id) 
parse('hudtxt2 '..id..' 1 "©000255000Score: '..player(id,"score")..'" 150 10')
end 

addhook("kill","get_score") 
function get_score(id) 
updatehud(id) 
end

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
Hi,i am still reading the Lua 5.0 Reference Manual.

i am making D-H again so i start to make the class script i do it all right , it work with Cs2d all thing add on console then
this massage appears :
1
LUA ERROR :attempt to call a nil value

but on LuaEdit program it tells me
1
attempt to call global 'addhook' (a nil value)

what the hill this 2 massages mean .

the wrong is on this line :
Spoiler >


Any help
edited 2×, last 22.01.10 07:21:59 pm

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
Blazzingxx has written
@redefinder
Everyday, people asks same questions.
Everyday, people wants us to fix same their bugs!

Why? Why the h**l they can't learn it?
Lua - easiest scripting/programming language ever!

Like you, redefinder.
I think you are asking questions for about two months... (or even more)
Why are you still asking same things?

I don`t think so,that manual is hard and I hardly understand anything that is written there,I read leegao`s and TKD`s tutorials and believe me they`re WAY EASIER!.And I`m not really asking the same questions,I`m getting better at lua

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
memo has written
Hi,i am still reading the Lua 5.0 Reference Manual.

i am making D-H again so i start to make the class script i do it all right , it work with Cs2d all thing add on console then
this massage appears :
1
LUA ERROR :attempt to call a nil value

but on LuaEdit program it tells me
1
attempt to call global 'addhook' (a nil value)

what the hill this 2 massages mean .

the wrong is on this line :
Spoiler >


Any help

Did you write smth like:
1
if (dh4==nil) then dh4={} end
?
Because if dh4=nil, all of dh4.smth will be nil too.
I prefer "_" instead of "." in my scripts

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
@Vectar666
thanks for help but i know what the problem its not with the Nil value it with some line on the first script i add it by wrong thanks very much any way for help me .

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
memo has written
Any help

I don`t get what you want to do with this line:
1
if (team>0) then
but if you are trying to select which team will get the menu then it should be:
1
2
3
4
5
6
addhook("team","dh4.team")
function dh4.team(id,team)
     if (player(id,"team") == [b]1[/b]) then
          dh4.classmenu(id)
     end
end
Spoiler >

and if you want menu on spawn:
1
2
3
4
5
addhook("spawn","dh4.team")
function dh4.team(id,team)
          dh4.classmenu(id)
     end
end

old Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Quote
yes thanks i already fix the problem , thanks any way :D.


∗ EDIT : -

what this massage means ??
1
LUA ERROR: attempt to concatenate field "?" a nil value
edited 1×, last 22.01.10 10:52:35 pm
To the start Previous 1 2143 144 145338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview