Forum

> > CS2D > Scripts > freeimage(id) doesn't work
Forums overviewCS2D overview Scripts overviewLog in to reply

English freeimage(id) doesn't work

5 replies
To the start Previous 1 Next To the start

old freeimage(id) doesn't work

Mami Tomoe
User Off Offline

Quote
OK I KNOW that I'm the one wrong here not the freeimage function but I'm bad with titles

I've searched and viewed a few topics and they seem to use arrays and what not which I don't know how to add to my code.
My request is just to make this work

Code >


Hope this is not too hard for you guys because it is for me

old Re: freeimage(id) doesn't work

GeoB99
Moderator Off Offline

Quote
The ID value of an image will be still stored in the stack regardless of
freeimage(pl)
being executed. Here's the approach how to handle the way of removing the previous hats.
1
local hat_images = {}
We have a local table, we'll call it hat_images. With this one we'll store the current hat of every player.
The Code >

And then, note the fifth and eight line. In 5 line we'll create a condition if the player actually wears a hat and if so the previous hat gets faded away and ID value removed. This is the crucial part if we don't want to face weird issues with the images.

old Re: freeimage(id) doesn't work

Mami Tomoe
User Off Offline

Quote
I have changed
1
removedp_msg2(id,color.white,"["..script_name.."]: "..color.yellow.."You have bought a Devil hat.")
to
1
rp_msg2(id,color.white,"["..script_name.."]: "..color.yellow.."You have bought a Devil hat.")

Did some tabbing...
And when I test it the menu doesn't react to anything so I changed
if (hat_images[pl]) then

to
if not (hat_images[pl]) then


And the freeimage thing is back...

When I buy a hat it shows and if I buy another hat they both show instead of switching and when I remove hat nothing happens
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview