Forum

> > CS2D > Scripts > CS2D Tibia (I know......)
Forums overviewCS2D overview Scripts overviewLog in to reply

English CS2D Tibia (I know......)

2 replies
To the start Previous 1 Next To the start

old CS2D Tibia (I know......)

TA
User Off Offline

Quote
Well I've accepted a challenge to fix a lua error that i though would be easy to fix but the console doesent rly give me much to feed on... Plz help

This is in the hook.lua to make health bar system over players heads, it give a error to console but it works like a charm.. tho the errors are annoying cuz i cant read anything else then the error.


addhook("ms100", "HEALTHbarsms100")
function HEALTHbarsms100()
	for _, id in ipairs(player(0, 'table')) do
	if 	PLAYERS[id].tmp.equip[3].monstermessage >= 35 then
			hudtxt2(id,15, "", '255255255', 565, 389-CONFIG.PIXELS, 1)
			hudtxt2(id,16, "", '255255255', 565, 392-CONFIG.PIXELS, 1)
		else
			PLAYERS[id].tmp.equip[3].monstermessage = PLAYERS[id].tmp.equip[3].monstermessage + 1
		end
		if PLAYERS[id] and PLAYERS[id].tmp then
		if PLAYERS[id].x and PLAYERS[id].y then
			if PLAYERS[id].HP > 80 then
				freeimage(PLAYERS[id].hpimage)
				PLAYERS[id].hpimage = image("gfx/weiwen/100hp.png", 0, 1, id+200)
			elseif PLAYERS[id].HP > 60 then
				freeimage(PLAYERS[id].hpimage)
				PLAYERS[id].hpimage = image("gfx/weiwen/80hp.png", 0, 1, id+200)
			elseif PLAYERS[id].HP > 40 then
				freeimage(PLAYERS[id].hpimage)
				PLAYERS[id].hpimage = image("gfx/weiwen/60hp.png", 0, 1, id+200)
			elseif PLAYERS[id].HP > 20 then
				freeimage(PLAYERS[id].hpimage)
				PLAYERS[id].hpimage = image("gfx/weiwen/40hp.png", 0, 1, id+200)
			else
				freeimage(PLAYERS[id].hpimage)
				PLAYERS[id].hpimage = image("gfx/weiwen/20hp.png", 0, 1, id+200)
			end
		end
		else
			if PLAYERS[id].hpimage then
				freeimage(PLAYERS[id].hpimage)
			end
		end
	end
end



This is the error :
LUA ERROR: sys/lua/cs2dtibia/hooks.lua:329 attempt to index field '?' (a nil value)


And line 329 from above is :
if 	PLAYERS[id].tmp.equip[3].monstermessage >= 35 then


All i've found out is that a value is missing and i dont know witch one it is (Pm or comment and ill post the file)

old Re: CS2D Tibia (I know......)

TA
User Off Offline

Quote
user DreadMare has written
@user TA: That code looks like file cs2d Tibia Edition Nick : with those Retarted hearts above the player


Indeed it is! i hate the hearts but ive got something that i want to replace it with. tho i want the error fixed befor i play around with it


And nick isent around anymore (atleast of what i know) and thats why im asking you guys


Note : removing the hook will cause bugs in the some places
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview