Jump to content

Damage system


Despo_Rutti

Recommended Posts

Posted

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)

Posted

Try to make a simple command that will set vehicle's speed which you are seating in. I'm sure this function works. Also make sure your script has not got any errors, nor warnings.

Posted

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 ) 

Posted
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?

Posted

You got the wrong parameters for command handlers

Server:

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

Client:

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

Posted
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 ^^ ))

Posted

Hi thank you :)

When I try the command, it works but the problem is that it does not change the speed indefinitely (he take position and takes it back in place) I didn't see how to resolve the problem so I still need your help ^ ^

Thank you again ^^

Posted

I am not sure what you are trying to say. But setting the velocity is like a pulse. You will have to repeat it if you want continuous velocity changes in a certain direction.

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