Make car re-spawn.
#1

Hello people, in my SV I have some cars I mapped with the MTA Map Editor and when you get in them and you move they re-spawn to their position after you exit them, and that's grate, but when you are walking and you push them they never go back to their position. So what I want to know is how to make them re-spawn after 15 seconds if they get be moved. Well this is it, I hope you help me with this. Thank you.
Reply
#2

Well there is a parameter that controls the respawn delay.
In case you use CreateVehicle
pawn Код:
// Respawn time of 60 seconds
    CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);//the last param
In case you use AddStaticVehicleEx
pawn Код:
// Respawn time of 15 seconds
    AddStaticVehicleEx ( 520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 15 );
Note:If you used AddStaticVehicle replace it with AddStaticVehicleEx, and add the respawn delay.
Reply
#3

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
Well there is a parameter that controls the respawn delay.
In case you use CreateVehicle
pawn Код:
// Respawn time of 60 seconds
    CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);//the last param
In case you use AddStaticVehicleEx
pawn Код:
// Respawn time of 15 seconds
    AddStaticVehicleEx ( 520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 15 );
Note:If you used AddStaticVehicle replace it with AddStaticVehicleEx, and add the respawn delay.
I'll try

Quote:
Originally Posted by DaRk_RaiN
Посмотреть сообщение
Well there is a parameter that controls the respawn delay.
In case you use CreateVehicle
pawn Код:
// Respawn time of 60 seconds
    CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);//the last param
In case you use AddStaticVehicleEx
pawn Код:
// Respawn time of 15 seconds
    AddStaticVehicleEx ( 520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 15 );
Note:If you used AddStaticVehicle replace it with AddStaticVehicleEx, and add the respawn delay.
Did not work. Remember I want it to respawn if someone push it out of its place not when you exit it necause I already have that.
Reply
#4

Run a timer.

Like SetTimer("VehRespawn", 15000, true);

forward VehRespawn();
public VehRespawn()
{
// loop through the static vehicles or just MAX_VEHICLES and respawn them
}
Reply
#5

Quote:
Originally Posted by MattSlater
Посмотреть сообщение
Run a timer.

Like SetTimer("VehRespawn", 15000, true);

forward VehRespawn();
public VehRespawn()
{
// loop through the static vehicles or just MAX_VEHICLES and respawn them
}
How do I add this to my SV?
Reply
#6

How do i add job in RP server .. can someone give me a script please .. bcoz my trucker didn't work i think its bug ..
Reply
#7

Quote:
Originally Posted by Lauder
Посмотреть сообщение
How do I add this to my SV?
First you add the timer in the gamemodeinit call back.
pawn Код:
SetTimer("VehRespawn", 15000, true);
And then add this somewhere in your script.
pawn Код:
forward VehRespawn();
public VehRespawn()
{
// loop through the static vehicles or just MAX_VEHICLES and respawn them
}
EDIT: By the way, if you are saving all the vehicles on your server (custom vehicle system or so), you can simply make a timer which checks the old coordinates, and the new ones, and then respawn the vehicle if it's not at the spawn coordinates.
Reply
#8

Not used it before but wouldnt this help?


https://sampwiki.blast.hk/wiki/SetVehicleToRespawn
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)