Jump to content

[HELP] Extra Health resource


Galactix

Recommended Posts

Hello, it's been a while since I tried to use the extrahealth resource made by Solidsnake14, but I can't manage to get it working.

addEvent( "onZombieSpawn", true )
function RanSpawn_Z ( gx, gy, gz, rot)
	local safezone = 0
	local allradars = getElementsByType("radararea")
		if getElementData(theRadar, "zombieProof") == true then
	for theKey,theRadar in ipairs(allradars) do
			if isInsideRadarArea ( theRadar, gx, gy ) then
				safezone = 1
			end
		end
	end
	if safezone == 0 then
		if table.getn ( everyZombie ) < newZombieLimit then
			if not rot then
				rot = math.random (1,359)
			end
			randomZskin = math.random ( 1, table.getn ( ZombiePedSkins ) )			
			local zomb = createPed( tonumber( ZombiePedSkins[randomZskin] ), gx, gy, gz )
			if zomb ~= false then
				setElementData ( zomb, "zombie", true  )
				exports.extrahealth:setElementExtraHealth(zomb, 10000)
				table.insert( everyZombie, zomb )	
				setTimer ( function (zomb, rot) if ( isElement ( zomb ) ) then setPedRotation ( zomb, rot ) end end, 500, 1, zomb, rot )
				setTimer ( function (zomb) if ( isElement ( zomb ) ) then setPedAnimation ( zomb, "ped", chaseanim, -1, true, true, true ) end end, 1000, 1, zomb )
				setTimer ( function (zomb) if ( isElement ( zomb ) ) then setElementData ( zomb, "status", "idle" ) end end, 2000, 1, zomb )
				triggerClientEvent ( "Zomb_STFU", getRootElement(), zomb )
			end
		end
	end
end
addEventHandler( "onZombieSpawn", getRootElement(), RanSpawn_Z )

I don't get any error from the script, but the zombies keep having 100 hp. If someone knows what I'm doing wrong I'd gladly apreciate to know what it is. For those who wonder, the function is exported in the meta file properly.

Link to comment
  • Discord Moderators

First of all, remove unnecessary expressions (== true, ~= false) like this:

--// THis
if getElementData(theRadar, "zombieProof") == true then end
--// To this
if getElementData(theRadar, "zombieProof") then end

--// And this:
if zomb ~= false then end
--// To this
if zomb then end

Other than that, i cant help you, because i dont know how does that 'extrahealth' resource works.

  • Haha 2
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...