Forum

> > CS2D > Scripts > Freeimage bug, requesting support
Forums overviewCS2D overview Scripts overviewLog in to reply

English Freeimage bug, requesting support

2 replies
To the start Previous 1 Next To the start

old Freeimage bug, requesting support

Yates
Reviewer Off Offline

Quote
Hello,

Lately I have been having this problem. It seems to be that the freeimage command is removing images that belong to someone else. I do not know what causes this nor do I know how to fix it, hope you guys can help..

This is how I create an image;
1
Player[id].propimage = image([stuff])
Yes, the table exists (Player[id].propimage does not until I use the code above, unless someone already has an image and I use freeimage and then the code above) and everything works fine until multiple players (around 4) start playing and get themselves a prop of their own. Suddenly other peoples images start to disappear once someone else has chosen a prop and the image has been created for that player.

I have not been able to find anything that could occur with certain ID's, it's really random. I do not freeimage with a timer, just normally. And on leave your images are removed as well to make sure players that join with that ID do not have the image.

Hope you guys can help. And before you ask, I cannot provide the full code (as I don't want to) and there is nothing special that happens with images either. So the only thing I can think of is the way I create images that the ID's conflict or something.

If you cannot help with the problem, but have your own way of creating images that has never had this problem that would be great!

Regards.
edited 1×, last 10.03.14 11:50:47 am

old Re: Freeimage bug, requesting support

DC
Admin Off Offline

Quote
It's pretty hard (if not impossible) to help you without having a code sample which allows us to reconstruct the problem.

• For a start you should print the assigned image IDs to see if anything suspicious happens
• Do a seach for "propimage" in your entire sourcecode and double check all assignments
• Do the same for all occurences of the commands "image" and "freeimage"

old Re: Freeimage bug, requesting support

Yates
Reviewer Off Offline

Quote
This is basically the code I have (just without the checks and stuff).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Player = {}

function _join(id)
	Player[id] = {}
end
addhook("join","_join")

function _use(id)
	if Player[id].propimage then
		freeimage(Player[id].propimage)
	end
	Player[id].propimage = image("You can add an image path here",1,-1,100+id)
end
addhook("use","_use")

function _leave(id)
	if Player[id].propimage then
		freeimage(Player[id].propimage)
	end
end
addhook("leave","_leave")

user DC has written
• Do a seach for "propimage" in your entire sourcecode and double check all assignments
• Do the same for all occurences of the commands "image" and "freeimage"

I've done these, I'll try the first suggestion out later on today. Thanks.

** Edit:

IMG:https://i.imgur.com/nvdlBBG.png


Fixed. Thank you very much, if I did not start printing the tables that stored the image ID's I wouldn't have found the source of the problem:

The naughty round restart, I thought (stupidly enough) it would for no reason at all set the storage places to 0, or nil, when it free'd the images. It did not (actually very logical) and then someone else got a new image, let's say ID 3. And when I wanted to get a new image I already had the ID 3 stored in my table, and then the Lua removed the other persons image.
edited 2×, last 10.03.14 10:20:30 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview