Jump to content

tank vs tank Problem


Recommended Posts

try this

function clientExplosion(x,y,z,type) 
    if type == 10 then 
        local vehicle = getPedOccupiedVehicle(localPlayer) 
        if isElement(vehicle) and getElementModel(vehicle) == 432 then 
            if getDistanceBetweenPoints3D( x,y,z , getElementPosition(vehicle)) < 8 then 
                setElementHealth(vehicle,getElementHealth(vehicle) - 200) 
            end 
        end 
    end 
end 
addEventHandler("onClientExplosion",root,clientExplosion) 

Link to comment
same Problem

I don't understand, I tested and it worked well for me

@RooTs, do you even know what are you trying to do? this makes totally no sense.

I would like to suggest you to help yourself first before trying to help other peoples.

Link to comment
server-side
  
addEventHandler("onVehicleDamage", getRootElement(), function() 
   if(getElementModel(source) == 432) then 
      setElementHealth(source, getElementHealth(source) - 100) 
   end 
end) 
  

this will not work, because the rhino takes no damage, except to flames

Edited by Guest
Link to comment
server-side
  
addEventHandler("onVehicleDamage", getRootElement(), function() 
   if(getElementModel(source) == 432) then 
      setElementHealth(source, getElementHealth(source) - 100) 
   end 
end) 
  

this will not work, why the rhino takes no damage, except to flames

Where did you read that?

Link to comment

i just have tried it and not worked for any weapon or explosive damage. @Hornet, you can test on its own, if work with you, it means that there is some bug in my GTA. I do not believe in that, because @theFOX_script also is having the same problem

Link to comment
function DamageBMX(attacker, weapon, loss, x, y, z, tyre) 
    if (getElementModel(source) == 432) then 
        cancelEvent() 
         end 
        if (getElementModel(source) == 432) then 
         local health = getElementHealth(source) 
        local losehealth = setElementHealth(source,health-90) 
         if(health == 10) then 
        x,y,z = getElementPosition(source) 
        createExplosion(x,y,z,4,true,_,true) 
       end 
     end 
  end 
addEventHandler("onClientVehicleDamage", root, DamageBMX) 

The code of Hornet works good , but you can try anyway the code which i've created for my own server , it works without doubts.

Link to comment
server-side
  
addEventHandler("onVehicleDamage", getRootElement(), function() 
   if(getElementModel(source) == 432) then 
      setElementHealth(source, getElementHealth(source) - 100) 
   end 
end) 
  

are you kidding?? This will also make raino to get damage from other weapons.

Edit: anyway, Here is the code which will make tank to get damage from Explosion.

function tankdamage(attacker, weapon, loss, x, y, z, tyre)

if (weapon == 51 and getElementModel(source) == 432 then ----------51 is Explosion id

setElementHealth(source,getElementHealth(source) - 500) ------- this will make tank lose 50% heath with Explosion.

cancelEvent()

end

end

addEventHandler("onClientVehicleDamage", root, tankdamage)

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