Automatic Car respawn every X time in rp server
#10

Quote:
Originally Posted by Carlton
Посмотреть сообщение
@Armada
pawn Код:
#define RESPAWN_TIME 20 // Twenty minutes
#define RESPAWN_MESSAGE_TIME 2 //Minutes before the respawn

public OnGameModeInit() {
     SetTimer("VehicleRespawn", RESPAWN_TIME * 60000, 1);
     SetTimer("VehicleRespawnMessage", (RESPAWN_TIME-RESPAWN_MESSAGE_TIME) * 60000, 0)
     return 1;
}

forward VehicleRespawn();
public VehicleRespawn() {
    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);
         }
    }
    SetTimer("VehicleRespawnMessage", (RESPAWN_TIME-RESPAWN_MESSAGE_TIME) * 60000, 0)
    return 1;
}

stock IsAnyBodyInVehicle(vid) {
  for(new i = 0; i < GetMaxPlayers(); i ++ ) {
       if(IsPlayerInVehicle(i, vid)) return 1;
  }
  return 0;
}


forward VehicleRespawnMessage();
public VehicleRespawnMessage() {
    //Message
    return 1;
}
I edited the code from Carlton for your needs
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)