SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 26/06/2011, 07:04 AM   #1
Ash.
High-roller
 
Ash.'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 2,082
Reputation: 163
Default Vehicles don't respawn.

Good Morning,
Okay I've been recently notified about vehicles not respawning on my server. I looked into the matter and could find nothing wrong.

I hooked the CreateVehicle function to allow me to set a "global respawn time" without changing every vehicle if it needed changing. The CreateVehicle function I created also handles the creation of vehicles which are not to be moved (and are to be switched off always)

I know this function works, as i've printed its outcome (and now my server log is full of "Vehicle Created")

Here is the function:

pawn Code:
stock _CreateVehicle(vtype, Float:x, Float:y, Float:z, Float:rot, color1, color2, respawn, show=0)
{
    #pragma unused respawn
    return CreateVehicle(vtype, x, y, z, rot, color1, color2, (show == 0) ? 60000 : -1);
}

#define CreateVehicle _CreateVehicle

I will explain the last bit.
The "show" variable is passed as 1 when a vehicle that is not to be moved by players is to be created.
The ternary operator then sorts out the respawn time based on the show variable. The show variable defaults to 0, and so no special addons to the CreateVehicle lines further down the script is needed.

The ternary operator, says if show is at its default (so show == 0) then the respawn time will be one minute. Otherwise (it is something else, should be one unless I failed at typing) it will be -1.

I don't understand why the vehicles aren't respawning. I know that they aren't just because i've sat at a vehicle spawn for around 10 minutes, and the vehicle hadn't respawned. (This was on the test server, and so noone could of been using the vehicle)

Has anyone got any ideas?

Thanks,
Ash
__________________
TruckingWorld
Work, Play, Make Friends
Written from scratch, and originally released in 2011, play today!
Visit the forum | Play the game
Ash. is offline  
Old 26/06/2011, 07:25 AM   #2
Ash.
High-roller
 
Ash.'s Avatar
 
Join Date: Jan 2010
Location: England
Posts: 2,082
Reputation: 163
Default Re: Vehicles don't respawn.

Edit: Oops, should of used edit sorry

The function does work:

Code:
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time 60000
[08:33:41] Created vehicle 0 with respawn time -1
[08:33:41] Created vehicle 0 with respawn time -1
[08:33:41] Created vehicle 0 with respawn time -1
[08:33:41] Created vehicle 0 with respawn time -1
[08:33:41] Created vehicle 0 with respawn time -1]
The only thing is it couldn't retrieve the ID..?
__________________
TruckingWorld
Work, Play, Make Friends
Written from scratch, and originally released in 2011, play today!
Visit the forum | Play the game
Ash. is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Respawn vehicles.. DevilRP Scripting Help 10 10/03/2012 01:39 PM
respawn all vehicles Madsen Help Archive 2 05/03/2011 11:40 PM
Respawn all unused vehicles LZLo Help Archive 13 16/08/2010 12:40 PM
Respawn all vehicles BP13 Help Archive 5 10/12/2009 03:39 PM
Vehicles don't respawn PoWerZ Help Archive 0 08/04/2009 08:48 AM


All times are GMT. The time now is 06:24 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.