Make car re-spawn. -
RiChArD_A - 13.02.2013
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.
Re: Make car re-spawn. -
DaRk_RaiN - 13.02.2013
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.
DaRk_RaiN -
RiChArD_A - 13.02.2013
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.
Re: Make car re-spawn. -
MattSlater - 13.02.2013
Run a timer.
Like SetTimer("VehRespawn", 15000, true);
forward VehRespawn();
public VehRespawn()
{
// loop through the static vehicles or just MAX_VEHICLES and respawn them
}
Respuesta: Re: Make car re-spawn. -
RiChArD_A - 13.02.2013
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?
Re: Make car re-spawn. -
macparas - 14.02.2013
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 ..
Re: Make car re-spawn. -
zxc1 - 14.02.2013
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.
Re: Make car re-spawn. -
adsy - 14.02.2013
Not used it before but wouldnt this help?
https://sampwiki.blast.hk/wiki/SetVehicleToRespawn