Lua Scripts/Questions/Help
6,770 replies 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 ??

EDIT: i am good at English but dose there any Lua manual on Arabic ??
Call Of Duty - World At War [Work on progress] | official CoD scripts site
I wouldn't bet on it memo. Thanks Flacko for everything.

I detest that man who hides one thing in the depths of his heart, and speaks for another.
It seems like it's only in english, spanish, portuguese, russian and hungarian.
Edit:
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/
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 dont copy and paste, i see the problem to dont make it again
I just wanna know, why is my lua not workin!
I just wanna know, why is my lua not workin!
edited 1×, last 22.01.10 04:23:17 am
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.

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.
I detest that man who hides one thing in the depths of his heart, and speaks for another.
uhm... I don't really understand what you are trying to do but you can use this:
It will return the index where it has been found.
Note that it will return when it has been found for first time.
Code:
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
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
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

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.
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.
Code:
1
timer(8000,"",freeimage(fad[p])
@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:
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
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:
Code:
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
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
@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.
But here is the code. And i don't know how i can fix it.
The code highlighted
http://pastebin.com/m36aa9310
The code
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.
Code:
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
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
22.01.10 06:20:51 pm
Help me plz. i su*k at lua
what i do wrong?

Code:
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')
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?

^.^ all
Code:
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
parse('hudtxt2 '..id..' 1 "©000255000Score: '..player(id,"score")..'" 150 10')
end
addhook("kill","get_score")
function get_score(id)
updatehud(id)
end
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 :
Code:
1
LUA ERROR :attempt to call a nil value
but on LuaEdit program it tells me
Code:
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
Call Of Duty - World At War [Work on progress] | official CoD scripts site
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 :
Code:
1
LUA ERROR :attempt to call a nil value
but on LuaEdit program it tells me
Code:
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:
Code:
?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
@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 .
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 .

Call Of Duty - World At War [Work on progress] | official CoD scripts site
memo has written:
Any help
I don`t get what you want to do with this line:
Code:
1
if (team>0) then
but if you are trying to select which team will get the menu then it should be:
Code:
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
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:
Code:
1
2
3
4
5
2
3
4
5
addhook("spawn","dh4.team")
function dh4.team(id,team)
dh4.classmenu(id)
end
end
function dh4.team(id,team)
dh4.classmenu(id)
end
end
yes thanks i already fix the problem , thanks any way :D.
EDIT : -
what this massage means ??

what this massage means ??
Code:
1
LUA ERROR: attempt to concatenate field "?" a nil value
edited 1×, last 22.01.10 10:52:35 pm
Call Of Duty - World At War [Work on progress] | official CoD scripts site