-stolka- Posted September 26, 2013 Share Posted September 26, 2013 how do i set the health of a ped created by the function createPed Link to comment
-stolka- Posted September 27, 2013 Author Share Posted September 27, 2013 does it work with zombies? i mean set their helth when the get spawned? Link to comment
-stolka- Posted September 27, 2013 Author Share Posted September 27, 2013 addEvent( "onZombieSpawn", true ) function RanSpawn_Z ( gx, gy, gz, rot) local safezone = 0 local allradars = getElementsByType("radararea") for theKey,theradar in ipairs(allradars) do if getElementData(theradar, "zombieProof") == true then 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 ) setElementHealth(zomb, 200) 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 ) Link to comment
Moderators IIYAMA Posted September 27, 2013 Moderators Share Posted September 27, 2013 You don't need to show your code for that, the answer is yes. You can use it on all elements that can have health. (ped's, players and vehicles) Link to comment
TAPL Posted September 27, 2013 Share Posted September 27, 2013 Objects also can have health. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now