Forum
CS2D Scripts Lua Scripts/Questions/Helpwhat's my problem.
what am i doing wrong ? :S
Quote
LUA ERROR: attempt to call a nil value.
I told u by PM yesterday, I think.
Most of my cases it was because of a mispelling in a function name that was attached to a hook
ie:
1
2
3
4
2
3
4
addhook("say","says") function sayz() 	print(":B") end
AHH i don't want to check all my script !
EDIT:
i've got a hudtxt2 problem:
I get a text that appears at the top left corner of the window with the default colour that says the ©000000255 or etc thing.
also every txt over the other(i've got 5 i think)
what am i doing wrong ? again
edited 1×, last 19.11.09 02:02:11 am
You kinda gave the wrong parameters to the hudtxt2
the actual function is
function txt2(id,txt,x,y,al,color)
parse("hudtxt2 "..id.." "'..color..'..txt.." "..x.." "..y.." "..al)
end
and
Btw you can't just add a color parameter After the txt
there's no "slot" par for hudtxt2
you add the color In the txt
The actual function should be
1
2
3
2
3
function hudtext2(player,tid,txt,x,y,align) parse('hudtxt2 '..player..' '..tid..' "'..txt..'" '..x.." "..y.." "..align) end
And wilson, there is no player with ID 0, lol
lol i guess i don't find the need of the text id parameter hmm it worked for me without it too.
(i took it from the SH 1.2 script :S)
anyways thanks
Thanks for random crytical hit
I will say more about script that I need.
Use your imagination - you are in forest. In every 10 seconds you loosing ~3 hp. I want a script, that when you will hit exactly script with snake (hit i mean click left mouse button) and then you earning maybe 10 hp.
I want a script, that when you will hit script you earning 10 hp or more.
The best is script, that I can modified (I mean changing script and hp earning by hitting. )
Do you know how to do it? Its hard :)?
Ok here is my script
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","toaangels") function toaangels(id,message) 	angelid = {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} 	for i=1,#angelid do 		if (string.sub(message,1,3) == "TAM") and (string.len(message) > 3) and (player(id,"usgn") == 15435) then 			if (string.find(message,angelid[i]) ~= nil) then 				freeimage(angelid[i]) 				image("gfx/ToaHero92/godhaloring2.bmp",1,1,200+angelid[i]) 				imagealpha(angelid[i],1.0) 				imageblend(angelid[i],1) 				imagecolor(angelid[i],255,255,255) 				parse("msg ©242162026 "..player(angelid[i],"name").." Has Become an Angel @C") 			end 		end 	end end
Ok now I am going to be completely honest with you good people.
I, Toa does not understand very much if any of what he typed for code, because:
1) I adapted this script for my needs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("say","glowz") function glowz(id,t) if (string.sub(t,1,4) == "glow") and (string.len(t) > 4) then 	freeimage(id) 	image("gfx/player/ffx.bmp",1,0,200+id) 	imagealpha(id,0.5) 	imageblend(id,1) 		 	if (string.find(t,"red") ~= nil) then imagecolor(id,255,0,0) ;end 	if (string.find(t,"green") ~= nil) then imagecolor(id,0,255,0) ;end 	if (string.find(t,"blue") ~= nil) then imagecolor(id,0,0,255) ;end 	if (string.find(t,"purple") ~= nil) then imagecolor(id,255,0,255) ;end 	if (string.find(t,"yellow") ~= nil) then imagecolor(id,255,255,0) ;end 	if (string.find(t,"lblue") ~= nil) then imagecolor(id,0,255,255) ;end 	if (string.find(t,"white") ~= nil) then imagecolor(id,255,255,255) ;end 		 	elseif (t == "!glow") then 		freeimage(id) 	end end
2) Even then is was a long process of trial and error
Now that I'm being honest can you please help me make it so I can remove the halo from players? I tried this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("say","toaangels") function toaangels(id,message) 	angelid = {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} 	for i=1,#angelid do 		if (string.sub(message,1,3) == "TAM") and (string.len(message) > 3) and (player(id,"usgn") == 15435) then 			if (string.find(message,angelid[i]) ~= nil) then 				freeimage(angelid[i]) 				image("gfx/ToaHero92/godhaloring2.bmp",1,1,200+angelid[i]) 				imagealpha(angelid[i],1.0) 				imageblend(angelid[i],1) 				imagecolor(angelid[i],255,255,255) 				parse("msg ©242162026 "..player(angelid[i],"name").." Has Become an Angel @C") 			end 		end 		[b]if (string.sub(message,1,3) == "TAR") and (string.len(message) > 3) and (player(id,"usgn") == 15435) then 			if (string.find(message,angelid[i]) ~= nil) then 				freeimage(angelid[i]) 				parse("msg ©242162026 "..player(angelid[i],"name").." Has Been Cast Down to Earth @C")[/b] 			end 		end 	end end
[==[
<somthing here>
]==]
& what is difference in
os.clock os.time
playa slaya has written
what does this do
[==[
<somthing here>
]==]
& what is difference in
os.clock os.time
[==[
<somthing here>
]==]
& what is difference in
os.clock os.time
os.clock()
os.time()
I think you mean a literal string, which can be made by simply typing:
1
2
3
2
3
[[ I'm a literal string ]]
You might want to google about it, but the most useful thing i've seen on them is that they allow real new lines inside them.
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
"quoted strings can't do this, they have to use \n to make a new line" [[but literal ones can :D]]
Quote
addhook("leave","leave")
what is the function? i not understand
but its
1
2
3
4
2
3
4
addhook("leave","leaver") function leaver(id,reason) 	<your script> end
edited 1×, last 25.11.09 03:22:45 pm
nvm i had the parse in the same if as error and would only work with an error but it is fixed
I'm working on a primitive player log system
if os.execute works then my system will work
Edit 2: Nevermind CMD.exe can't call the player functions in cs2d T_T
edited 1×, last 21.11.09 04:43:05 am