TorNix~|nR Posted August 4, 2016 Posted August 4, 2016 Hi everyone, I have a zombie blips script! but I have little problem, I made that when Zombie is dead, the blip destroyed! and it do not work can anyone help please? blips = { } addEvent ( "onZombieSpawn", true ) addEventHandler ( "onZombieSpawn", root, function ( ) for _, v in ipairs ( getElementsByType ( "ped" ) ) do if getElementData ( v, "zombie" ) then if ( not blips [ v ] ) then blips [ v ] = createBlipAttachedTo ( v, 0, 1, 255, 0, 0, 150, 0, 500) end end end end ) addEvent ( "onPedWasted", true ) addEventHandler ( "onPedWasted", root, function ( ) if ( isElement ( blips [ source ] ) ) then destroyElement ( blips [ source ] ) end end ) ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003
Bonus Posted August 4, 2016 Posted August 4, 2016 Maybe the blip is only getting created again because of onZombieSpawn? Try to ask there, if the ped is dead: if getElementData ( v, "zombie" ) and not isPedDead ( v ) then
Moderators IIYAMA Posted August 5, 2016 Moderators Posted August 5, 2016 Doesn't have the event onZombieSpawn a source element? Also clean your table... Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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