Jump to content

Server Problem


Recommended Posts

In an earlier post of mine it said that if you make a script and add it to play resource it will play the resource.

But when I start this resource the car doesn't appear.

boxwille = createVehicle ( 495, 1226.8956298828, -987.04681396484, 43.686561584473, 0, 0, 87.609985351563 )       -- create us a new vehicle
if ( boxwille ) then
setVehicleRespawnDelay ( newvehicle, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end
sanchez1 = createVehicle ( 1222.3643798828, -982.44836425781, 43.686561584473, 0, 0,  87.609985351563 )
if ( sanchez1 ) then
setVehicleRespawnDelay ( newvehicle, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end
sanchez2 = createVehicle ( 1222.3643798828, -991.80096435547, 43.686561584473, 0, 0, 87.609985351563 )
if ( sanchez1 ) then
setVehicleRespawnDelay ( newvehicle, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end
function chatbox ( onVehicleRespawn )
onVehicleRespawn ( boxwille )
outputChatBox ( "The Boxwille has arrived, Visit temple area and you will see" [255,0,0] )
end
function followblip ()
createBlipAttachedTo ( boxwille, 51 )
end
function playsound()
onVehicleEnter (boxwille) then
outputChatBox ( "#FF0000*"..getPlayerName.. "has Entered the truck" )
outputChatBox ( "#FF0000* Get the truck to the destination" ..getPlayerName.., source)
onVehicleExit ( boxwille ) then
outputChatBox ( "#FF0000*"..getPlayerName.." has left the truck" )
outputChatBox ( "#FF0000*Get back on the truck" ..getPlayerName..", source" )
end

Edited by Guest
Link to comment

First, you'll see this:

boxwille = createVehicle ( 495, 1226.8956298828, -987.04681396484, 43.686561584473, 0, 0, 87.609985351563 )       -- create us a new vehicle
if ( boxwille ) then
setVehicleRespawnDelay ( newvehicle, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end
sanchez1 = createVehicle ( 1222.3643798828, -982.44836425781, 43.686561584473, 0, 0,  87.609985351563 )
if ( sanchez1 ) then
setVehicleRespawnDelay ( newvehicle, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end
sanchez2 = createVehicle ( 1222.3643798828, -991.80096435547, 43.686561584473, 0, 0, 87.609985351563 )
if ( sanchez1 ) then
setVehicleRespawnDelay ( newvehicle, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end

A bit messed up!

Check line 6 and 10.

And you forgot to put the vehicle ID on line 5 and 9!

and also the argument for setVehicleRespawnDelay is wrong.

I guess you forgot to add the function.

So the result must be:

function vehicles()
boxwille = createVehicle ( 495, 1226.8956298828, -987.04681396484, 43.686561584473, 0, 0, 87.609985351563  )       -- create us a new vehicle
if ( boxwille ) then
setVehicleRespawnDelay ( boxwille, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
 
 sanchez1 = createVehicle ( 468, 1222.3643798828, -982.44836425781, 43.686561584473, 0, 0,  87.609985351563 )
if ( sanchez1 ) then
setVehicleRespawnDelay ( sanchez1, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
 
sanchez2 = createVehicle ( 468, 1222.3643798828, -991.80096435547, 43.686561584473, 0, 0, 87.609985351563 )
if ( sanchez2 ) then
setVehicleRespawnDelay ( sanchez2, 900000 )  -- tell the server to respawn the vehicle 15 minutes after it's blown
end
end
end

It's not tested yet so test it.

I also didn't see any event handlers.

Why not put a event handler to start it , like:

addEventHandler( "onClientResourceStart", getRootElement( ),>function name<

Link to comment

if you want to respawn vehicles after leaving, not streaming out try this:

--serverside
addEventHandler("onVehicleExit",boxwille,function(_,seat)
if seat==0 then
        respawntimer=setTimer(function() respawnVehicle(boxwille) end,8000,1) --time in miliseconds
end
end)
 
addEventHandler("onVehicleEnter",boxwille,function()
if isTimer(respawntimer) then
killTimer(respawntimer)
end
end)

im not sure, will it work, but you can try

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