Jump to content

Do not attack zombies


DRW

Recommended Posts

Hello, I'm using a script made by Falke, it creates a bot in a zone and this one tries to kill you.

The problem is that I don't want the bot to attack peds that have the "zombie" element data with the value "true".

How can I do that?

Server

--[[ 
    ########################################################################## 
    ##                                                                      ## 
    ## Project: 'Boomer of L4D 2' - resource for MTA: San Andreas           ## 
    ##                                                                      ## 
    ########################################################################## 
    [C] Copyright 2013-2014, Falke 
]] 
createTeam ( "Zombies", 0, 0, 0 ) 
local Zteam = getTeamFromName ( "Zombies" ) 
  
    function Boss () 
            blip = {} 
        local localPed = exports [ "slothBot" ]:spawnBot (2908.3369140625, -1937.263671875, 1.6241011619568, 90,  math.random ( 300, 303 ), 0, 0, Zteam, 0,         "hunting", true ) 
        local health = exports.extra_health:setElementExtraHealth ( localPed, 5000 ) 
        setElementModel ( localPed, 38 ) 
        setElementData(localPed, "type", "RealBoomer") 
        setPedStat(localPed, 24, 1000) 
        RealBoomer = localPed 
        blip[1] = (createBlipAttachedTo ( localPed, 0 )) 
            triggerClientEvent ( "sound2", root ) 
  
  
    end 
addEventHandler("onResourceStart", resourceRoot, Boss)  
addEvent("onWitchReady", true) 
  
  
addEventHandler("onPedWasted", getRootElement(), 
    function(ammo, killer) 
        if isElement(RealBoomer) then 
            if source == RealBoomer then 
                local x, y, z = getElementPosition(RealBoomer) 
                destroyElement(blip[1]) 
                createExplosion ( x, y, z, 1 ) 
                    triggerClientEvent ( "estallido", root )  
                                    local oldZcount = getAccountData(killer,"zombies.kills") 
                                                    local attacker2 = getPlayerAccount(killer) 
                if oldZcount ~= false then 
                    setAccountData ( attacker2, "zombies.kills", oldZcount+30  ) 
                    setElementData( killer, "Zombie kills", oldZcount+30 ) 
                setTimer(Boss, 30000, 1) 
  
end 
            end 
        end 
    end 
) 
  
  

Client

--[[ 
    ########################################################################## 
    ##                                                                      ## 
    ## Project: 'Boomer of L4D 2' - resource for MTA: San Andreas           ## 
    ##                                                                      ## 
    ########################################################################## 
    [C] Copyright 2013-2014, Falke 
]] 
  
function replaceModel()  
  txd = engineLoadTXD("skin/boomer.txd", 38) 
  engineImportTXD(txd, 38) 
  dff = engineLoadDFF("skin/boomer.dff", 38 ) 
  engineReplaceModel(dff, 38) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) 
  
addCommandHandler ( "reloadskin", replaceModel ) 
  
addEvent ( "estallido", true ) 
addEventHandler ( "estallido", root, 
    function ( ) 
        playSound ( "boom.mp3" ) 
    end 
) 
  
addEvent ( "sound1", true ) 
addEventHandler ( "sound1", root, 
    function ( ) 
       local sound1 = playSound ( "sonido1.mp3" ) 
    end 
) 
  
addEvent ( "sound2", true ) 
addEventHandler ( "sound2", root, 
    function ( ) 
       local sound2 = playSound ( "sonido2.mp3" ) 
    end 
) 
  

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...