It's weird, fortunately, I never use timers
Forum
CS2D Scripts Lua Scripts/Questions/HelpIt's weird, fortunately, I never use timers
I've got to fix my problem with png images
The above script will load an image file.
If the image is a Windows BMP file, the script will store it's file size, width, height and color depth in a table under the fsize,w,h and bpp keys respectively and return the table.
If the image happens to be a PNG file, only the w and h values will be read.
Also, the format of the image and it's path will be stored in the typ and dir keys respectively (regardless if the file is a BMP or PNG file)
Yup, I planned to do that, but I wanted to do some less hacky stuff because there is already a timer() function implemented.
@Flacko
Nice, I might use it to help me position images properly.
Flacko has written
Hey guys, here I have fixed my bitmap mini-library:
I've got to fix my problem with png images
The above script will load an image file.
If the image is a Windows BMP file, the script will store it's file size, width, height and color depth in a table under the fsize,w,h and bpp keys respectively and return the table.
If the image happens to be a PNG file, only the w and h values will be read.
Also, the format of the image and it's path will be stored in the typ and dir keys respectively (regardless if the file is a BMP or PNG file)
I've got to fix my problem with png images
The above script will load an image file.
If the image is a Windows BMP file, the script will store it's file size, width, height and color depth in a table under the fsize,w,h and bpp keys respectively and return the table.
If the image happens to be a PNG file, only the w and h values will be read.
Also, the format of the image and it's path will be stored in the typ and dir keys respectively (regardless if the file is a BMP or PNG file)
Ahaha, glad to see other people using my work to destroy the wor.. I mean do good
1
player(id,"look")
Show the script.
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
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
function load(id) usgn = player(id,"usgn") if (usgn > 0) then local usgn = player(id, "usgn") files = io.open("sys/lua/dh/"..usgn..".txt","r") if(files~=nil) then msg2(id,"©160160255Your U.S.G.N ID: "..usgn.."@C") msg2(id,"©000255000Your Save file found!@C") parse('hudtxt2 '..id..' 100 "©000255000Login as: '..usgn..'" 40 415') for line in io.lines("sys/lua/dh/"..usgn..".txt","r") do local parses = totable(line) dh.credits = tonumber(parses[1]) break end else msg2(id,"©255000000Failed to load save!@C") msg2(id,"©255000000Please check your U.S.G.N account settings!@C") parse('hudtxt2 '..id..' 100 "©255000000Failed to Load Save" 40 415') end else parse('hudtxt2 '..id..' 100 "©255000000Failed to Login!" 40 415') msg2(id,"©255000000Please check your U.S.G.N account settings!@C") end end addhook("join","wata") function wata(id) load(id) end
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
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
function load(id) 	local usgn = player(id,"usgn") 	if (usgn > 0) then 		files = io.open("sys/lua/dh/"..usgn..".txt","r") 		if(files) then 			msg2(id,"©160160255Your U.S.G.N ID: "..usgn.."@C") 			msg2(id,"©000255000Your Save file found!@C") 			parse('hudtxt2 '..id..' 100 "©000255000Login as: '..usgn..'" 40 415') 			local parses = totable(files:read("*a")) 			dh.credits = tonumber(parses[1]) 		else 			msg2(id,"©255000000Failed to load save!@C") 			msg2(id,"©255000000Please check your U.S.G.N account settings!@C") 			parse('hudtxt2 '..id..' 100 "©255000000Failed to Load Save" 40 415') 		end 		files:close() 	else 		parse('hudtxt2 '..id..' 100 "©255000000Failed to Login!" 40 415') 		msg2(id,"©255000000Please check your U.S.G.N account settings!@C") 	end end addhook("join","wata") function wata(id) 	load(id) end
Blazzingxx has written
How did you used it?
Show the script.
Show the script.
I used it for older versions of CS2D for doom3 mod.
I doesnt have it now, but it was smth like:
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("spawn","d3_spawn") function d3_spawn(id) 	if(player(id,"look")==1) then 		parse("equip "..id.." 75) 	elseif other 3 times 	end end
Looks ids start from 0.
Seal = 0
GSG9 = 1
SAS = 2
GIGN = 3
1
if (files[b]~=nil[/b]) then
Starkkz has written
Flacko, you forgot something..
1
if (files[b]~=nil[/b]) then
1
if(files) then
file can either === true or is none
Flacko has written
try this
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
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
function load(id) 	local usgn = player(id,"usgn") 	if (usgn > 0) then 		files = io.open("sys/lua/dh/"..usgn..".txt","r") 		if(files) then 			msg2(id,"©160160255Your U.S.G.N ID: "..usgn.."@C") 			msg2(id,"©000255000Your Save file found!@C") 			parse('hudtxt2 '..id..' 100 "©000255000Login as: '..usgn..'" 40 415') 			local parses = totable(files:read("*a")) 			dh.credits = tonumber(parses[1]) 		else 			msg2(id,"©255000000Failed to load save!@C") 			msg2(id,"©255000000Please check your U.S.G.N account settings!@C") 			parse('hudtxt2 '..id..' 100 "©255000000Failed to Load Save" 40 415') 		end 		files:close() 	else 		parse('hudtxt2 '..id..' 100 "©255000000Failed to Login!" 40 415') 		msg2(id,"©255000000Please check your U.S.G.N account settings!@C") 	end end addhook("join","wata") function wata(id) 	load(id) end
Doesn't work, still no message and no loading credits. If this is important - i use local server hosted by option New Game.
@edit
when i use dedicated server (where my usgn isn't found) the fail message shows. But when i make straight from new game it doesn't say anything. On dedicated server i recieved error (finally)
1
ERROR: hudtxt(2) - text id out of bounds (0-49 expected)!
but i think it doesn't have anything with the rest of the code, i'll try changing text to shorter anyway.