EDIT: i am good at English but dose there any Lua manual on Arabic ??
Forum
CS2D Scripts Lua Scripts/Questions/HelpEDIT: i am good at English but dose there any Lua manual on Arabic ??
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
I just wanna know, why is my lua not workin!
edited 1×, last 22.01.10 04:23:17 am
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.
1
2
3
4
5
6
7
8
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
Note that it will return when it has been found for first time.
edited 1×, last 22.01.10 05:47:57 am
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.
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.
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])
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
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
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
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
edited 1×, last 22.01.10 03:07:51 pm
1
2
3
4
5
6
7
8
9
10
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?
1
2
3
4
5
6
7
8
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
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 :
Any help
edited 2×, last 22.01.10 07:21:59 pm
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?
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
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 :
but on LuaEdit program it tells me
what the hill this 2 massages mean .
the wrong is on this line :
Any help
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 :
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
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 .
memo has written
Any help
I don`t get what you want to do with this line:
1
if (team>0) then
1
2
3
4
5
6
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
and if you want menu on spawn:
1
2
3
4
5
2
3
4
5
addhook("spawn","dh4.team") function dh4.team(id,team) dh4.classmenu(id) end end
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