TorNix~|nR Posted February 1, 2018 Share Posted February 1, 2018 Hello guys, I have this little problem, it makes me crazy I already set when a zombie enter to the safe zone, he will disappear (destroyElement) I want to make when the player enter to the safe zone, any zombies disappear, any help please? addEventHandler ( 'onColShapeHit', pColshape, function ( pHitElement, ped ) if getElementType( pHitElement ) == 'player' then if getElementData(pHitElement,"boss") ~= true then textDisplayAddObserver(display, pHitElement) if not bUseGunsInSavePlace then end if not bUseDamageInSaveZone then setElementData( pHitElement, 'damage', 'no' ) end end elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it local aa = getElementData(pHitElement, "zombie") if getElementData(pHitElement, "zombie") then if getElementData(pHitElement,"boss") ~= true then destroyElement(pHitElement, aa) -- THIS ONE DISAPPEAR THE ZOMBIE WHEN JOIN THE SAFE ZONE end end-- end-- end-- ) Link to comment
NeXuS™ Posted February 1, 2018 Share Posted February 1, 2018 I don't get what you are trying to do it. When a player enters a safe zone, kill all zombies on the map? 1 Link to comment
TorNix~|nR Posted February 1, 2018 Author Share Posted February 1, 2018 yes, when a player enter to the safe zone, kill all the zombies (like the zombies who are coming to him) when I am in safe zone, the zombies come, they annoy, but they get killed if they join the safe zone so the point is, I will if a player enter the safe zone, kill the zombies Link to comment
NeXuS™ Posted February 1, 2018 Share Posted February 1, 2018 (edited) addEventHandler('onColShapeHit', pColshape, function(pHitElement, ped) if getElementType(pHitElement) == 'player' then if getElementData(pHitElement,"boss") ~= true then textDisplayAddObserver(display, pHitElement) if not bUseGunsInSavePlace then end if not bUseDamageInSaveZone then setElementData(pHitElement, 'damage', 'no') end for i, k in pairs(getElementsByType("ped")) do if getElementData(k, "zombie") then if getElementData(k, "target") == pHitElement then -- You may have to change this. destroyElement(k) end end end end elseif getElementType(pHitElement) == 'ped' then -- check if the entered ped kill it local aa = getElementData(pHitElement, "zombie") if getElementData(pHitElement, "zombie") then if getElementData(pHitElement,"boss") ~= true then destroyElement(pHitElement, aa) -- THIS ONE DISAPPEAR THE ZOMBIE WHEN JOIN THE SAFE ZONE end end end end) Try this. Edited February 1, 2018 by NeXuS™ 1 Link to comment
TorNix~|nR Posted February 1, 2018 Author Share Posted February 1, 2018 Still the same, when I am inside the safe zone, the zombies spawn Link to comment
NeXuS™ Posted February 1, 2018 Share Posted February 1, 2018 (edited) local timerTable = {} addEventHandler('onColShapeHit', pColshape, function(pHitElement, ped) if getElementType(pHitElement) == 'player' then if getElementData(pHitElement,"boss") ~= true then textDisplayAddObserver(display, pHitElement) if not bUseGunsInSavePlace then end if not bUseDamageInSaveZone then setElementData(pHitElement, 'damage', 'no') end timerTable[pHitElement] = setTimer(function() for i, k in pairs(getElementsByType("ped")) do if getElementData(k, "zombie") then if getElementData(k, "target") == pHitElement then -- You may have to change this. destroyElement(k) end end end end, 500, 0) end elseif getElementType(pHitElement) == 'ped' then -- check if the entered ped kill it local aa = getElementData(pHitElement, "zombie") if getElementData(pHitElement, "zombie") then if getElementData(pHitElement,"boss") ~= true then destroyElement(pHitElement, aa) -- THIS ONE DISAPPEAR THE ZOMBIE WHEN JOIN THE SAFE ZONE end end end end) addEventHandler("onColShapeLeave", pColshape, function(hitElement) if isTimer(timerTable[hitElement]) then killTimer(timeTable[hitElement]) timerTable[hitElement] = nil end end) What about this? Edited February 1, 2018 by NeXuS™ 1 Link to comment
TorNix~|nR Posted February 1, 2018 Author Share Posted February 1, 2018 (edited) false script Edited February 1, 2018 by TorNix~|nR Link to comment
NeXuS™ Posted February 1, 2018 Share Posted February 1, 2018 Are you using slothbot for the bots? Link to comment
TorNix~|nR Posted February 1, 2018 Author Share Posted February 1, 2018 I'm using slothbot only for boss script, but the zombies are without slothbot Before this post, I sent you a wrong script, here it is the working one, if you want try it, you will see a green map on F11, sorry for taking your time. local aSavePlaces = { Circle = { -- x, y, radius }, Cuboid = { -- x, y, z, Width, Depth, Height }, Rectangle = { -- X, Y, Width, Height { 1155.28, -1350.23, 65, 58, 0, 255, 0, 0 }, }, Sphere = { -- X, Y, Z, Radius }, Tube = { -- X, Y, Z, Radius, Height }, Polygon = { -- X, Y, X1, Y1, X2, Y2, X3, Y3, ... -- You can add like X4, Y4 .. } } local aRadarAreaPlaces = { { 1155.28, -1350.23, 65, 58, 0, 255, 0, 70 }, } local sResourceName = getResourceName ( resource ) local bUseGunsInSavePlace = get( sResourceName .. '.UseGunsInSaveZone' ) local bUseRadarArea = get( sResourceName .. '.UseRadarArea' ) local pColshape, pRadarArea local bUseRunInSaveZone = get( sResourceName .. '.UseRunInSaveZone' ) local bUseJumpInSaveZone = get( sResourceName .. '.UseJumpInSaveZone' ) local bUseWeaponHudInSaveZone = get( sResourceName .. '.UseWeaponHudInSaveZone' ) local bUseAmmoHudInSaveZone = get( sResourceName .. '.UseAmmoHudInSaveZone' ) local bUseDamageInSaveZone = get( sResourceName .. '.UseDamageInSaveZone' ) addEventHandler ( 'onResourceStart', resourceRoot, function ( ) local display = textCreateDisplay () local text = textCreateTextItem("", 0.15, 0.53, "high", 150, 0, 0, 255, 2, "right", "bottom") textDisplayAddText(display, text) for s, _ in pairs( aSavePlaces ) do for _, a in pairs( aSavePlaces[ s ] ) do pColshape = _G[ 'createCol' .. s ]( unpack( a ) ) setElementData( pColshape, 'zombieProof', false ) addEventHandler ( 'onColShapeHit', pColshape, function ( pHitElement, ped ) triggerClientEvent (pHitElement, "welcome88", pHitElement) triggerClientEvent (pHitElement, "yes1", pHitElement) if getElementType( pHitElement ) == 'player' then if getElementData(pHitElement,"boss") ~= true then textDisplayAddObserver(display, pHitElement) if not bUseGunsInSavePlace then end if not bUseDamageInSaveZone then setElementData( pHitElement, 'damage', 'no' ) end end elseif getElementType( pHitElement ) == 'ped' then -- check if the entered ped kill it local aa = getElementData(pHitElement, "zombie") if getElementData(pHitElement, "zombie") then if getElementData(pHitElement,"boss") ~= true then destroyElement(pHitElement, aa) end end-- end-- end-- ) addEventHandler ( 'onColShapeLeave', pColshape, function ( pLeaveElement ) triggerClientEvent (pLeaveElement, "fail88", pLeaveElement) triggerClientEvent (pLeaveElement, "no1", pLeaveElement) if getElementType( pLeaveElement ) == 'player' then textDisplayRemoveObserver(display, pLeaveElement) if not bUseGunsInSavePlace then end if not bUseDamageInSaveZone then setElementData( pLeaveElement, 'damage', 'yes' ) end elseif getElementType( pLeaveElement ) == 'ped' then -- check if the entered ped kill it end end ) end end if bUseRadarArea then for _, a in ipairs( aRadarAreaPlaces ) do pRadarArea = createRadarArea ( unpack( a ) ) setElementData( pRadarArea, 'zombieProof', true ) end end end ) Link to comment
NeXuS™ Posted February 1, 2018 Share Posted February 1, 2018 How are zombies created? 1 Link to comment
TorNix~|nR Posted February 1, 2018 Author Share Posted February 1, 2018 the zombies have their script, of @Slothman https://community.multitheftauto.com/index.php?p=resources&s=details&id=347 Link to comment
NeXuS™ Posted February 1, 2018 Share Posted February 1, 2018 Try to manual-debug the code I sent you. I think it should work. After reviewing the script I see how it works. setElementData(pColshape, "zombieProof", true) @TorNix~|nR 1 Link to comment
TorNix~|nR Posted February 1, 2018 Author Share Posted February 1, 2018 It start destroying zombies, I think I give up Thank you so much ^^ 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