Jump to content

Some questions tune garage, car in water...


Recommended Posts

I have some questions lol nothing new xD

1. I have use this when the car explode that the car spawn back

addEventHandler( "onVehicleExplode", getRootElement( ), 
    function( ) 
        local parent = getElementParent( source ) 
        if getElementType( parent ) == "map" and getElementID( parent ) ~= "dynamic" then 
            setTimer( respawnVehicle, 40000, 1, source ) 
        else 
            setTimer( destroyElement, 5000, 1, source ) 
        end 
    end 
) 

But the problem is when the car is in the water the script dont work :(

Can someone help me when the car is the water that the car respawn back.

2. Is there a way that a player can repair a vehicle with he press a key and flip the vehicle?

r = repair the vehicle and f = flip the vehicle

can someone here help me too :D

3. and is this normal that no tune garage or paint and fix garage is open?

or need i for that a special script too?

BIG THX for the help!!!

Link to comment

1. For as far as I know there's no real way to check if a vehicle is in the water in DP2. Therefore, you probably can't do this yet.

2. Sure, that's possible. Some pages that might interest you:

- bindKey

- fixVehicle

- setVehicleRotation

3. Normally, most garages are closed. You can't do anything with them in DP2. However, in 1.0 these can be operated by script, so you can make something like a "Pay 'n Spray script".

As some parts require a newer version, you might need to wait. Or, you can try a nightly build. (see it as a beta for 1.0) But do remember that the player count is extremely low on these builds, as they're not really intended to be played on. So it's recommended to install it in an other directory than your DP2 version.

Link to comment

BIG THX for the help :D

But i add now keys for repair the car and that work very good!!

My problem is the flip, i have test many things but nothing work :(

Can someone add me in this script a flip plz :)

function flipVehicle (carflip) 
    if isPlayerInVehicle(carflip) then -- If the player is in a vehicle... 
  
  
  
         flip? 
  
  
  
            end 
           outputChatBox ( "Car is Flip", carflip, 0, 255, 0 ) 
    else -- If the player isn't in a vehicle... 
        outputChatBox ( "You are not in a vehicle", carflip, 0, 255, 0 ) 
    end 
end 
addCommandHandler('flip', flipVehicle) 
addCommandHandler('f', flipVehicle) 

And about the vehicle underwater, is there a way when the vehicle is under water that the vehicle explode?

I have a respawn for explode vehicles.

THX for the Help! :)

Link to comment

As I said, there doesn't appear to be any sort of vehicle-in-water detection in DP2, therefore, not possible in DP2 yet.

For the car flip you can use something like this:

... 
local veh=getPlayerOccupiedVehicle(carflip) 
local x,y,z=getElementPosition(veh) 
local rx,ry,rz=getVehicleRotation(veh) 
setVehicleRotation(veh,0,0,rz) 
setElementPosition(veh,x,y,z+5) 
... 

Link to comment

BIG THX now work fix and flip :D THX for the help!!!!

I have make a little stunt server and add some vehilces with the new map editor.

Its not funny when some hours later no vehicles more on the map and all in the water :(

When the vehicle is in the water then is no player more in the vehicle, is there a way when the vehicle is not more on the place where i add it and nobody is in the vehicle that the vehicle respawn on the old place???

Link to comment

ok i have found "Idle" so that the vehicle respawn when is it no on the .map place.

but with this:

theVehicle = createVehicle ( 400, 1, 1, 1 )       -- create us a new vehicle 
  
if ( theVehicle ) then 
    setVehicleIdleRespawnDelay ( theVehicle, 20000 ) -- tell the server to respawn the vehicle 20 seconds after it's been left. 
  
  
end 

i must add a vehicle :(

but i want that the vehicle from my .map respawn.

So i found this :)

function idleRespawn () 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            setVehicleIdleRespawnDelay(vehicle, 20000) 
        end 
    end 
addEventHandler("onGamemodeMapStart", getRootElement(), idleRespawn ) 

But i drive the vehicle back from the .map place stop and leave the vehicle alone but no respawn to the .map place :(

Have i foget something or whatever?

Or can someone here make me a script? Respawns the vehicle when someone left it after 20-30 sec on the .map file place.

I hope someone can help me :)

Link to comment

That example appears to work with gamemodes. (i.e. "gamemode stealth sth-sewers")

Since I guess you're just using a normal resource, try replacing "onGamemodeMapStart" with "onResourceStart". That should, more or less, fix your problem.

Link to comment

Ok i have now

function doNotRespawn ( thePlayer ) 
  
    local theVehicle = getPlayerOccupiedVehicle ( thePlayer ) 
    if ( theVehicle ) then 
        toggleVehicleRespawn ( theVehicle, true ) -- tell the server not to respawn this vehicle 
    end 
end 
  
  
addCommandHandler("donotrespawn", doNotRespawn) 
  
  
function idleRespawn () 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            setVehicleIdleRespawnDelay(vehicle, 5000) 
        end 
    end 
addEventHandler("onResourceStart", getRootElement(), idleRespawn ) 

and not work :(

Have i do something wrong?

Link to comment

function idleRespawn () 
        for i,vehicle in ipairs(getElementsByType("vehicle")) do 
            toggleVehicleRespawn(vehicle, true) 
            setVehicleIdleRespawnDelay(vehicle, 5000) 
        end 
    end 
  
  
addEventHandler("onResourceStart", getRootElement(), idleRespawn ) 

ahhhhh this dont work too plz help... this script make me crazy... the last script for my server a small idle vehicle respawn on the .map place :(

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