Forum

> > CS2D > Scripts > Load images in game
Forums overviewCS2D overview Scripts overviewLog in to reply

English Load images in game

1 reply
To the start Previous 1 Next To the start

old Load images in game

EP
User Off Offline

Quote
Is it possible? I tried this but it doesn't work when i call the function. And it works when i put the correct filename. But i want to call an image INGAME.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function totable(t,match)
	local cmd = {}
	if not match then match = "[^%s]+" end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end 
	return cmd 
end

function putimage(name)
image("gfx/"..name.."",1,1,1)
end

addhook("say","a")
function a(id,txt)
local p = totable(txt)
	if txt == "!image" then
		freeimage(id)
		local asd = tostring(p[2])
		putimage(asd)
		return 1
	end
end

old Re: Load images in game

Deleted User

Quote
Change

1
2
3
function putimage(name)
image("gfx/"..name.."",1,1,1)
end

to

1
2
3
function putimage(name)
image("gfx/"..name,1,1,1)
end

And put image format
asd.bmp instead of just asd
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview