Forum

> > CS2D > Scripts > freeimage(id) doesn't work
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch freeimage(id) doesn't work

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt freeimage(id) doesn't work

Mami Tomoe
User Off Offline

Zitieren
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

alt Re: freeimage(id) doesn't work

GeoB99
Moderator Off Offline

Zitieren
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.

alt Re: freeimage(id) doesn't work

Mami Tomoe
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht