Jump to content

DayZ respawn problem


DropDead41

Recommended Posts

I have a problem with the vehicles respawn in my server of dayz, being exploited they respawn to the original position without the gear to be able to store things, or put the elements needed to make the car work .. I'm using this script, that works fine, but the gear disappears .. someone could re-send me the script with this bug fixed?

function respawnVehicle( vehicle ) 
    spawnVehicle ( vehicle, getElementData( vehicle, "posX" ), getElementData( vehicle, "posY" ), getElementData( vehicle, "posZ" ), getElementData( vehicle, "rotX" ), getElementData( vehicle, "rotY" ), getElementData( vehicle, "rotZ" ) ) 
end 
  
function onVehicleSpawn () 
    local x,y,z = getElementPosition (source) 
    setElementData (source,"posX",x) 
    setElementData (source,"posY",y) 
    setElementData (source,"posZ",z) 
end 
addEventHandler ("onVehicleExplode",getRootElement(),onVehicleSpawn) 
  
function onVehicleExplode () 
    setTimer( respawnVehicle, 50000, 1, source ) 
end 
addEventHandler("onVehicleExplode", getRootElement(), onVehicleExplode) 
DropDead41 
New User 
  
Posts: 12 
Joined: Tue Mar 05, 2013 12:14 am 
Gang: Groove 
Top 
  

Link to comment

Try using isntead:

  
setAccountData  
getAccountData 
getPlayerAccount 
getAccountName 
  

you also got it wrong. you did function .. ( vehicle )

this will not work properly, you should get the element by souce, not by vehicle.

try this:

  
function respawnVehicle() 
local account = getPlayerAccount( source ) 
    spawnVehicle ( vehicle, getAccountData( account, "posX" ), getAccountData( account, "posY" ), getAccountData( account, "posZ" ), getAccountData( account, "rotX" ), getAccountData( account, "rotY" ), getAccountData( account, "rotZ" ) ) 
end 
  
function onVehicleSpawn () 
local account = getPlayerAccount( source ) 
    local x,y,z = getElementPosition (source) 
    local rx,ry,rz = getElementRotation ( targetElem ) 
    setAccountData (account,"posX",x) 
    setAccountData (account,"posY",y) 
    setAccountData (account,"posZ",z) 
    setAccountData (account,"rotX",rx) 
    setAccountData (account,"rotY",ry) 
    setAccountData (account,"rotZ",rz) 
end 
addEventHandler ("onVehicleExplode",getRootElement(),onVehicleSpawn) 
  
function onVehicleExplode () 
    setTimer( respawnVehicle, 50000, 1, source ) 
end 
addEventHandler("onVehicleExplode", getRootElement(), onVehicleExplode) 

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