Forum

> > CS2D > Scripts > its about my rpg tibia lua, free image [solved]
Forums overviewCS2D overview Scripts overviewLog in to reply

English its about my rpg tibia lua, free image [solved]

7 replies
To the start Previous 1 Next To the start

old its about my rpg tibia lua, free image [solved]

haha1955
User Off Offline

Quote
1
2
3
[15:08:10] LUA ERROR: sys/lua/cs2dtibia/hooks.lua:433: bad argument #1 to 'freeimage' (number expected, got nil)
[15:08:10]  -> [C]: in function 'freeimage'
[15:08:10]  -> sys/lua/cs2dtibia/hooks.lua:433: in function <sys/lua/cs2dtibia/hooks.lua:417>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_100.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 60 then
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_75.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 40 then
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_50.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 20 then
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_25.png", 0, 1, id+200)
                else
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_10.png", 0, 1, id+200)
                end

can any please help me to fix this error? thanks.
edited 21×, last 05.01.20 04:56:50 pm

old Re: its about my rpg tibia lua, free image [solved]

Gaios
Reviewer Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_100.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 60 then
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_75.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 40 then
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_50.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 20 then
                    freeimage(PLAYERS[id].hpimage)
                    PLAYERS[id].hpimage = image("gfx/hpbar_25.png", 0, 1, id+200)
                else
                    if (PLAYERS[id].hpimage) then
                      freeimage(PLAYERS[id].hpimage)
                    end
                    PLAYERS[id].hpimage = image("gfx/hpbar_10.png", 0, 1, id+200)
                end

old Re: its about my rpg tibia lua, free image [solved]

haha1955
User Off Offline

Quote
thanks for the fast answer dear gaios but its have now more error:S

1
2
3
4
5
6
7
8
9
[15:34:21]  -> [C]: in function 'freeimage'
[15:34:21]  -> sys/lua/cs2dtibia/hooks.lua:436: in function <sys/lua/cs2dtibia/hooks.lua:417>
[15:34:21] LUA ERROR: sys/lua/cs2dtibia/hooks.lua:436: bad argument #1 to 'freeimage' (number expected, got nil)
[15:34:52]  -> [C]: in function 'freeimage'
[15:34:52]  -> sys/lua/cs2dtibia/hooks.lua:439: in function <sys/lua/cs2dtibia/hooks.lua:417>
[15:34:52] LUA ERROR: sys/lua/cs2dtibia/hooks.lua:439: bad argument #1 to 'freeimage' (number expected, got nil)
[15:33:13]  -> [C]: in function 'freeimage'
[15:33:13]  -> sys/lua/cs2dtibia/hooks.lua:433: in function <sys/lua/cs2dtibia/hooks.lua:417>
[15:33:13] LUA ERROR: sys/lua/cs2dtibia/hooks.lua:433: bad argument #1 to 'freeimage' (number expected, got nil)

old Re: its about my rpg tibia lua, free image [solved]

Promaster
User Off Offline

Quote
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
30
if PLAYERS[id].hpimage then
						freeimage(PLAYERS[id].hpimage)
						PLAYERS[id].hpimage = nil
					end
                    PLAYERS[id].hpimage = image("gfx/hpbar_100.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 60 then
					if PLAYERS[id].hpimage then
						freeimage(PLAYERS[id].hpimage)
						PLAYERS[id].hpimage = nil
					end
                    PLAYERS[id].hpimage = image("gfx/hpbar_75.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 40 then
					if PLAYERS[id].hpimage then
						freeimage(PLAYERS[id].hpimage)
						PLAYERS[id].hpimage = nil
					end
                    PLAYERS[id].hpimage = image("gfx/hpbar_50.png", 0, 1, id+200)
                elseif PLAYERS[id].HP > 20 then
					if PLAYERS[id].hpimage then
						freeimage(PLAYERS[id].hpimage)
						PLAYERS[id].hpimage = nil
					end
                    PLAYERS[id].hpimage = image("gfx/hpbar_25.png", 0, 1, id+200)
                else
					if PLAYERS[id].hpimage then
						freeimage(PLAYERS[id].hpimage)
						PLAYERS[id].hpimage = nil
					end
                    PLAYERS[id].hpimage = image("gfx/hpbar_10.png", 0, 1, id+200)
                end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview