Jump to content

Simple script bug


xeon17

Recommended Posts

I wanted to create a script that respawn vehicles when they explode , and that respawn when are unused i mean.

If 2 minutes nobody use the car , should respawn.

function before (vehicle) 
if_used = getPedOccupiedVehicle (vehicle) 
if ( if_used ) then 
outputChatBox("",vehicle,255,255,255,true) 
else 
respawnVehicle ( vehicle ) 
end 
end 
  
  
  
function respawnMoveVehicle() 
    setTimer(before, 100000, 1, source) 
end 
addEventHandler("onVehicleExit", getRootElement(), respawnMoveVehicle) 
  
function respawnExplodedVehicle() 
    setTimer(respawnVehicle, 5000, 1, source) 
end 
addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle) 
  
  
  

The part with un-used vehicles no work , bug on line 2 > bad ''ped'' pointer

Edited by Guest
Link to comment
I wanted to create a script that respawn vehicles when they explode , and that respawn when are unused i mean.

If 2 minutes nobody use the car , should respawn.

function before (vehicle) 
if_used = getPedOccupiedVehicle (vehicle) 
if ( if_used ) then 
outputChatBox("",vehicle,255,255,255,true) 
else 
respawnVehicle ( vehicle ) 
end 
end 
  
  
  
function respawnMoveVehicle() 
    setTimer(before, 100000, 1, source) 
end 
addEventHandler("onVehicleExit", getRootElement(), respawnMoveVehicle) 
  
function respawnExplodedVehicle() 
    setTimer(respawnVehicle, 5000, 1, source) 
end 
addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle) 
  
  
  

The part with un-used vehicles no work , bug on line 2 > bad ''ped'' pointer

function before (vehicle,thePlayer)

if_used = isPedInVehicle (thePlayer)

if ( if_used ) then

outputChatBox("",vehicle,255,255,255,true)

else

respawnVehicle ( vehicle )

end

end

 

 

 

function respawnMoveVehicle()

    setTimer(before, 100000, 1, source)

end

addEventHandler("onVehicleExit", getRootElement(), respawnMoveVehicle)

 

function respawnExplodedVehicle()

    setTimer(respawnVehicle, 5000, 1, source)

end

addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle

Link to comment
function before (tVehicle) 
if_used = getVehicleOccupant(tVehicle) 
if ( if_used ) then 
outputChatBox("",vehicle,255,255,255,true) 
else 
respawnVehicle ( tVehicle) 
end 
end 
  
  
  
function respawnMoveVehicle() 
    setTimer(before, 100000, 1, source) 
end 
addEventHandler("onVehicleExit", getRootElement(), respawnMoveVehicle) 
  
function respawnExplodedVehicle() 
    setTimer(respawnVehicle, 5000, 1, source) 
end 
addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle) 
  
  
  

Changed 'getPedOccupiedVehicle' to 'getVehicleOccupant'

Edited by Guest
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...