Jump to content

help infection


Jacobob14

Recommended Posts

Posted

because after becoming zombie zombies still attack me...

  
local bloodsounds = {"blood01.wav","blood02.wav","blood03.wav",} 
local humanidad = 100 
local infectados = getTeamFromName( "Infectados" ) 
local zombie = false 
local sWidth, sHeight = guiGetScreenSize() 
local px, py, pz = getElementPosition ( getLocalPlayer ( ) ) 
  
addEventHandler( "onClientRender", root, 
        function ( ) 
         lineLength = 114 * ( humanidad / 100 ) 
         lineLength5 = 114 * ( 100 / 100 ) 
                 dxDrawRectangle(sWidth-180,sHeight-68,lineLength,17.0,tocolor(0, 0, 255, 255),false) 
          dxDrawRectangle(sWidth-180,sHeight-68,lineLength5,17.0,tocolor(0, 0, 0, 170),false) 
        dxDrawText("Humanidad: "..math.ceil(humanidad ).."%",sWidth-180,sHeight-66,0,0,tocolor(255,255,255,255),0.4,"bankgothic") 
        end 
    )    
  
  
  
     
  
addEventHandler( "onClientPlayerDamage", localPlayer,  
  function ( a ) 
  if a then 
    if humanidad >= 20 then 
     local g_Type = getElementType( a ) 
      if g_Type == "ped" then 
       humanidad = humanidad - math.random( 1, 10 ) 
      elseif g_Type == "player" then 
       if getPlayerTeam( a ) == infectados then 
            humanidad = humanidad - math.random( 1, 10 ) 
      end 
     end 
    elseif humanidad <= 20 then 
        humanidad = 0 
   end 
  end 
 end 
 ) 
  
  
 setTimer( function () 
   if not zombie then 
    if humanidad < 100 then 
     if humanidad <= 0 then 
         triggerServerEvent( "infanim", localPlayer ) 
         setTimer( function() 
         triggerServerEvent( "beaZombie", localPlayer ) 
         end, 6000, 1) 
         zombie = true 
        playSound(bloodsounds[math.random(1, #bloodsounds)]) 
          bloodinf() 
     elseif humanidad < 20 then 
        playSound(bloodsounds[math.random(1, #bloodsounds)]) 
         humanidad = 0 
          bloodinf() 
     elseif humanidad > 20 then 
          humanidad = humanidad - math.random( 1, 10 ) 
          playSound(bloodsounds[math.random(1, #bloodsounds)]) 
          zombie = false 
          bloodinf() 
      end 
     end 
   end 
end , math.random(20000, 30000) , 0 ) 
  
 addEventHandler( "onClientPlayerSpawn", localPlayer, 
    function ( ) 
      humanidad = 100 
      zombie = false 
    end 
) 
  
addEventHandler( "onClientPlayerDamage", localPlayer, 
   function (_, weapon ) 
      if not zombie then 
        if weapon == 41 then 
           if humanidad <= 99 then 
              humanidad = humanidad + 5 
           end 
        elseif weapon == 42 then 
            if humanidad >= 99 then 
              humanidad = humanidad - 5 
           end 
        end 
      end 
    end 
) 
  
  
  
function givetvirus( number ) 
            if humanidad >= 100 then 
              humanidad = humanidad - number 
           end 
end 
  
  
  
function giveantivirus() 
missed = 100 - humanidad 
           if humanidad <= 99 then 
              humanidad = humanidad + missed 
           end 
end 
  
  
  
  
  
function bloodinf() 
      local randombloodamount = math.random( 10, 30 ) 
      local px, py, pz = getElementPosition ( getLocalPlayer ( ) ) 
        fxAddBlood ( px, py, pz+0.6, 1, 1, 0, randombloodamount, 1 ) 
end 
  

  • Moderators
Posted

The code you gave us is totally useless ... We need the part of the server code that is moving the zombies.

The rEvolution is coming ...

Posted

Use:

setElementData(localPlayer,"zombie",true) 

And update zombies target.

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
The code you gave us is totally useless ... We need the part of the server code that is moving the zombies.
local infectados = createTeam ( "Infectados", 250, 0, 20) 
local w_Table = {4,6,9} 
local z_Table = { 67,66,64,63,62,61,60,78,79,80,81 } 
  
addEvent( "beaZombie", true ) 
addEventHandler( "beaZombie", root,  
    function ( ) 
       setPlayerTeam( source, infectados ) 
       takeAllWeapons ( source ) 
       setElementModel( source, z_Table[math.random( 1, #z_Table)]) 
       giveWeapon ( source, w_Table[math.random( 1, #w_Table)] , 1, false ) 
       setElementData( source, "infected", true ) 
       setElementHealth( source, 100 ) 
       setElementData( source, "zombie", true) 
         if isPedInVehicle( source ) then 
            removePedFromVehicle ( source) 
         end 
    end 
) 
  
addEventHandler( "onVehicleStartEnter", root,  
   function ( thePlayer ) 
     if getPlayerTeam( thePlayer ) == infectados then 
        cancelEvent() 
     end 
   end 
  ) 
   
addEventHandler( "onPlayerSpawn", root, 
    function () 
       setElementData( source, "infected", false ) 
       setElementData( source, "zombie", false) 
    end 
 ) 

Posted

Well you have the setElementData Ok, You have to trigger with an export or something the function that makes the zombies target a ped and ignore if it's a zombie. Not sure what function it is but look into the Zombie resource Files.

What you are going to acomplish with this is to make near zombies re-scan for NoN-Zombie peds and that will make them stop atacking you.

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 

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