Respawning cars
#1

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.
Reply
#2

i didnt get the question. spawn cars that are used?
Reply
#3

Yes, cars that have been driven by people.
Reply
#4

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
Reply
#5

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
Reply
#6

I have this
pawn Код:
CreateVehicle(425,364.97200000,2538.03860000,17.30920000,184.00000000,37,48,15); //Hunter
what number is the spawn timer?
Reply
#7

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
Reply
#8

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
Reply
#9

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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)