Respawning cars -
Biess - 15.03.2013
Hello guys, i need help to make a automatic car respawn which spawns cars that are used.
I want a 2 minute timer for it.
Re: Respawning cars -
P3DRO - 15.03.2013
i didnt get the question. spawn cars that are used?
Re: Respawning cars -
Biess - 15.03.2013
Yes, cars that have been driven by people.
Re: Respawning cars -
Glad2BeHere - 15.03.2013
pawn Код:
CreateVehicle(541, 0, 0, 0, 10, 149,94, 120); //this 120 =2 minutes
//the timer works by the second....... after a player leaves a vehicle after 2 minutes tada
https://sampwiki.blast.hk/wiki/CreateVehicle
Re: Respawning cars -
RicaNiel - 15.03.2013
first of all get the id of the vehicle
then when the player leaves the vehicle
a timer will start to that vehicle
and when i reaches (1000*60*2) or 2 Minutes it will respawn to its last coordinates
so do it first
you need to get the pos x,y,z and the vehicle id
Re: Respawning cars -
Biess - 15.03.2013
I have this
pawn Код:
CreateVehicle(425,364.97200000,2538.03860000,17.30920000,184.00000000,37,48,15); //Hunter
what number is the spawn timer?
Re: Respawning cars -
P3DRO - 15.03.2013
but imagine that he has 2 cars, 2 infernus, same id, but only one of them was used, if he does that wont both infernus respawn? just asking, dont get me wrong
Re: Respawning cars -
Glad2BeHere - 15.03.2013
pawn Код:
CreateVehicle(425,364.97200000,2538.03860000,17.30920000,184.00000000,37,48, 120); //change 15 to 120 because 15 = 15second 120 = 120second 120/60second = 2minutes got it k bye :)
EDIT: doesnt matter how many cars all u need to do iz set the last value.... which will make the vehicle respawn if it isnt used with that time=seconds
Re: Respawning cars -
Gamer_007 - 15.03.2013
pawn Код:
#define RESPAWN_TIME 3
OnGamemodeInit()
{
SetTimer("VehicleRespawn", RESPAWN_TIME * 50000, 1);
return 1;
}
forward VehicleRespawn();
public VehicleRespawn() {
GameTextForAll("~b~Vehicles~r~Respawn~w~!!!",4000,6);
for(new i = 0; i < MAX_VEHICLES; i ++ ) {
for(new o = 0; o < GetMaxPlayers(); o ++ ) {
if(!IsPlayerConnected(o)) continue;
if(IsAnyBodyInVehicle(i)) continue;
SetVehicleToRespawn(i);
}
}
return 1;
}
stock IsAnyBodyInVehicle(vid) {
for(new i = 0; i < GetMaxPlayers(); i ++ ) {
if(IsPlayerInVehicle(i, vid)) return 1;
}
return 0;
}
This will work but try to learn it
Re: Respawning cars -
RicaNiel - 15.03.2013
Quote:
Originally Posted by P3DRO
but imagine that he has 2 cars, 2 infernus, same id, but only one of them was used, if he does that wont both infernus respawn? just asking, dont get me wrong
|
its not the car id
its the server vehicle id
its just like the player id