Jump to content

Damage system


Despo_Rutti

Recommended Posts

Hi all the world,

I'm trying to create a system to inflict damage to the driver and passengers in a collision against a wall.

The problem is that I try lots of different techniques but not conclusive. . . If anyone could guide me it would be nice:)

I would also ask another question.

How could I do to reduce the speed of the car during a clash and the engine stops when major damage.

Thank you in advance

(Sorry for my English: s)

Link to comment

I make this command but she doesn't work :S

function ralentissement(vehicle) 
    local theVehicle = getPlayerOccupiedVehicle ( source ) 
    speedx, speedy, speedz = getElementVelocity ( theVehicle ) 
    if isPlayerInVehicle ( source ) then 
        setElementVelocity ( theVehicle, speedx-10, speedy-10, speedz ) 
    end 
end 
  
addCommandHandler ( "test", ralentissement ) 

Link to comment
I make this command but she doesn't work :S
function ralentissement(vehicle) 
    local theVehicle = getPlayerOccupiedVehicle ( source ) 
    speedx, speedy, speedz = getElementVelocity ( theVehicle ) 
    if isPlayerInVehicle ( source ) then 
        setElementVelocity ( theVehicle, speedx-10, speedy-10, speedz ) 
    end 
end 
  
addCommandHandler ( "test", ralentissement ) 

Does it give errors/warnings, or doesn't it do anything at all?

Link to comment
You got the wrong parameters for command handlers

Server:

player playerSource, string commandName, [string arg1, string arg2, ...] 

Client:

string commandName, [string arg1, string arg2, ...] 

Lol that I didn't see that... o.O

And guess what? Using source in command handlers... Remembers me of myself when I started! :D

function ralentissement(player) 
    if isPlayerInVehicle ( player ) then 
        local theVehicle = getPlayerOccupiedVehicle ( player ) 
        local speedx, speedy, speedz = getElementVelocity ( theVehicle ) 
        setElementVelocity ( theVehicle, speedx-10, speedy-10, speedz ) 
    end 
end 
  
addCommandHandler ( "test", ralentissement ) 

(( Improved version ^^ ))

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