Jump to content

[Help] DD Addon


BieHDC

Recommended Posts

Hello,

i wanna make something that detects which player(vehicle) has hit the other player(vehicle).

So if the one hit the other and the hitted got killed within 10 sec the other recives something.

I dont want you to make me this script!

I wanna know what would be the best Functions and Events to use.

I thought about attaching a colsphere to the vehicle and on hit to check.

And would be serverside or clientside better.

(i think serverside :P )

thx if you can help me a bit, if not then not

Link to comment
function hit (collide) 
  
 if collide and getElementType(collide)=="vehicle"  then  --check if is a vehicle , or  hitted an object from the map 
  
        if ( source == getPedOccupiedVehicle(getLocalPlayer()) ) then  -- check if you hitted somebody  
  
              setTimer(check_if_is_alive,10000,1,collide) -- timmer to 10s 
        end 
 end 
end 
 addEventHandler("onClientVehicleCollision", root, hit) 
  
function check_if_is_alive(car) 
  
if  car and getVehicleOccupant(car) and  getElementData(getVehicleOccupant(car),"state") ~= "dead" then  
  
  -- the hitted player is still alive  
  
    return 
  
else 
  
  
 -- the hitted player is dead so you do here your stuff's 
  
end 
  
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...